Commit 52a8d26e authored by Joachim Pouderoux's avatar Joachim Pouderoux

Fix Separate Color Map feature for Opacity transfer function

parent 5654b5bb
......@@ -414,6 +414,7 @@ list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/SelectionLinkReaction.xml
${CMAKE_CURRENT_SOURCE_DIR}/SelectionLinkReactionNonConverted.xml
${CMAKE_CURRENT_SOURCE_DIR}/SeparatedColorMap.xml
${CMAKE_CURRENT_SOURCE_DIR}/SeparatedColorMapOpacity.xml
${CMAKE_CURRENT_SOURCE_DIR}/SliceWithPlane.xml
${CMAKE_CURRENT_SOURCE_DIR}/SliceWithPlaneMultiBlock.xml
${CMAKE_CURRENT_SOURCE_DIR}/SortLineChartData.xml
......@@ -713,6 +714,7 @@ set (CategoricalOpacities_FORCE_SERIAL TRUE) # Seems to works better in serial
set (LoadSaveStateVolume_FORCE_SERIAL TRUE)
# We don't support volume rendering of image data in data server & render server mode
set(LoadSaveStateVolume_DISABLE_CRS TRUE)
set(SeparatedColorMapOpacity_DISABLE_CRS TRUE)
# Set properties for CTH tests
set(CTHAMRContour_DISABLE_CS TRUE)
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/menubar/menuSources" command="activate" arguments="RTAnalyticSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="activated" arguments="Volume" />
<pqevent object="pqClientMainWindow/menubar/menuSources" command="activate" arguments="RTAnalyticSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/SearchBox/AdvancedButton" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Position/LineEdit0" command="set_string" arguments="20" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/DisplayFrame/ProxyPanel/Position/LineEdit0" command="key" arguments="16777221" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionResetCamera" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="activated" arguments="Volume" />
<pqevent object="pqClientMainWindow/variableToolbar/actionEditColorMap" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/axesToolbar/actionShowOrientationAxes" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mousePress" arguments="(0.342697,0.625,1,1,0)" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mouseMove" arguments="(0.289326,0.483333,1,0,0)" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mouseRelease" arguments="(0.289326,0.483333,1,0,0)" />
<pqevent object="pqClientMainWindow/variableToolbar/actionUseSeparateColorMap" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mousePress" arguments="(0.342697,0.675,1,1,0)" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mouseMove" arguments="(-0.00280899,-0.0416667,1,0,0)" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mouseRelease" arguments="(-0.00280899,-0.0416667,1,0,0)" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,72,7,/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseMove" arguments="1,0,0,72,8,/0:0/0:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,72,8,/0:0/0:0" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mousePress" arguments="(0.294944,0.483333,1,1,0)" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mouseMove" arguments="(0.657303,0.9,1,0,0)" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/colorMapEditorPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/Properties/ColorOpacityEditor/OpacityEditor/1QVTKWidget0" command="mouseRelease" arguments="(0.657303,0.9,1,0,0)" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,70,7,/0:0/1:0" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,70,7,/0:0/1:0" />
<pqevent object="pqClientMainWindow/variableToolbar/actionScalarBarVisibility" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/colorMapEditorDock/qt_dockwidget_closebutton" command="activate" arguments="" />
</pqevents>
......@@ -510,26 +510,13 @@ bool vtkSMPVRepresentationProxy::SetScalarColoringInternal(
// Now, setup transfer functions.
bool haveComponent = useComponent;
bool separate = false;
bool separate = (vtkSMPropertyHelper(this, "UseSeparateColorMap", true).GetAsInt() != 0);
std::string decoratedArrayName = this->GetDecoratedArrayName(arrayname);
vtkNew<vtkSMTransferFunctionManager> mgr;
if (vtkSMProperty* lutProperty = this->GetProperty("LookupTable"))
{
std::string name;
if (vtkSMPropertyHelper(this, "UseSeparateColorMap", true).GetAsInt())
{
// Use global id for separate color map
std::ostringstream ss;
ss << "Separate_" << this->GetGlobalIDAsString() << "_" << arrayname;
name = ss.str();
separate = true;
}
else
{
name = arrayname;
}
vtkSMProxy* lutProxy =
mgr->GetColorTransferFunction(name.c_str(), this->GetSessionProxyManager());
mgr->GetColorTransferFunction(decoratedArrayName.c_str(), this->GetSessionProxyManager());
if (useComponent)
{
if (component >= 0)
......@@ -603,7 +590,7 @@ bool vtkSMPVRepresentationProxy::SetScalarColoringInternal(
if (vtkSMProperty* sofProperty = this->GetProperty("ScalarOpacityFunction"))
{
vtkSMProxy* sofProxy =
mgr->GetOpacityTransferFunction(arrayname, this->GetSessionProxyManager());
mgr->GetOpacityTransferFunction(decoratedArrayName.c_str(), this->GetSessionProxyManager());
vtkSMPropertyHelper(sofProperty).Set(sofProxy);
}
......@@ -611,6 +598,19 @@ bool vtkSMPVRepresentationProxy::SetScalarColoringInternal(
return true;
}
//----------------------------------------------------------------------------
std::string vtkSMPVRepresentationProxy::GetDecoratedArrayName(const std::string& arrayname)
{
if (vtkSMPropertyHelper(this, "UseSeparateColorMap", true).GetAsInt())
{
// Use global id for separate color map
std::ostringstream ss;
ss << "Separate_" << this->GetGlobalIDAsString() << "_" << arrayname;
return ss.str();
}
return arrayname;
}
//----------------------------------------------------------------------------
bool vtkSMPVRepresentationProxy::SetScalarBarVisibility(vtkSMProxy* view, bool visible)
{
......
......@@ -359,6 +359,12 @@ protected:
*/
int ReadXMLAttributes(vtkSMSessionProxyManager* pm, vtkPVXMLElement* element) VTK_OVERRIDE;
/**
* In case of UseSeparateColorMap enabled, this function prefix the given
* arrayname with unique identifier, otherwise it acts as a passthrough.
*/
std::string GetDecoratedArrayName(const std::string& arrayname);
/**
* Internal method to set scalar coloring, do not use directly.
*/
......
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