+ fixes #0001669: Part operation with parts in groups splits again when moved back into group

This commit is contained in:
wmayer
2015-01-07 11:02:52 +01:00
parent 55f04de4fb
commit 36e0ec9618
2 changed files with 93 additions and 20 deletions

View File

@@ -37,6 +37,7 @@
#include <App/Application.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <App/DocumentObjectGroup.h>
#include <Gui/Application.h>
#include <Gui/BitmapFactory.h>
#include <Gui/Command.h>
@@ -454,6 +455,29 @@ void DlgBooleanOperation::accept()
"Gui.activeDocument().hide(\"%s\")",shapeOne.c_str());
Gui::Command::doCommand(Gui::Command::Gui,
"Gui.activeDocument().hide(\"%s\")",shapeTwo.c_str());
// add/remove fromgroup if needed
App::DocumentObjectGroup* targetGroup = 0;
App::DocumentObjectGroup* group1 = obj1->getGroup();
if (group1) {
targetGroup = group1;
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.removeObject(App.activeDocument().%s)",
group1->getNameInDocument(), obj1->getNameInDocument());
}
App::DocumentObjectGroup* group2 = obj2->getGroup();
if (group2) {
targetGroup = group2;
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.removeObject(App.activeDocument().%s)",
group2->getNameInDocument(), obj2->getNameInDocument());
}
if (targetGroup) {
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.addObject(App.activeDocument().%s)",
targetGroup->getNameInDocument(), objName.c_str());
}
Gui::Command::copyVisual(objName.c_str(), "ShapeColor", shapeOne.c_str());
Gui::Command::copyVisual(objName.c_str(), "DisplayMode", shapeOne.c_str());
activeDoc->commitTransaction();