mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-20 12:39:06 +08:00
Delete selection now also removed group nodes when they only have one child left
CURA-1891
This commit is contained in:
parent
1ed0503e02
commit
21d4e9b894
@ -555,12 +555,19 @@ class CuraApplication(QtApplication):
|
|||||||
def deleteSelection(self):
|
def deleteSelection(self):
|
||||||
if not self.getController().getToolsEnabled():
|
if not self.getController().getToolsEnabled():
|
||||||
return
|
return
|
||||||
|
removed_group_nodes = []
|
||||||
op = GroupedOperation()
|
op = GroupedOperation()
|
||||||
nodes = Selection.getAllSelectedObjects()
|
nodes = Selection.getAllSelectedObjects()
|
||||||
for node in nodes:
|
for node in nodes:
|
||||||
op.addOperation(RemoveSceneNodeOperation(node))
|
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()
|
op.push()
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user