I created a custom view where I change the scale of the GridAxes3DActor (vtkPVGridAxes3DActor) and of the actors of the view’s representation when I change the scale of a single representation (so I can compare them), and I want to reflect these changes in the properties panel when the user changes the active source in the pipeline browser.
I examined the vtkPVGridAxes3DActor and vtkPVDataRepresentation classes and I didn’t see a method that can help me to find the proxies associated with these objects.
Can you please tell me how can I find the proxy associated with an object (address/pointer) so I can update the “Scale” property and hope that this action will update the value shown in the property panel when user changes the pipeline’s source ?
There’s not easy way of doing this for good reason. With ParaView intended for client-server use, the client is the one that “drives” everything and hence a proxy having to “observe” changes on its VTK-object is rare. There are expections that do this, e.g vtkSMRepresentationProxy observes events on the local VTK-object, as do proxies for 3D widgets. But honestly, I wouldn’t venture into doing that unless you’re absolutely sure of what you’re doing. Things can get very complicated very quickly.
OK, that’s clear. Thanks !
I want to share what I did in my custom view to ensure that all view’s representations have the same scale:
- When a new representation is added to my view, I insert the representation’s actor pointer and the pqDataRepresentation (that I retrieve from pqActiveObjects::instance().activeRepresentation(), I didn’t find another solution) in a map.
- I add an observer to the actor (a view’s method) that will be executed when the actor is modified (for instance when its scale is modified)
- The callback will use the pqRepresentation associated to the other actors from the map (except the actor who fired the callback) to get the vtkSMProxy of the representation. Finally, the vtkSMPropertyHelper will be used to set a new value for the “Scale” and UpdateVTKObjects to effectively update the other actors.
- It works and what’s great that when I change the active representation in the pipelien browser, the scale values in properties panel are updated. My other solution, where I don’t pass via proxies, panel’s scale widget is not updated.