From 6111f55a89f46b2ee9876bf580b8da441dcbc5fc Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 28 Nov 2015 16:21:20 +0100 Subject: [PATCH] + correctly handle toggle selection in BRep shape nodes --- src/Gui/View3DInventorViewer.cpp | 8 ++++---- src/Mod/Part/Gui/SoBrepEdgeSet.cpp | 3 ++- src/Mod/Part/Gui/SoBrepFaceSet.cpp | 3 ++- src/Mod/Part/Gui/SoBrepPointSet.cpp | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index d31d08d4c..952ec0b23 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -582,10 +582,10 @@ void View3DInventorViewer::initialize() void View3DInventorViewer::OnChange(Gui::SelectionSingleton::SubjectType& rCaller, Gui::SelectionSingleton::MessageType Reason) { - if(Reason.Type == SelectionChanges::AddSelection || - Reason.Type == SelectionChanges::RmvSelection || - Reason.Type == SelectionChanges::SetSelection || - Reason.Type == SelectionChanges::ClrSelection) { + if (Reason.Type == SelectionChanges::AddSelection || + Reason.Type == SelectionChanges::RmvSelection || + Reason.Type == SelectionChanges::SetSelection || + Reason.Type == SelectionChanges::ClrSelection) { SoFCSelectionAction cAct(Reason); cAct.apply(pcViewProviderRoot); } diff --git a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp index 29ee265bb..b47d1e573 100644 --- a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp +++ b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp @@ -321,7 +321,8 @@ void SoBrepEdgeSet::doAction(SoAction* action) case Gui::SoSelectionElementAction::Remove: { int start = this->selectionIndex.find(index); - this->selectionIndex.deleteValues(start,1); + if (start >= 0) + this->selectionIndex.deleteValues(start,1); } break; default: diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index 1d2cc06e7..57c792865 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -144,7 +144,8 @@ void SoBrepFaceSet::doAction(SoAction* action) case Gui::SoSelectionElementAction::Remove: { int start = this->selectionIndex.find(index); - this->selectionIndex.deleteValues(start,1); + if (start >= 0) + this->selectionIndex.deleteValues(start,1); } break; default: diff --git a/src/Mod/Part/Gui/SoBrepPointSet.cpp b/src/Mod/Part/Gui/SoBrepPointSet.cpp index 3b43d3dec..2f0d0eda7 100644 --- a/src/Mod/Part/Gui/SoBrepPointSet.cpp +++ b/src/Mod/Part/Gui/SoBrepPointSet.cpp @@ -256,7 +256,8 @@ void SoBrepPointSet::doAction(SoAction* action) case Gui::SoSelectionElementAction::Remove: { int start = this->selectionIndex.find(index); - this->selectionIndex.deleteValues(start,1); + if (start >= 0) + this->selectionIndex.deleteValues(start,1); } break; default: