Commit e841670c authored by Haocheng LIU's avatar Haocheng LIU

BUG: Fix the logic to change vtkmultiblock visibility and color

We should change the vtkSMIntVectorProperty directly rather than use
the pqMultiBlockInspectorPanel.
parent 36a267b3
......@@ -28,4 +28,5 @@
<pqevent object="qtCMBMainWindow/operatorsDockWidget/scrollArea/qt_scrollarea_viewport/modelOperationWidget/1QSplitter0/1QWidget0/1QFrame0/topLevelScrollArea/qt_scrollarea_viewport/1QFrame0/AssignColorsParameters/ChoosePaletteBtn" command="activate" arguments="" />
<pqevent object="pqPresetDialog/gradients" command="setCurrent" arguments="14.0" />
<pqevent object="pqPresetDialog/apply" command="activate" arguments="" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -9,4 +9,5 @@
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="setCurrent" arguments="0.0.0.0.0.0.0.0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="setCurrent" arguments="0.0.0.0.0.0.1.0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="toggleVisibility" arguments="/0:0/0:0/0:0/1:0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -19,4 +19,5 @@
<pqevent object="qtCMBMainWindow/Viewport" command="mouseMove" arguments="(0.221557,0.54827,1,0,0)" />
<pqevent object="qtCMBMainWindow/Viewport" command="mouseRelease" arguments="(0.221557,0.54827,1,0,0)" />
<pqevent object="qtCMBMainWindow/operatorsDockWidget/scrollArea/qt_scrollarea_viewport/modelOperationWidget/1QSplitter0/1QWidget0/1QFrame0/topLevelScrollArea/qt_scrollarea_viewport/OpViewFrame/OpViewApplyButton" command="activate" arguments="" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -11,4 +11,5 @@
<pqevent object="qtCMBMainWindow/Viewport" command="mouseMove" arguments="(0.580925,0.393983,2,0,0)" />
<pqevent object="qtCMBMainWindow/Viewport" command="mouseRelease" arguments="(0.580925,0.393983,2,0,0)" />
<pqevent object="PipelineContextMenu" command="activate" arguments="Hide Selected" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -11,4 +11,5 @@
<pqevent object="qtCMBMainWindow/Viewport" command="mouseMove" arguments="(0.580925,0.393983,2,0,0)" />
<pqevent object="qtCMBMainWindow/Viewport" command="mouseRelease" arguments="(0.580925,0.393983,2,0,0)" />
<pqevent object="PipelineContextMenu" command="activate" arguments="Hide Others" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -12,4 +12,5 @@
<pqevent object="qtCMBMainWindow/Viewport" command="mouseRelease" arguments="(0.580925,0.393983,2,0,0)" />
<pqevent object="PipelineContextMenu" command="activate" arguments="Hide Selected" />
<pqevent object="PipelineContextMenu" command="activate" arguments="Show All Models" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -2,7 +2,6 @@
<pqevents>
<pqevent object="qtCMBMainWindow/menubar" command="activate" arguments="menu_Tools" />
<pqevent object="qtCMBMainWindow/menubar/menu_Tools" command="activate" arguments="actionLock_View_Size" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0/qt_scrollarea_vcontainer/0QScrollBar0" command="mouseWheel" arguments="2,0,0,23,377" />
<pqevent object="qtCMBMainWindow/menubar" command="activate" arguments="menu_File" />
<pqevent object="qtCMBMainWindow/menubar/menu_File" command="activate" arguments="action_Open_File" />
<pqevent object="qtCMBMainWindow/FileOpenDialog" command="filesSelected" arguments="$PARAVIEW_DATA_ROOT/mesh/2d/test2D.2dm" />
......@@ -32,4 +31,5 @@
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="setCurrent" arguments="0.0.0.0.3.0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="toggleVisibility" arguments="/0:0/0:0/3:0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="toggleVisibility" arguments="/0:0/0:0/3:0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -25,4 +25,5 @@
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="setCurrent" arguments="0.0.0.0.3.0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="toggleVisibility" arguments="/0:0/0:0/3:0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/1smtk::extension::qtModelView0" command="toggleVisibility" arguments="/0:0/0:0/3:0" />
<pqevent object="qtCMBMainWindow/smtkModelDockWidget/qtModelPanel/ClearSelection" command="activate" arguments="" />
</pqevents>
......@@ -1091,8 +1091,8 @@ void pqCMBModelBuilderMainWindowCore::onServerCreationFinished(pqServer* server)
SLOT(onNewModelsCreationFinished()));
QObject::connect(this->Internal->ViewContextBehavior,
SIGNAL(representationBlockPicked(pqDataRepresentation*, unsigned int, bool)), this,
SLOT(selectRepresentationBlock(pqDataRepresentation*, unsigned int, bool)));
SIGNAL(representationBlockPicked(pqDataRepresentation*, vtkIdType, bool)), this,
SLOT(selectRepresentationBlock(pqDataRepresentation*, vtkIdType, bool)));
// We need to block this so that the display and info panel only
// works on the model geometry, not scene, or anyting else
......@@ -1636,7 +1636,7 @@ void pqCMBModelBuilderMainWindowCore::buildRenderWindowContextMenuBehavior(QObje
}
void pqCMBModelBuilderMainWindowCore::selectRepresentationBlock(
pqDataRepresentation* repr, unsigned int blockIndex, bool ctrlKey)
pqDataRepresentation* repr, vtkIdType blockIndex, bool ctrlKey)
{
if (!repr)
return;
......
......@@ -175,7 +175,7 @@ public slots:
bool processOperatorResult(const smtk::model::OperatorResult& result,
const smtk::model::SessionRef& sref, bool hasNewModels, bool bModelGeometryChanged,
bool hasNewMeshes);
void selectRepresentationBlock(pqDataRepresentation*, unsigned int, bool ctrlKey);
void selectRepresentationBlock(pqDataRepresentation*, vtkIdType, bool ctrlKey);
void changeMeshRepresentationPickability(bool status);
// Called to show the settings dialog.
......
......@@ -90,10 +90,11 @@ void pqModelBuilderViewContextMenuBehavior::syncBlockVisibility(
rep->setVisible(visible);
}
foreach (vtkIdType block, visBlocks)
foreach (vtkIdType blockId, visBlocks)
{
visProp->SetElement(block, visible);
vtkSMPropertyHelper(visProp).SetStatus(blockId, visible);
}
rep->getProxy()->UpdateVTKObjects();
if (!visible)
{
......
......@@ -203,10 +203,11 @@ bool pqSMTKModelPanel::changeSelEntitiesBlockVisibility(bool status)
{
vtkSMIntVectorProperty* visProp =
vtkSMIntVectorProperty::SafeDownCast(rep->getProxy()->GetProperty("BlockVisibility"));
foreach (vtkIdType block, this->Internal->invisibleBlockIdsOfSelectionEntities)
foreach (vtkIdType blockId, this->Internal->invisibleBlockIdsOfSelectionEntities)
{
visProp->SetElement(block, status);
vtkSMPropertyHelper(visProp).SetStatus(static_cast<int>(blockId), static_cast<int>(status));
}
rep->getProxy()->UpdateVTKObjects();
return true;
}
return false;
......@@ -392,9 +393,10 @@ void pqSMTKModelPanel::selectEntityRepresentations(const smtk::model::EntityRefs
vtkSMIntVectorProperty::SafeDownCast(selRep->GetProperty("BlockVisibility"));
foreach (vtkIdType blockId, blockIds)
{
visProp->SetElement(blockId, false);
vtkSMPropertyHelper(visProp).SetStatus(static_cast<int>(blockId), 0);
blockIdsTobeInvisible.append(blockId);
}
selRep->UpdateVTKObjects();
}
selmodelblocks[minfo].insert(blockIds.begin(), blockIds.end());
......@@ -422,7 +424,7 @@ void pqSMTKModelPanel::selectEntityRepresentations(const smtk::model::EntityRefs
{
pqSMTKModelInfo* minfo = this->Internal->smtkManager->modelInfo(entity);
QSet<unsigned int> blockIds;
QSet<vtkIdType> blockIds;
// for cell entity it would just store blockId which is an intergerProperty
pqCMBContextMenuHelper::accumulateChildGeometricEntities(blockIds, entity);
......@@ -432,7 +434,11 @@ void pqSMTKModelPanel::selectEntityRepresentations(const smtk::model::EntityRefs
vtkSMIntVectorProperty* visProp =
vtkSMIntVectorProperty::SafeDownCast(selRep->GetProperty("BlockVisibility"));
// turn on previoulsySelected entities visibility
visProp->SetElement(blockId, true);
foreach (vtkIdType blockId, blockIds)
{
vtkSMPropertyHelper(visProp).SetStatus(static_cast<int>(blockId), 1);
}
selRep->UpdateVTKObjects();
}
}
}
......
......@@ -40,9 +40,10 @@ add_paraview_plugin(ModelBridge_Plugin "1.0"
)
target_link_libraries(ModelBridge_Plugin
LINK_PUBLIC
vtkSMTKSourceExt
LINK_PRIVATE
smtkCore
vtkSMTKSourceExt
vtkSMTKSourceExtCS
vtkSMTKOperatorsExt
)
......
......@@ -17,6 +17,7 @@
#include "vtkDataSet.h"
#include "vtkObjectFactory.h"
#include "smtk/extension/vtk/source/vtkModelMultiBlockSource.h"
#include "vtkPVSMTKModelSource.h"
vtkStandardNewMacro(vtkPVSMTKModelInformation);
......
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