[Paraview-developers] Problems with point/edge attributes when loading Paraview state
Matthias Schneider
schneider at vision.ee.ethz.ch
Thu May 8 09:27:56 EDT 2014
Hi,
I am using a simple vtk filter acting on a vtkPolyData object wrapped in
a paraview plugin. As input the filter expects a scalar input array,
either cell or point attribute. I'm using the following code.
xml:
<ServerManagerConfiguration>
<ProxyGroup name="filters">
<SourceProxy name="MySimpleFilter" class="vtkMySimpleFilter">
<InputProperty
name="Input"
command="SetInputConnection">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkPolyData"/>
</DataTypeDomain>
<InputArrayDomain name="input_array1" attribute_type="any"
number_of_components="1" />
</InputProperty>
<StringVectorProperty
name="AttributeField"
command="SetAttributeFieldName"
number_of_elements="1"
element_types="2">
<ArrayListDomain name="array_list" attribute_type="Scalars"
input_domain_name="input_array1">
<RequiredProperties>
<Property name="Input" function="Input" />
</RequiredProperties>
</ArrayListDomain>
</StringVectorProperty>
[...]
cxx:
void vtkMySimpleFilter::SetAttributeFieldName(const char *fName) {
vtkPolyData *input = vtkPolyData::SafeDownCast(this->GetInput());
int assoc = vtkDataObject::FIELD_ASSOCIATION_NONE;
if (input) {
if (input->GetCellData()->HasArray(fName))
assoc = vtkDataObject::FIELD_ASSOCIATION_CELLS;
else if (input->GetPointData()->HasArray(fName))
assoc = vtkDataObject::FIELD_ASSOCIATION_POINTS;
else {
vtkErrorMacro(<< "invalid data field: " << fName);
return;
}
} else {
vtkErrorMacro(<< "invalid input");
return;
}
this->SetInputArrayToProcess(0, 0, 0, assoc, fName);
}
The plugin works fine in general. However, when the filter pipeline
containing the plugin filter is exported as Paraview state, the state
cannot be loaded again. After loading the state, SetAttributeFieldName
is called with the correct field name string but the vtkPolyData input
seems not to be loaded correctly for some reason, i.e., the data array
cannot be found and I end up in the "invalid data field" branch of
SetAttributeFieldName.
Also in the Paraview GUI ("Active Variable Controls"), the drop down
list does not contain any point/cell attributes (only "Solid Color" is
listed). After enabling the visibility of the source data object, the
list in the Paraview GUI gets updated.
I am wondering if there is a way to either force an update of the entire
pipeline to get the attribute names updated properly before initializing
the filter. Otherwise, I had to figure out if the field name argument to
SetAttributeFieldName refers/used to refer to a point or cell attribute.
Is there any way to add this to the StringVectorProperty of the plugin
GUI as a hidden field so that it gets exported to the state file? Or any
other ideas how to do this? Any help is appreciated very much.
Just in case: I tested on Paraview 4.1.0 64-bit (Linux)
Thank you very much,
Matthias
More information about the Paraview-developers
mailing list