diff options
author | Stephen Leger <stephen@3dservices.ch> | 2017-08-26 01:33:26 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-09-04 16:11:43 +0300 |
commit | e80a849af2497766a86e7d29563a87deb341b207 (patch) | |
tree | 083d83d98690235489df2178d7cbb0ce2d638537 | |
parent | bea397201867270fc60fcad760e9402a2d408726 (diff) |
archipack: fix performance issue in draw window/door tools
-rw-r--r-- | archipack/archipack_door.py | 16 | ||||
-rw-r--r-- | archipack/archipack_window.py | 17 |
2 files changed, 27 insertions, 6 deletions
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 |