diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index bc4378feff..2de70b7304 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -555,12 +555,19 @@ class CuraApplication(QtApplication): def deleteSelection(self): if not self.getController().getToolsEnabled(): return - + removed_group_nodes = [] op = GroupedOperation() nodes = Selection.getAllSelectedObjects() for node in nodes: op.addOperation(RemoveSceneNodeOperation(node)) - + group_node = node.getParent() + if group_node and group_node.callDecoration("isGroup") and group_node not in removed_group_nodes: + remaining_nodes_in_group = list(set(group_node.getChildren()) - set(nodes)) + if len(remaining_nodes_in_group) == 1: + removed_group_nodes.append(group_node) + remaining_nodes_in_group[0].translate(group_node.getPosition()) + remaining_nodes_in_group[0].setParent(group_node.getParent()) + op.addOperation(RemoveSceneNodeOperation(group_node)) op.push() pass