Browse Source

Duplication now works regardles how deeply group nested a node is

CURA-1578
Jaime van Kessel 8 years ago
parent
commit
a7e22e82b6
1 changed files with 8 additions and 10 deletions
  1. 8 10
      cura/CuraApplication.py

+ 8 - 10
cura/CuraApplication.py

@@ -585,18 +585,16 @@ class CuraApplication(QtApplication):
             node = Selection.getSelectedObject(0)
 
         if node:
-            op = GroupedOperation()
-            for _ in range(count):
-                if node.getParent() and node.getParent().callDecoration("isGroup"):
-                    new_node = copy.deepcopy(node.getParent()) #Copy the group node.
-                    new_node.callDecoration("recomputeConvexHull")
+            current_node = node
+            # Find the topmost group
+            while current_node.getParent() and current_node.getParent().callDecoration("isGroup"):
+                current_node = current_node.getParent()
 
-                    op.addOperation(AddSceneNodeOperation(new_node,node.getParent().getParent()))
-                else:
-                    new_node = copy.deepcopy(node)
-                    new_node.callDecoration("recomputeConvexHull")
-                    op.addOperation(AddSceneNodeOperation(new_node, node.getParent()))
+            new_node = copy.deepcopy(current_node)
 
+            op = GroupedOperation()
+            for _ in range(count):
+                op.addOperation(AddSceneNodeOperation(new_node, current_node.getParent()))
             op.push()
 
     ##  Center object on platform.