[Paraview] custom filter doesn't update property in the Paraview UI

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Thu Jul 14 10:40:56 EDT 2016


There are a couple of things wrong with your plugin :).

1. A RequestData() implementation should never change MTime of the
filter. You code call SetNPoints() which changes MTime.
2. ParaView's properties are not bi-directional. They are only
intended to be set on the UI side and pushed to the VTK side. There
are of course exceptions to this, and you can add what's called a
"information_only" property that instead reads a value from the VTK
side and provides it on the "client" side, but for such properties,
often there's no UI. They are instead, used to define the "domain" for
the property which controls things like range for the slider, for
example.



On Thu, Jul 14, 2016 at 10:34 AM, corinna reuter
<corinnareuter75 at gmail.com> wrote:
> Hello,
> I would like to work on a filter that updates some of its properties from
> the filter input. As a demonstration, I attach a (quite minimal)
> "vtkTestProperty" filter algorithm, which takes vtkPolyData input, and which
> is supposed to copy input->GetNumberOfPoints() into the filter's "NPoints"
> property which is exposed to the user interface.
>
> Inside vtkTestProperty::RequestData, I execute:
>     int nset=input->GetNumberOfPoints();
>     this->SetNPoints(nset);
> which, is correctly setting the NPoints value. Additional print statements
> in the code confirm, that NPoints is actually updated, but the new value
> won't be shown in the Paraview UI.
>
> To reproduce the behaviour, the attachment is ready to compile with Paraview
> 5.0.1. Just load the compiled plugin in Paraview, create a "SphereSource"
> and append the "ATestPropery" filter to the SphereSource. The console output
> will show that NPoints is set to 50 (Number of Points of the Sphere), but
> the UI still shows 42 (the default value from the Servermanager xml).
>
> What am I doing wrong?
>
> Thank you
> Corinna
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>


More information about the ParaView mailing list