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

corinna reuter corinnareuter75 at gmail.com
Thu Jul 14 11:11:52 EDT 2016


On Thu, Jul 14, 2016 at 4:40 PM, Utkarsh Ayachit <
utkarsh.ayachit at kitware.com> wrote:

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

I was expecting this, because I am only starting to learn plugin
programming right now :)


>
> 1. A RequestData() implementation should never change MTime of the
> filter. You code call SetNPoints() which changes MTime.
>

I'll check the meaning of 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.


I was also assuming this, but I thought there are a few filters that update
their properties when some inputs upstream in the pipeline change. My
memory can be wrong, though.


> 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.
>

I am not sure, whether I understand all details of your reply.
In summary, is it possible to update UI properties of a filter, when its
input changes? By no means?

I'd need something similar to an image resize filter. The output size
should be identical to the input size, when the filter is first attached to
the input. The output size should be shown in the UI and the user should be
able to enter a different output size. Is this impossible? Not even with
some more complicated workaround?

Thank you
Corinna



>
>
>
> 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
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160714/d73fb89e/attachment.html>


More information about the ParaView mailing list