From dd120ef5075353580090dd385c235b4c74433745 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 7 Nov 2019 17:13:20 +0100 Subject: [PATCH] add convenience method to 3d viewer to disable selection --- src/Gui/View3DInventorViewer.cpp | 12 ++++++++++++ src/Gui/View3DInventorViewer.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 6fa5a40777a0..5b0a3aaaa304 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1669,6 +1669,18 @@ const std::vector& View3DInventorViewer::getPolygon(SelectionRole* role return navigation->getPolygon(role); } +void View3DInventorViewer::setSelectionEnabled(const SbBool enable) +{ + SoNode* root = getSceneGraph(); + static_cast(root)->selectionRole.setValue(enable); +} + +SbBool View3DInventorViewer::isSelectionEnabled(void) const +{ + SoNode* root = getSceneGraph(); + return static_cast(root)->selectionRole.getValue(); +} + SbVec2f View3DInventorViewer::screenCoordsOfPath(SoPath* path) const { // Generate a matrix (well, a SoGetMatrixAction) that diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index 07b67448ccc1..9e132a84b327 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -236,6 +236,8 @@ class GuiExport View3DInventorViewer : public Quarter::SoQTQuarterAdaptor, publi std::vector getGLPolygon(SelectionRole* role=0) const; std::vector getGLPolygon(const std::vector&) const; const std::vector& getPolygon(SelectionRole* role=0) const; + void setSelectionEnabled(const SbBool enable); + SbBool isSelectionEnabled(void) const; //@} /// Returns the screen coordinates of the origin of the path's tail object