[Paraview-developers] Is it possible to animate representation properties?

Biddiscombe, John A. biddisco at cscs.ch
Thu Oct 4 09:50:36 EDT 2012


Cory



I had a long train ride to experiment with this and managed to get the basics working.



Adding an AddCustomProxy(...) method to pqAnimationViewWidget is all that is really necessary to allow you to display the new stuff in the animation view. For a simple representation I found that all I had to do was in the display panel decorator (in this case for my splotch renderer) add the following
//
QWidget *mainWindow = pqCoreUtilities::mainWidget();
pqAnimationViewWidget *pqaw = mainWindow->findChild<pqAnimationViewWidget*>("animationView");
pqaw->addCustomProxy("Splotch", reprProxy);

and hey presto all the stuff appears. Unfortunately, pretty much everything appears, but for a quick first go this is enough. What needs to be done is to modify some of the more in depth code to only display the properties on the proxy that are actually marked as animateable. I didn't try this yet.

I had a more specific problem when I wanted to animate properties from a proxy that I had generated 'internally'. We parse XML on the fly and create dynamic controls based on messages from a simulation, this meant that when I added the proxy I had strange effects. I mention this in case you get problems.

1)      You need to make sure the proxy has a domain. If it's a double (say), then it is sufficient to just make sure you have <DoubleRangeDomain name="range"/> and that will do. Otherwise the property doesn't get updated properly (or at all).

2)      You also need to register your proxy with the proxy manager (and thereby produce an associated pqProxy). I wasn't doing this and when the track is created with your own proxy property selected, the track had no 'title'. It turned out that the string generation of the name that appears needs to get the pqProxy from the servermangermodel in order to fetch the string to show (so sphere1 appears as sphere1 etc etc) and then it adds the property label string to it of the one you're animating . Custom renderers just appear as DataRepresentation1..., but I didn't look into tweaking it yet. Anyway, for my custom proxy which is completely fabricated, paraview wasn't happy. It turns out when you call RegisterProxy - the group name you use affects how the pqProxy associated with it is generated and I had to fool paraview into creating a bare pqProxy (as opposed to a pqTimeKeeper or some other specialized type) by using the group "layouts" which is of course nonsense, but if you skim through the code in Qt\Core\pqStandardServerManagerModelInterface.cxx you'll see why. I think I should fix this to allow a "Custom" group so that I don't need to lie about the real group. Either that or allow some other default of pqProxy rather than NULL which is current. If Utkarsh is reading this he'll no doubt comment or suggest a sensible default.
pm->RegisterProxy("layouts", "DsmProxyHelper", this->DsmProxyHelper);
pqServerManagerModel* smmodel =
pqApplicationCore::instance()->getServerManagerModel();
this->pqDsmProxyHelper = smmodel->findItem<pqProxy*>(this->DsmProxyHelper);
and then later ...
//
QWidget *mainWindow = pqCoreUtilities::mainWidget();
pqAnimationViewWidget *pqaw = mainWindow->findChild<pqAnimationViewWidget*>("animationView");
pqaw->addCustomProxy("DSM", this->DsmProxyHelper);


To get the pqProxy if you need it in your own code, use the findItem shown above. Anyway, for what you want, most of this email is unnecessary and you can just to the top bit.



Hope this helps.



JB



diff --git a/Qt/Components/pqAnimationViewWidget.cxx b/Qt/Components/pqAnimationViewWidget.cxx

index 8ee9eef..4cca0a2 100644

--- a/Qt/Components/pqAnimationViewWidget.cxx

+++ b/Qt/Components/pqAnimationViewWidget.cxx

@@ -75,6 +75,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "vtkSMPropertyHelper.h"

#include "vtkSMProxy.h"

#include "vtkSMRenderViewProxy.h"

+#include "vtkSMProxyManager.h"



//-----------------------------------------------------------------------------

class pqAnimationViewWidget::pqInternal

@@ -818,6 +819,16 @@ void pqAnimationViewWidget::setActiveView(pqView* view)

}



//-----------------------------------------------------------------------------

+void pqAnimationViewWidget::addCustomProxy(const char *name, vtkSMProxy* pxy)

+{

+  this->Internal->CreateSource->removeProxy(name);

+  if (pxy && this->Internal->CreateSource->findText(name) == -1)

+    {

+    this->Internal->CreateSource->addProxy(0, name, pxy);

+    }

+}

+

+//-----------------------------------------------------------------------------

void pqAnimationViewWidget::setCurrentSelection(pqPipelineSource* pxy)

{

   if (pxy)

diff --git a/Qt/Components/pqAnimationViewWidget.h b/Qt/Components/pqAnimationViewWidget.h

index 0b8f38b..ca5270c 100644

--- a/Qt/Components/pqAnimationViewWidget.h

+++ b/Qt/Components/pqAnimationViewWidget.h

@@ -53,6 +53,7 @@ public:

   pqAnimationViewWidget(QWidget* parent=0);

   virtual ~pqAnimationViewWidget();



+  void addCustomProxy(const char *name, vtkSMProxy* pxy);

public slots:



   /// set the scene to view

diff --git a/Utilities/Xdmf2 b/Utilities/Xdmf2

index 616fe9f..4cb22f3 160000

--- a/Utilities/Xdmf2

+++ b/Utilities/Xdmf2

@@ -1 +1 @@

-Subproject commit 616fe9f5525c0a39c215837888ef48269fdb83a6

+Subproject commit 4cb22f3e1f3bfed6e8382f689999030055ada4b3-dirty

diff --git a/VTK b/VTK

index 8b0026d..0429b26 160000

--- a/VTK

+++ b/VTK

@@ -1 +1 @@

-Subproject commit 8b0026d1764edfb8dcd3dda3222abc79f100f652

+Subproject commit 0429b26096df318ca1c58cea239d22daa83ed475


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20121004/0c187999/attachment-0001.htm>


More information about the Paraview-developers mailing list