Moved some methods from PartDesign::Body to Part::BodyBase so the SketchObjects will be removed cleanly from the Body when deleted
This commit is contained in:
committed by
Stefan Tröger
parent
5b3d5e6bd8
commit
02dfb8551d
@@ -83,6 +83,7 @@
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
|
||||
@@ -90,6 +91,7 @@
|
||||
#include "ViewProvider.h"
|
||||
#include "SoFCShapeObject.h"
|
||||
|
||||
#include <Mod/Part/App/BodyBase.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Part/App/PrimitiveFeature.h>
|
||||
|
||||
@@ -123,6 +125,29 @@ bool ViewProviderPart::doubleClicked(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderPart::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();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Ask user what to do about dependent objects, e.g. Sketches that have this feature as their support
|
||||
// 1. Delete
|
||||
// 2. Suppress
|
||||
// 3. Re-route
|
||||
return true;
|
||||
}
|
||||
|
||||
void ViewProviderPart::applyColor(const Part::ShapeHistory& hist,
|
||||
const std::vector<App::Color>& colBase,
|
||||
std::vector<App::Color>& colBool)
|
||||
|
||||
Reference in New Issue
Block a user