From b9bf78d36ce67bbcd5163d479778b69b362b51ce Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Thu, 15 Mar 2018 15:05:56 +0100 Subject: [PATCH] Remove group when "parent" is the only node in the group --- plugins/SupportEraser/SupportEraser.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/SupportEraser/SupportEraser.py b/plugins/SupportEraser/SupportEraser.py index d87a887d1b..ee59fc5258 100644 --- a/plugins/SupportEraser/SupportEraser.py +++ b/plugins/SupportEraser/SupportEraser.py @@ -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