diff --git a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp index 566b6f686..0ca1bf0e1 100644 --- a/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDatumParameters.cpp @@ -228,6 +228,8 @@ TaskDatumParameters::TaskDatumParameters(ViewProviderDatum *DatumView,QWidget *p autoNext = true; else autoNext = false; + + DatumView->setPickable(false); } QString getShTypeText(eRefType type) @@ -782,6 +784,8 @@ TaskDatumParameters::~TaskDatumParameters() } } + DatumView->setPickable(true); + delete ui; } diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp index 0d7d7d4fe..4c0e12e2e 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp @@ -85,7 +85,9 @@ ViewProviderDatum::ViewProviderDatum() { pShapeSep = new SoSeparator(); pShapeSep->ref(); - + pPickStyle = new SoPickStyle(); + pPickStyle->ref(); + // set default color for datums (golden yellow with 60% transparency) ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ( "User parameter:BaseApp/Preferences/Mod/PartDesign"); @@ -103,6 +105,7 @@ ViewProviderDatum::ViewProviderDatum() ViewProviderDatum::~ViewProviderDatum() { pShapeSep->unref(); + pPickStyle->unref(); } void ViewProviderDatum::attach(App::DocumentObject *obj) @@ -125,15 +128,16 @@ void ViewProviderDatum::attach(App::DocumentObject *obj) hints->vertexOrdering.setValue(SoShapeHints::COUNTERCLOCKWISE); SoDrawStyle* fstyle = new SoDrawStyle(); fstyle->style = SoDrawStyle::FILLED; - SoPickStyle* pickStyle = new SoPickStyle(); - pickStyle->style = SoPickStyle::SHAPE; + fstyle->lineWidth = 3; + fstyle->pointSize = 5; + pPickStyle->style = SoPickStyle::SHAPE; SoMaterialBinding* matBinding = new SoMaterialBinding; matBinding->value = SoMaterialBinding::OVERALL; SoSeparator* sep = new SoSeparator(); sep->addChild(hints); sep->addChild(fstyle); - sep->addChild(pickStyle); + sep->addChild(pPickStyle); sep->addChild(matBinding); sep->addChild(pcShapeMaterial); sep->addChild(pShapeSep); @@ -388,3 +392,16 @@ SbBox3f ViewProviderDatum::defaultBoundBox () { return SbBox3f ( -defaultSize, -defaultSize, -defaultSize, defaultSize, defaultSize, defaultSize ); } + +bool ViewProviderDatum::isPickable() { + + return bool(pPickStyle->style.getValue() == SoPickStyle::SHAPE); +} + +void ViewProviderDatum::setPickable(bool val) { + + if(val) + pPickStyle->style = SoPickStyle::SHAPE; + else + pPickStyle->style = SoPickStyle::UNPICKABLE; +} diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.h b/src/Mod/PartDesign/Gui/ViewProviderDatum.h index 863c25f61..c7e3744ba 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.h +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.h @@ -27,6 +27,7 @@ #include "Gui/ViewProviderGeometryObject.h" #include +class SoPickStyle; class SbBox3f; class SoGetBoundingBoxAction; @@ -59,6 +60,14 @@ public: virtual std::string getElement(const SoDetail *) const; virtual SoDetail* getDetail(const char*) const; + /** + * Enable/Disable the selectability of the datum + * This differs from the normal ViewProvider selectability in that, that with this enabled one + * can pick through the datum and select stuff behind it. + */ + bool isPickable(); + void setPickable(bool val); + /** * Update the visual size to match the given extents * @note should be reimplemented in the offspings @@ -116,6 +125,7 @@ protected: private: SoSeparator* pShapeSep; + SoPickStyle* pPickStyle; std::string oldWb; App::DocumentObject* oldTip;