Fixed bug that didn't clean up the Body when deleting an object from it

This commit is contained in:
jrheinlaender 2013-08-23 14:03:07 +02:00 committed by Stefan Tröger
parent f9b0e5908a
commit c21f21666f
2 changed files with 21 additions and 0 deletions

View File

@ -108,3 +108,22 @@ void ViewProvider::updateData(const App::Property* prop)
}
inherited::updateData(prop);
}
bool ViewProvider::onDelete(const std::vector<std::string> &)
{
// Body feature housekeeping
Part::BodyBase* body = Part::BodyBase::findBodyOf(getObject());
if (body != NULL) {
body->removeFeature(getObject());
// Make the new Tip and the previous solid feature visible again
App::DocumentObject* tip = body->Tip.getValue();
App::DocumentObject* prev = body->getPrevSolidFeature();
if (tip != NULL) {
Gui::Application::Instance->getViewProvider(tip)->show();
if ((tip != prev) && (prev != NULL))
Gui::Application::Instance->getViewProvider(prev)->show();
}
}
return true;
}

View File

@ -45,6 +45,8 @@ public:
protected:
virtual void unsetEdit(int ModNum);
virtual bool onDelete(const std::vector<std::string> &);
std::string oldWb;
App::DocumentObject* oldTip;
};