[Paraview-developers] lookuptable and proxy desynchronisation

Waldin Nicholas nwaldin at student.ethz.ch
Wed Aug 28 10:57:48 EDT 2013


Managed to fix the problem (or at least I think I have :) ). For those interested, look at

pqScalarOpacityFunction* pqOPF = lut_mgr->getScalarOpacityFunction(
      this->getServer(), arrayname, number_of_components, 0)

in pqPipelineReperesentation.cxx (approx line 650) and

pqPQLookupTableManager::getScalarOpacityFunction 

in pqPQLookupTableManager.cxx (approx line 484)

I've added the "approx" because i've changed code over here and the line numbers won't be the same in your code.
________________________________________
From: paraview-developers-bounces at paraview.org [paraview-developers-bounces at paraview.org] on behalf of Waldin  Nicholas [nwaldin at student.ethz.ch]
Sent: Tuesday, August 27, 2013 5:13 PM
To: paraview-developers at paraview.org
Subject: [Paraview-developers] lookuptable and proxy desynchronisation

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?

_______________________________________________
Paraview-developers mailing list
Paraview-developers at paraview.org
http://public.kitware.com/mailman/listinfo/paraview-developers


More information about the Paraview-developers mailing list