[Paraview] Get name of object in Pipeline Browser

Biddiscombe, John A. biddisco at cscs.ch
Thu Aug 18 09:06:25 EDT 2011


Lars

I assumed you had some kind of custom panel for your exporter. If you are just doing file->export, then my approach won’t be suitable.

[snip]
>This is clear. 
[end]

good, 

...
> I assume I can get *it like this:

QList<pqPipelineSource*> sources_and_filters =
pqApplicationCore::instance()->getServerManagerModel()->findItems<pqPipelineSource*>(); 
...
yes that's the kind of thing. Sadly, I don't memorize the syntax so I'm not quite sure exactly how one gets the sources, but you can look at example plugins (I cut'n paste from all my others with tweaks each time for new features).

>>>
But where and when do I have to call that code? Because at the moment my plugin is executed by clicking on "File / Export" in ParaView, so I don't have any GUI related code. Everything is on the VTK side.
<<<
if you had a custom panel, then you could hook into the accept method and do the proxy manipulation there, just before the proxy is actually updated and the writer writes.

>>>
        vtkSMPropertyHelper modified(source->getProxy(), "MyNameString");
        modified.Set(xmlName.c_str()); // or something like that
This sets the name on the proxy. 
<<<

yes, this sets the name on the client side of the proxy - only the local copy 

>>>
then you need to push your string into the VTK class using something like
source->getProxy()->UpdateVTKObjects()
or UpdatePipeline (I forget the correct calls)
But what is that doing? 
<<<

the UpdateVTKObjects actually pushes the local client side proxy values to the remote object which manages your real VTK object, the actual writer which is doing stuff.

>>>
See vtkOpenSGExporter.h / .cxx on Github: 
https://github.com/bilke/pv_opensg_plugin

Thank you very much for your help!!
<<<

I'm afraid I have too much of my own work to do to look at your code, but perhaps you're getting closer. you can create a filter with a custom panel, but make your writer the filter if you follow me. then when the user clicks accept, the writer will write, rather than using the drop down menu for export. it may not be ideal, but it was my first idea.

JB


More information about the ParaView mailing list