From fe014efdfb8254cf82a7120b650434ba741627a6 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 28 Oct 2016 15:44:20 +0200 Subject: [PATCH] SetParentOperation now also takes removed group nodes into account CURA-382 --- cura/SetParentOperation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cura/SetParentOperation.py b/cura/SetParentOperation.py index 064ab5304c..e2fb18feff 100644 --- a/cura/SetParentOperation.py +++ b/cura/SetParentOperation.py @@ -34,6 +34,13 @@ class SetParentOperation(Operation.Operation): if new_parent: current_parent = self._node.getParent() if current_parent: + # Special casing for groups that have been removed. + # In that case we want to put them back where they belong before checking the depth difference. + # If we don't, we always get 0. + old_parent = new_parent.callDecoration("getOldParent") + if old_parent: + new_parent.callDecoration("getNode").setParent(old_parent) + # Based on the depth difference, we need to do something different. depth_difference = current_parent.getDepth() - new_parent.getDepth() child_transformation = self._node.getLocalTransformation()