Commit 894426cc authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Exclude field arrays from filter selections.

Commit 2e21207d added support for including field data in
vtkSMArrayListDomain. That resulted in filters now showing field data
arrays in array selection dialogs when it was not intended. Fixed that
by adding a new attribute type mode called "any-except-field", which is
now the default mode for vtkSMArrayListDomain.
parent b861673d
Pipeline #7903 passed with stage
......@@ -212,7 +212,7 @@ void vtkSMArrayListDomainInternals::BuildArrayList(
{
continue;
}
assert(acceptable_as != vtkSMInputArrayDomain::ANY);
assert(acceptable_as != vtkSMInputArrayDomain::ANY && acceptable_as != vtkSMInputArrayDomain::ANY_EXCEPT_FIELD);
// iterate over all arrays and add them to the list, if acceptable.
for (int idx=0, maxIdx=attrInfo->GetNumberOfArrays(); idx < maxIdx; ++idx)
......
......@@ -31,17 +31,18 @@ static const char* const vtkSMInputArrayDomainAttributeTypes[] = {
"point",
"cell",
"field",
"any",
"any-except-field",
"vertex",
"edge",
"row",
"any",
NULL
};
//---------------------------------------------------------------------------
vtkSMInputArrayDomain::vtkSMInputArrayDomain()
{
this->AttributeType = vtkSMInputArrayDomain::ANY;
this->AttributeType = vtkSMInputArrayDomain::ANY_EXCEPT_FIELD;
this->NumberOfComponents = 0;
}
......@@ -142,6 +143,29 @@ bool vtkSMInputArrayDomain::IsAttributeTypeAcceptable(
attribute_type == ROW;
}
if (required_type == ANY_EXCEPT_FIELD)
{
// Try out all attribute types except field data sequentially.
int attribute_types_to_try[] =
{
vtkDataObject::POINT,
vtkDataObject::CELL,
vtkDataObject::VERTEX,
vtkDataObject::EDGE,
vtkDataObject::ROW,
-1
};
for (int cc=0; attribute_types_to_try[cc] != -1; ++cc)
{
if (vtkSMInputArrayDomain::IsAttributeTypeAcceptable(
attribute_types_to_try[cc], attribute_type, acceptable_as_type))
{
return true;
}
}
return false;
}
switch (attribute_type)
{
case vtkDataObject::POINT:
......
......@@ -29,17 +29,22 @@
// appropriate.
//
// Supported XML attributes:
// \li \c attribute_type : (optional) value can be 'point', 'cell', 'any',
// 'vertex', 'edge', 'row', 'none'. If no specified,
// 'any' is assumed. This indicates the attribute type
// for acceptable arrays. Note "any" implies all types
// of attribute data (thus doesn't include field data
// since it's not attribute data).
// \li \c attribute_type : (optional) value can be 'point', 'cell', 'field',
// 'vertex', 'edge', 'row', 'none', 'any-except-field', 'any'.
// If not specified, 'any-except-field' is assumed. This
// indicates the attribute type for acceptable arrays.
// \li \c number_of_components : (optional) 0 by default. If non-zero, indicates
// the component count for acceptable arrays.
//
// This domain doesn't support any required properties (to help clean old
// code, we print a warning if any required properties are specified).
//
// .SECTION Note on change in behaviour
// Prior to ParaView 5.0, attribute_type="any" meant all attributes excepting
// field data. For being consistent with general understanding of "any", this
// has been changed to include field data arrays since 5.0. Use
// "any-except-field" for cases where the intention is to match any attribute arrays except
// field data arrays.
#ifndef vtkSMInputArrayDomain_h
#define vtkSMInputArrayDomain_h
......@@ -96,11 +101,12 @@ public:
POINT = vtkDataObject::POINT,
CELL = vtkDataObject::CELL,
FIELD = vtkDataObject::FIELD,
ANY = vtkDataObject::POINT_THEN_CELL,
ANY_EXCEPT_FIELD = vtkDataObject::POINT_THEN_CELL,
VERTEX = vtkDataObject::VERTEX,
EDGE = vtkDataObject::EDGE,
ROW = vtkDataObject::ROW,
NUMBER_OF_ATTRIBUTE_TYPES = vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES
ANY = vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES,
NUMBER_OF_ATTRIBUTE_TYPES = ANY+1,
};
// Description:
......
......@@ -8283,8 +8283,7 @@ source.</Documentation>
name="input_type">
<DataType value="vtkDataSet" />
</DataTypeDomain>
<InputArrayDomain attribute_type="any"
name="input_array"
<InputArrayDomain name="input_array"
number_of_components="3" />
<Documentation>This property specifies the input to the Stream Tracer
filter.</Documentation>
......
......@@ -21,8 +21,7 @@
name="input_type">
<DataType value="vtkUnstructuredGridBase" />
</DataTypeDomain>
<InputArrayDomain attribute_type="any"
name="input_array_any">
<InputArrayDomain name="input_array_any">
</InputArrayDomain>
<Documentation>Set the input to the representation.</Documentation>
</InputProperty>
......
......@@ -14,8 +14,7 @@
name="input_type">
<DataType value="vtkUnstructuredGridBase" />
</DataTypeDomain>
<InputArrayDomain attribute_type="any"
name="input_array_any">
<InputArrayDomain name="input_array_any">
</InputArrayDomain>
<Documentation>Set the input to the representation.</Documentation>
</InputProperty>
......
......@@ -92,7 +92,7 @@ timestep.
<DataTypeDomain name="input_type">
<DataType value="vtkDataSet" />
</DataTypeDomain>
<InputArrayDomain attribute_type="none"
<InputArrayDomain attribute_type="field"
name="input_array"
number_of_components="1" />
<Documentation>Set the input of the filter.</Documentation>
......
......@@ -4938,8 +4938,7 @@
dataset.</Documentation>
<InputProperty command="SetInputConnection"
name="Input">
<InputArrayDomain attribute_type="any"
name="input_array_any"></InputArrayDomain>
<InputArrayDomain name="input_array_any"></InputArrayDomain>
</InputProperty>
<IntVectorProperty command="SetVisibility"
default_values="1"
......@@ -5200,8 +5199,7 @@
<Documentation>Proxy to show a selection as geometry.</Documentation>
<InputProperty command="SetInputConnection"
name="Input">
<InputArrayDomain attribute_type="any"
name="input_array_any"></InputArrayDomain>
<InputArrayDomain name="input_array_any"></InputArrayDomain>
</InputProperty>
<IntVectorProperty command="SetVisibility"
default_values="1"
......
......@@ -14,8 +14,7 @@
name="input_type">
<DataType value="vtkDataSet" />
</DataTypeDomain>
<InputArrayDomain attribute_type="any"
name="input_array_any">
<InputArrayDomain name="input_array_any">
</InputArrayDomain>
<Documentation>Set the input to the representation.</Documentation>
</InputProperty>
......
......@@ -4,6 +4,18 @@ Major API Changes {#MajorAPIChanges}
This page documents major API/design changes between different versions since we
started tracking these (starting after version 4.2).
Changes in 5.0.1
----------------
###Changes to vtkSMInputArrayDomain###
vtkSMInputArrayDomain has changed the meaning of **"any"** attribute type. It
now includes field data arrays. To exclude field data arrays from the field
selection, change this to **"any-except-field"**. This is also the default for
vtkSMInputArrayDomain, hence simply removing the `attribute_type` field is also
an acceptable solution and is the recommended approach so that the XML can work
without changes in earlier versions of ParaView as well.
Changes in 5.0
--------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment