Use View3DInventorViewer::setSelectionEnabled instead of SoFCUnifiedSelection::selectionRole

This commit is contained in:
wmayer
2023-05-02 15:44:03 +02:00
committed by wwmayer
parent d668f12ffb
commit b0c9871722
8 changed files with 22 additions and 40 deletions

View File

@@ -40,7 +40,6 @@
#include <Gui/MainWindow.h>
#include <Gui/Selection.h>
#include <Gui/SelectionFilter.h>
#include <Gui/SoFCUnifiedSelection.h>
#include <Gui/Utilities.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
@@ -96,8 +95,7 @@ void BoxSelection::selectionCallback(void * ud, SoEventCallback * cb)
{
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback, ud);
SoNode* root = view->getSceneGraph();
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(true);
view->setSelectionEnabled(true);
std::vector<SbVec2f> picked = view->getGLPolygon();
SoCamera* cam = view->getSoRenderManager()->getCamera();
@@ -204,8 +202,7 @@ void BoxSelection::start(TopAbs_ShapeEnum shape)
viewer->addEventCallback(SoMouseButtonEvent::getClassTypeId(), selectionCallback, this);
// avoid that the selection node handles the event otherwise the callback function won't be
// called immediately
SoNode* root = viewer->getSceneGraph();
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(false);
viewer->setSelectionEnabled(false);
shapeEnum = shape;
}
}