[Bf-extensions-cvs] [e80a849a] blender-v2.79-release: archipack: fix performance issue in draw window/door tools

Stephen Leger noreply at git.blender.org
Mon Sep 4 15:17:31 CEST 2017


Commit: e80a849af2497766a86e7d29563a87deb341b207
Author: Stephen Leger
Date:   Sat Aug 26 00:33:26 2017 +0200
Branches: blender-v2.79-release
https://developer.blender.org/rBAe80a849af2497766a86e7d29563a87deb341b207

archipack: fix performance issue in draw window/door tools

===================================================================

M	archipack/archipack_door.py
M	archipack/archipack_window.py

===================================================================

diff --git a/archipack/archipack_door.py b/archipack/archipack_door.py
index c50398c6..22b9123a 100644
--- a/archipack/archipack_door.py
+++ b/archipack/archipack_door.py
@@ -1679,14 +1679,24 @@ class ARCHIPACK_OT_door_draw(ArchpackDrawTool, Operator):
             new_w = o.copy()
             new_w.data = o.data
             context.scene.objects.link(new_w)
+            # instance subs
+            for child in o.children:
+                if "archipack_hole" not in child:
+                    new_c = child.copy()
+                    new_c.data = child.data
+                    new_c.parent = new_w
+                    context.scene.objects.link(new_c)
+                    # dup handle if any
+                    for c in child.children:
+                        new_h = c.copy()
+                        new_h.data = c.data
+                        new_h.parent = new_c
+                        context.scene.objects.link(new_h)
 
             o = new_w
             o.select = True
             context.scene.objects.active = o
 
-            # synch subs from parent instance
-            bpy.ops.archipack.door(mode="REFRESH")
-
         else:
             bpy.ops.archipack.door(auto_manipulate=False, filepath=self.filepath)
             o = context.active_object
diff --git a/archipack/archipack_window.py b/archipack/archipack_window.py
index 3979b181..3524fbbf 100644
--- a/archipack/archipack_window.py
+++ b/archipack/archipack_window.py
@@ -1856,6 +1856,7 @@ class ARCHIPACK_OT_window_draw(ArchpackDrawTool, Operator):
         self.feedback.draw(context)
 
     def add_object(self, context, event):
+
         o = context.active_object
         bpy.ops.object.select_all(action="DESELECT")
 
@@ -1867,17 +1868,27 @@ class ARCHIPACK_OT_window_draw(ArchpackDrawTool, Operator):
             if event.shift:
                 bpy.ops.archipack.window(mode="UNIQUE")
 
+            # instance subs
             new_w = o.copy()
             new_w.data = o.data
             context.scene.objects.link(new_w)
+            for child in o.children:
+                if "archipack_hole" not in child:
+                    new_c = child.copy()
+                    new_c.data = child.data
+                    new_c.parent = new_w
+                    context.scene.objects.link(new_c)
+                    # dup handle if any
+                    for c in child.children:
+                        new_h = c.copy()
+                        new_h.data = c.data
+                        new_h.parent = new_c
+                        context.scene.objects.link(new_h)
 
             o = new_w
             o.select = True
             context.scene.objects.active = o
 
-            # synch subs from parent instance
-            bpy.ops.archipack.window(mode="REFRESH")
-
         else:
             bpy.ops.archipack.window(auto_manipulate=False, filepath=self.filepath)
             o = context.active_object



More information about the Bf-extensions-cvs mailing list