diff --git a/src/Gui/ViewProviderGeometryObject.cpp b/src/Gui/ViewProviderGeometryObject.cpp index be8672106d..a27478ed23 100644 --- a/src/Gui/ViewProviderGeometryObject.cpp +++ b/src/Gui/ViewProviderGeometryObject.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,10 @@ ViewProviderGeometryObject::ViewProviderGeometryObject() App::Prop_None, "Set if the object is selectable in the 3d view"); + pickStyle = new SoPickStyle(); + pickStyle->ref(); + pickStyle->style.setValue(SoPickStyle::SHAPE); + pcRoot->insertChild(pickStyle, 1); Selectable.setValue(isSelectionEnabled()); pcShapeMaterial = new SoMaterial; @@ -111,6 +116,7 @@ ViewProviderGeometryObject::~ViewProviderGeometryObject() pcShapeMaterial->unref(); pcBoundingBox->unref(); pcBoundColor->unref(); + pickStyle->unref(); } bool ViewProviderGeometryObject::isSelectionEnabled() const @@ -348,6 +354,8 @@ void ViewProviderGeometryObject::setSelectable(bool selectable) } } } + + pickStyle->style.setValue(selectable ? SoPickStyle::SHAPE : SoPickStyle::UNPICKABLE); } PyObject* ViewProviderGeometryObject::getPyObject() diff --git a/src/Gui/ViewProviderGeometryObject.h b/src/Gui/ViewProviderGeometryObject.h index 3561b1178a..71a885684a 100644 --- a/src/Gui/ViewProviderGeometryObject.h +++ b/src/Gui/ViewProviderGeometryObject.h @@ -28,6 +28,7 @@ #include class SoPickedPointList; +class SoPickStyle; class SoSwitch; class SoSensor; class SbVec2s; @@ -116,6 +117,7 @@ protected: SoFCBoundingBox* pcBoundingBox {nullptr}; SoSwitch* pcBoundSwitch {nullptr}; SoBaseColor* pcBoundColor {nullptr}; + SoPickStyle* pickStyle {nullptr}; App::Material materialAppearance; };