Commit 9457eecb authored by Cory Quammen's avatar Cory Quammen Committed by Kitware Robot

Merge topic '12257-resample-inputs-names'

fb62543f paraview.simple: make SetProperties() use backwards compatibility helper
dda0d239 ResampleWithDataset: Update tests for input properties name change
ea92d317 ReampleWithDataset: Added backwards compatibility in Python
8fa1b3f1 ResampleWithDataset: renamed input proxies
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !2931
parents df1c6125 fb62543f
Pipeline #126744 failed with stage
in 0 seconds
......@@ -18,7 +18,7 @@
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,95,12,/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,95,12,/0:0/0:0" />
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ResampleWithDataset" />
<pqevent object="pqClientMainWindow/SelectInputDialog/buttonFrame/Source" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/SelectInputDialog/buttonFrame/DestinationMesh" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/SelectInputDialog/pipelineView" command="mousePress" arguments="1,1,0,36,6,/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/SelectInputDialog/pipelineView" command="mouseRelease" arguments="1,0,0,36,6,/0:0/0:0/0:0" />
<pqevent object="pqClientMainWindow/SelectInputDialog/buttonBox/1QPushButton0" command="activate" arguments="" />
......
......@@ -29,7 +29,7 @@
<pqevent object="pqClientMainWindow/menubar/menuFilters/Alphabetical" command="activate" arguments="ResampleWithDataset" />
<pqevent object="pqClientMainWindow/SelectInputDialog/pipelineView" command="mousePress" arguments="1,1,0,86,13,/0:0/1:0" />
<pqevent object="pqClientMainWindow/SelectInputDialog/pipelineView" command="mouseRelease" arguments="1,0,0,86,13,/0:0/1:0" />
<pqevent object="pqClientMainWindow/SelectInputDialog/buttonFrame/Source" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/SelectInputDialog/buttonFrame/DestinationMesh" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/SelectInputDialog/pipelineView" command="mousePress" arguments="1,1,0,54,11,/0:0/0:0" />
<pqevent object="pqClientMainWindow/SelectInputDialog/pipelineView" command="mouseRelease" arguments="1,0,0,54,11,/0:0/0:0" />
<pqevent object="pqClientMainWindow/SelectInputDialog/buttonBox/1QPushButton0" command="activate" arguments="" />
......
# Renamed sources for **Resample With Dataset**
The source names have been clarified in the **Resample With Dataset** filter.
**Input** has been renamed **SourceDataArrays** and **Source** has been renamed
**DestinationMesh**.
......@@ -624,6 +624,32 @@ struct Process_5_5_to_5_6
}
};
//===========================================================================
struct Process_5_6_to_5_7
{
bool operator()(xml_document& document) { return ConvertResampleWithDataset(document); }
static bool ConvertResampleWithDataset(xml_document& document)
{
// Change InputProperty names for the inputs to be a bit clearer.
pugi::xpath_node_set elements = document.select_nodes(
"//ServerManagerState/Proxy[@group='filters' and @type='ResampleWithDataset']");
for (auto iter = elements.begin(); iter != elements.end(); ++iter)
{
pugi::xml_node proxy_node = iter->node();
// Rename the Input property and change the name attribute.
pugi::xml_node input_node = proxy_node.find_child_by_attribute("Property", "name", "Input");
input_node.attribute("name").set_value("SourceDataArrays");
// Rename the Source property and change the name attribute.
pugi::xml_node source_node = proxy_node.find_child_by_attribute("Property", "name", "Source");
source_node.attribute("name").set_value("DestinationMesh");
}
return true;
}
};
} // end of namespace
vtkStandardNewMacro(vtkSMStateVersionController);
......@@ -714,6 +740,13 @@ bool vtkSMStateVersionController::Process(vtkPVXMLElement* parent, vtkSMSession*
version = vtkSMVersion(5, 6, 0);
}
if (status && (version < vtkSMVersion(5, 7, 0)))
{
Process_5_6_to_5_7 converter;
status = converter(document);
version = vtkSMVersion(5, 7, 0);
}
if (status)
{
std::ostringstream stream2;
......
......@@ -5,7 +5,7 @@ sourceDs = Wavelet()
inputDs = Sphere()
# Test 'Resample With Dataset` proxies
p1 = ResampleWithDataset(Input=inputDs, Source=sourceDs)
p1 = ResampleWithDataset(SourceDataArrays=inputDs, DestinationMesh=sourceDs)
print("Proxy Name before: %s" % p1.GetXMLName())
assert p1.GetXMLName() == "ResampleWithDataset", "The default proxy name must be ResampleWithDataset"
......
......@@ -16074,12 +16074,13 @@ Every Nth Point.
label="Resample With Dataset"
name="ResampleWithDataset">
<Documentation short_help="Sample data attributes at the points of a dataset.">
This filter takes two inputs - Input and Source, and samples the
point and cell values of Input on to the point locations of Source.
The output has the same structure as Source but its point data
have the resampled values from Input."
This filter takes two inputs - **Source Data Arrays**, and samples the
point and cell values of this input onto the point locations of the
**Destination Geometry** input. The output has the same structure as the
**Destination Geometry** input, but its point data has the resampled values from
the **Source Data Arrays**."
</Documentation>
<InputProperty command="SetSourceConnection" name="Input">
<InputProperty command="SetSourceConnection" name="SourceDataArrays">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
......@@ -16091,7 +16092,7 @@ Every Nth Point.
<Documentation>This property specifies the dataset from which to obtain
probe values. The data attributes come from this dataset.</Documentation>
</InputProperty>
<InputProperty command="SetInputConnection" name="Source">
<InputProperty command="SetInputConnection" name="DestinationMesh">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
......
......@@ -256,6 +256,25 @@ def setattr(proxy, pname, value):
raise NotSupportedException(
"'%s' is obsolete on SpreadSheetRepresentation as of ParaView 5.6 and has been migrated to the view." % pname)
# In 5.7, we changed to the names of the input proxies in ResampleWithDataset to clarify what
# each source does.
if pname == "Input" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset":
if paraview.compatibility.GetVersion() < 5.7:
proxy.GetProperty("SourceDataArrays").SetData(value)
raise Continue()
else:
raise NotSupportedException(
'The ResampleWithDataset.Input property has been changed in ParaView 5.7. '\
'Please set the SourceDataArrays property instead.')
if pname == "Source" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset":
if paraview.compatibility.GetVersion() < 5.7:
proxy.GetProperty("DestinationMesh").SetData(value)
raise Continue()
else:
raise NotSupportedException(
'The ResampleWithDataset.Source property has been changed in ParaView 5.7. '\
'Please set the DestinationMesh property instead.')
if not hasattr(proxy, pname):
raise AttributeError()
......@@ -460,7 +479,7 @@ def getattr(proxy, pname):
# In 5.5, we changed the Clip to be inverted from what it was before and changed the InsideOut
# property to be called Invert to be clearer.
if pname == "InsideOut" and proxy.SMProxy.GetName() == "Clip":
if pname == "InsideOut" and proxy.SMProxy.GetXMLName() == "Clip":
if paraview.compatibility.GetVersion() <= 5.4:
return proxy.GetProperty("Invert").GetData()
else:
......@@ -477,6 +496,25 @@ def getattr(proxy, pname):
else:
raise NotSupportedException(
"'%s' is obsolete on SpreadSheetRepresentation as of ParaView 5.6 and has been migrated to the view." % pname)
# In 5.7, we changed to the names of the input proxies in ResampleWithDataset to clarify what
# each source does.
if pname == "Input" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset":
if paraview.compatibility.GetVersion() < 5.7:
return proxy.GetProperty("SourceDataArrays")
else:
raise NotSupportedException(
'The ResampleWithDataset.Input property has been changed in ParaView 5.7. '\
'Please access the SourceDataArrays property instead.')
if pname == "Source" and proxy.SMProxy.GetXMLName() == "ResampleWithDataset":
if paraview.compatibility.GetVersion() < 5.7:
return proxy.GetProperty("DestinationMesh")
else:
raise NotSupportedException(
'The ResampleWithDataset.Source property has been changed in ParaView 5.7. '\
'Please access the DestinationMesh property instead.')
raise Continue()
def GetProxy(module, key):
......
......@@ -2990,7 +2990,7 @@ def demo3():
# with a line
line = sources.LineSource(Resolution=60)
else:
probe = filters.ResampleWithDataset(Input=source)
probe = filters.ResampleWithDataset(SourceDataArrays=source)
# with a line
line = sources.Line(Resolution=60)
# that spans the dataset
......
......@@ -604,9 +604,8 @@ def SetProperties(proxy=None, **params):
proxy = active_objects.source
properties = proxy.ListProperties()
for param in params.keys():
if param not in properties:
raise AttributeError("object has no property %s" % param)
proxy.SetPropertyWithName(param, params[param])
pyproxy = servermanager._getPyProxy(proxy)
pyproxy.__setattr__(param, params[param])
# -----------------------------------------------------------------------------
......
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