Gui: Add SoPickStyle node to make an object un-selectable if needed
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <Inventor/nodes/SoDrawStyle.h>
|
||||
#include <Inventor/nodes/SoFont.h>
|
||||
#include <Inventor/nodes/SoMaterial.h>
|
||||
#include <Inventor/nodes/SoPickStyle.h>
|
||||
#include <Inventor/nodes/SoResetTransform.h>
|
||||
#include <Inventor/nodes/SoSeparator.h>
|
||||
#include <Inventor/nodes/SoSwitch.h>
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user