mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-21 20:19:32 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
57a37cfb8f
@ -555,12 +555,18 @@ 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)
|
||||||
|
op.addOperation(SetParentOperation(remaining_nodes_in_group[0], group_node.getParent()))
|
||||||
|
op.addOperation(RemoveSceneNodeOperation(group_node))
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
pass
|
pass
|
||||||
@ -586,8 +592,7 @@ class CuraApplication(QtApplication):
|
|||||||
op.push()
|
op.push()
|
||||||
if group_node:
|
if group_node:
|
||||||
if len(group_node.getChildren()) == 1 and group_node.callDecoration("isGroup"):
|
if len(group_node.getChildren()) == 1 and group_node.callDecoration("isGroup"):
|
||||||
group_node.getChildren()[0].translate(group_node.getPosition())
|
op.addOperation(SetParentOperation(group_node.getChildren()[0], group_node.getParent()))
|
||||||
group_node.getChildren()[0].setParent(group_node.getParent())
|
|
||||||
op = RemoveSceneNodeOperation(group_node)
|
op = RemoveSceneNodeOperation(group_node)
|
||||||
op.push()
|
op.push()
|
||||||
|
|
||||||
@ -652,6 +657,7 @@ class CuraApplication(QtApplication):
|
|||||||
op.addOperation(RemoveSceneNodeOperation(node))
|
op.addOperation(RemoveSceneNodeOperation(node))
|
||||||
|
|
||||||
op.push()
|
op.push()
|
||||||
|
Selection.clear()
|
||||||
|
|
||||||
## Reset all translation on nodes with mesh data.
|
## Reset all translation on nodes with mesh data.
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
@ -54,10 +54,7 @@ UM.MainWindow
|
|||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
if (event.key == Qt.Key_Backspace)
|
if (event.key == Qt.Key_Backspace)
|
||||||
{
|
{
|
||||||
if(objectContextMenu.objectId != 0)
|
Cura.Actions.deleteSelection.trigger()
|
||||||
{
|
|
||||||
Printer.deleteObject(objectContextMenu.objectId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user