From d01279c115b5a8d40034f5793ed4bf1b8c0f13f9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 15 Jul 2015 14:32:06 +0200 Subject: [PATCH] Added ungrouping --- cura/CuraApplication.py | 19 ++++++++++++++++++- resources/qml/Actions.qml | 9 +++++++++ resources/qml/Cura.qml | 6 ++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7c1034059b..f831a79b11 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -427,7 +427,24 @@ class CuraApplication(QtApplication): group_node.setParent(self.getController().getScene().getRoot()) for node in Selection.getAllSelectedObjects(): node.setParent(group_node) - + + @pyqtSlot() + def ungroupSelected(self): + ungrouped_nodes = [] + for node in Selection.getAllSelectedObjects(): + if node.callDecoration("isGroup" ): + children_to_move = [] + for child in node.getChildren(): + if child.getMeshData() is not None: + children_to_move.append(child) + + for child in children_to_move: + child.setParent(node.getParent()) + child.callDecoration("setConvexHull",None) + node.setParent(None) + ungrouped_nodes.append(node) + for node in ungrouped_nodes: + Selection.remove(node) ## Add an output device that can be written to. # diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index a98d94b62c..a223e00bb7 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -18,6 +18,8 @@ Item { property alias deleteObject: deleteObjectAction; property alias centerObject: centerObjectAction; property alias groupObjects: groupObjectsAction; + property alias unGroupObjects:unGroupObjectsAction; + property alias multiplyObject: multiplyObjectAction; property alias splitObject: splitObjectAction; @@ -130,6 +132,13 @@ Item { enabled: UM.Scene.numObjectsSelected > 1 ? true: false } + Action + { + id: unGroupObjectsAction + text: qsTr("Ungroup objects"); + enabled: UM.Scene.isGroupSelected + } + Action { id: multiplyObjectAction; //: Duplicate object action diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 514ea77bb3..ffe911a6a3 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -352,6 +352,11 @@ UM.MainWindow { { Printer.groupSelected() } + + unGroupObjects.onTriggered: + { + Printer.ungroupSelected() + } deleteAll.onTriggered: Printer.deleteAll() resetAllTranslation.onTriggered: Printer.resetAllTranslation() @@ -379,6 +384,7 @@ UM.MainWindow { MenuItem { action: actions.multiplyObject; } MenuItem { action: actions.splitObject; } MenuItem { action: actions.groupObjects;} + MenuItem { action: actions.unGroupObjects;} MenuSeparator { } MenuItem { action: actions.deleteAll; } MenuItem { action: actions.reloadAll; }