[Paraview-developers] lookuptable and proxy desynchronisation

Waldin Nicholas nwaldin at student.ethz.ch
Tue Aug 27 11:13:40 EDT 2013


Hi,


I'm basically having a desynchronisation of a proxy and a lookup table in paraview when modifying a paraview widget.




What I was trying to do:


When using the paraview volume render there is a panel that allows you to set the scalar opacity function and a color function. I tried to extend this by adding a gradient opacity function.


How I attempted it:

Basically I tried a “quick and dirty” approach where I simply extended the classes that contained the scalar opacity function by adding an additional gradient function. I added the gradient function in the necessary xml files, and the function gets added to the lookup table when the scalar function is added.


How I added it to the lookup table:

(file: pqPQLookupTable.cxx method: createLookupTable(pqServer* server,
  const QString& arrayname, int number_of_components, int component))


pqScalarOpacityFunction* sof = this->createOpacityFunction(...);

vtkSMPropertyHelper(lutProxy, "ScalarOpacityFunction").Set(sof->getProxy());


// An opacity function is created as a "slave" to this lookup table

pqScalarOpacityFunction* gof =

this->createOpacityFunction(...);

vtkSMPropertyHelper(lutProxy, "GradientOpacityFunction").Set(gof->getProxy());

lutProxy->UpdateVTKObjects();


I won't add in the createOpacityFunction code here (I only made a minor change to it, so I could pass it an arrayname for the key; and it would take up a lot of space). It basically creates and registers a proxy.








The problem:

The gradient function that the user edits has no effect on the gradient function of the renderer. This seems to be because “vtkSMPVRepresentationProxy” and the lookup table are pointing to different gradient functions, but the scalar functions are the same (or rather, there is only 1 scalar function).


To explain with some code from vtkSMPVRepresentationProxy:


sof = scalar opacity function

gof = gradient opacity function

lut = lookuptable


//Get the functions through the vtkSMPVRepresentationProxy:

vtkSMProperty* sofProperty = this->GetProperty("ScalarOpacityFunction");

vtkSMProperty* gofProperty = this->GetProperty("GradientOpacityFunction");

vtkSMProxy* sof = vtkSMPropertyHelper(sofProperty).GetAsProxy();

vtkSMProxy* gof = vtkSMPropertyHelper(gofProperty).GetAsProxy();


//Get the lookup table through vtkSMPVRepresentationProxy

vtkSMProperty* lutProperty = this->GetProperty("LookupTable");

vtkSMProxy* lut = vtkSMPropertyHelper(lutProperty).GetAsProxy();




//get the functions through the lookup table

vtkSMProxy* sof_lut = vtkSMPropertyHelper(

lut, "ScalarOpacityFunction", true).GetAsProxy();

vtkSMProxy* gof_lut = vtkSMPropertyHelper(

lut, "GradientOpacityFunction", true).GetAsProxy();



result:

sof == sof_lut

gof != gof_lut




My Questions:


  *   How do the vtkSMPVRepresentationProxy and the lookup table get “synchronised” values?

  *   Where does the vtkSMPVRepresentationProxy get it's values? I think it's through the “UpdatePropertyInformation()” specified in “vtkSMProxy”

  *   And (if anyone happens to know): Why am I getting something different form the scalar opacity function?



More information about the Paraview-developers mailing list