diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index b7d7a0288..666b686a4 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -461,9 +461,6 @@ void CmdPartDesignMoveTip::activated(int iMsg) } openCommand("Move tip to selected feature"); - if (oldTip) { - doCommand(Gui, "Gui.activeDocument().hide(\"%s\")", oldTip->getNameInDocument() ); - } if (selFeature == body) { doCommand(Doc,"App.activeDocument().%s.Tip = None", body->getNameInDocument()); diff --git a/src/Mod/PartDesign/Gui/ViewProvider.cpp b/src/Mod/PartDesign/Gui/ViewProvider.cpp index ba26242bf..b2d1f7f20 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.cpp +++ b/src/Mod/PartDesign/Gui/ViewProvider.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -168,6 +169,34 @@ void ViewProvider::updateData(const App::Property* prop) inherited::updateData(prop); } +void ViewProvider::onChanged(const App::Property* prop) { + + //if the object is inside of a body we make sure it is the only visible one on activation + if(prop == &Visibility && Visibility.getValue()) { + + Part::BodyBase* body = Part::BodyBase::findBodyOf(getObject()); + if(body) { + + //hide all features in the body other than this object + for(App::DocumentObject* obj : body->Model.getValues()) { + + if(obj->isDerivedFrom(PartDesign::Feature::getClassTypeId()) && obj != getObject()) { + Gui::ViewProvider* vp = Gui::Application::Instance->activeDocument()->getViewProvider(obj); + if(!vp) + return; + + Gui::ViewProviderDocumentObject* vpd = static_cast(vp); + if(vpd && vpd->Visibility.getValue()) + vpd->Visibility.setValue(false); + } + } + } + } + + PartGui::ViewProviderPartExt::onChanged(prop); +} + + bool ViewProvider::onDelete(const std::vector &) { PartDesign::Feature* feature = static_cast(getObject()); diff --git a/src/Mod/PartDesign/Gui/ViewProvider.h b/src/Mod/PartDesign/Gui/ViewProvider.h index 77c2fa332..793e9753b 100644 --- a/src/Mod/PartDesign/Gui/ViewProvider.h +++ b/src/Mod/PartDesign/Gui/ViewProvider.h @@ -46,6 +46,7 @@ public: virtual bool doubleClicked(void); void updateData(const App::Property*); + void onChanged(const App::Property* prop); protected: virtual bool setEdit(int ModNum);