Remove group when "parent" is the only node in the group

This commit is contained in:
fieldOfView 2018-03-15 15:05:56 +01:00
parent c3c096aaa0
commit b9bf78d36c

View File

@ -125,10 +125,24 @@ class SupportEraser(Tool):
Selection.add(parent)
def _removeEraserMesh(self, node: CuraSceneNode):
op = RemoveSceneNodeOperation(node)
group = node.getParent()
if group.callDecoration("isGroup"):
parent = group.getChildren()[0]
op = GroupedOperation()
op.addOperation(RemoveSceneNodeOperation(node))
if len(group.getChildren()) == 2:
op.addOperation(SetParentOperation(parent, group.getParent()))
op.push()
Application.getInstance().getController().getScene().sceneChanged.emit(node)
# Select the picked node so the group does not get drawn as a wireframe (yet)
if Selection.isSelected(group):
Selection.remove(group)
if parent and not Selection.isSelected(parent):
Selection.add(parent)
def _updateEnabled(self):
plugin_enabled = False