[Paraview-developers] Is it possible to animate representation properties?
Cory Quammen
cquammen at cs.unc.edu
Fri Jun 29 10:55:47 EDT 2012
David,
Thanks for your response. I indeed can set the Opacity and Visibility
properties for the Surface representation in the animation controls.
In fact, this is what led me to believe that arbitrary representation
properties could be animatable.
However, it seems that Opacity and Visibility are special properties
handled independently from the normal XML animatable designation. This
code in Qt/Components/pqAnimatablePropertiesComboBox.cxx provides the
evidence:
//-----------------------------------------------------------------------------
void pqAnimatablePropertiesComboBox::addDisplayProperties(vtkSMProxy* proxy)
{
if (!proxy || !proxy->IsA("vtkSMSourceProxy"))
{
return;
}
vtkSMSourceProxy* sourceProxy = static_cast<vtkSMSourceProxy*>(proxy);
unsigned int numports = sourceProxy->GetNumberOfOutputPorts();
for (unsigned int kk=0; kk < numports; kk++)
{
QString suffix;
if (numports > 1)
{
suffix = QString(" [%1]").arg(sourceProxy->GetOutputPortName(kk));
}
this->addSMPropertyInternal(
QString("%1%2").arg("Visibility").arg(suffix),
proxy, "Visibility" , 0, true, kk);
this->addSMPropertyInternal(
QString("%1%2").arg("Opacity").arg(suffix),
proxy, "Opacity", 0, true, kk);
}
}
Also, in ParaViewCore/ServerManager/vtkPVRepresentationAnimationHelper.cxx,
visibility and opacity are handled specially:
//----------------------------------------------------------------------------
void vtkPVRepresentationAnimationHelper::SetVisibility(int visible)
{
if (!this->SourceProxy)
{
return;
}
unsigned int numConsumers = this->SourceProxy->GetNumberOfConsumers();
for (unsigned int cc=0; cc < numConsumers; cc++)
{
vtkSMRepresentationProxy* repr = vtkSMRepresentationProxy::SafeDownCast(
this->SourceProxy->GetConsumerProxy(cc));
if (repr && repr->GetProperty("Visibility"))
{
vtkSMPropertyHelper(repr, "Visibility").Set(visible);
repr->UpdateProperty("Visibility");
}
}
}
//----------------------------------------------------------------------------
void vtkPVRepresentationAnimationHelper::SetOpacity(double opacity)
{
if (!this->SourceProxy)
{
return;
}
unsigned int numConsumers = this->SourceProxy->GetNumberOfConsumers();
for (unsigned int cc=0; cc < numConsumers; cc++)
{
vtkSMRepresentationProxy* repr = vtkSMRepresentationProxy::SafeDownCast(
this->SourceProxy->GetConsumerProxy(cc));
if (repr && repr->GetProperty("Opacity"))
{
vtkSMPropertyHelper(repr, "Opacity").Set(opacity);
repr->UpdateProperty("Opacity");
}
}
}
Based on this, it looks like one can't animate arbitrary
representation properties.
I'm happy to see if I can add animation of representation properties
unless there is a good reason not to (I can't think of any).
Thanks,
Cory
On Fri, Jun 29, 2012 at 9:54 AM, David E DeMarle
<dave.demarle at kitware.com> wrote:
> It seems to work for standard representations: open wavelet, change
> mode to surface, in animation view add a track for Wavelet1's opacity,
> VCR through.
> It could be an issue then with the fact that it is a custom representation.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
> On Mon, Jun 25, 2012 at 11:19 AM, Cory Quammen <cquammen at cs.unc.edu> wrote:
>> Hi all,
>>
>> I have a custom representation plugin that has a couple single-element
>> double vector properties. Seeing the Opacity and Visibility properties
>> in the Animation View control panel made me think that representation
>> properties could be added easily. However, imply describing the
>> properties as animateable in the XML file describing the
>> representation doesn't seem to do it.
>>
>> Is this currently possible with ParaView? If not, would it be
>> desirable to others? If so, I'll look into adding the capability.
>>
>> Thanks,
>> Cory
>>
>> --
>> Cory Quammen
>> Research Associate
>> Department of Computer Science
>> The University of North Carolina at Chapel Hill
>> _______________________________________________
>> Paraview-developers mailing list
>> Paraview-developers at paraview.org
>> http://public.kitware.com/mailman/listinfo/paraview-developers
--
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill
More information about the Paraview-developers
mailing list