Ensure only a single PartDesign feature is visible
This commit is contained in:
parent
24bdc173f7
commit
4164f8fc4c
|
@ -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());
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <Gui/MDIView.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include <Mod/PartDesign/App/Feature.h>
|
||||
|
@ -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<ViewProviderDocumentObject*>(vp);
|
||||
if(vpd && vpd->Visibility.getValue())
|
||||
vpd->Visibility.setValue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PartGui::ViewProviderPartExt::onChanged(prop);
|
||||
}
|
||||
|
||||
|
||||
bool ViewProvider::onDelete(const std::vector<std::string> &)
|
||||
{
|
||||
PartDesign::Feature* feature = static_cast<PartDesign::Feature*>(getObject());
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user