diff options
author | Stephen Leger <stephen@3dservices.ch> | 2017-08-03 16:59:40 +0300 |
---|---|---|
committer | Stephen Leger <stephen@3dservices.ch> | 2017-08-09 23:37:00 +0300 |
commit | 92301276de6919b27b79d548ea69cd0b07ec0549 (patch) | |
tree | 6ea2ea916b4f374d37cd59d540d55b33cbe891e9 /archipack | |
parent | 948149cefc5501497b6500b6436f86418eb08367 (diff) |
archipack: fix left select issue in draw window/door and allow selecting preset while drawing
Diffstat (limited to 'archipack')
-rw-r--r-- | archipack/archipack_door.py | 21 | ||||
-rw-r--r-- | archipack/archipack_snap.py | 5 | ||||
-rw-r--r-- | archipack/archipack_window.py | 18 |
3 files changed, 39 insertions, 5 deletions
diff --git a/archipack/archipack_door.py b/archipack/archipack_door.py index 642b7747..c50398c6 100644 --- a/archipack/archipack_door.py +++ b/archipack/archipack_door.py @@ -1598,7 +1598,7 @@ class ARCHIPACK_OT_door(ArchipackCreateTool, Operator): def unique(self, context): act = context.active_object - sel = [o for o in context.selected_objects] + sel = context.selected_objects[:] bpy.ops.object.select_all(action="DESELECT") for o in sel: if archipack_door.filter(o): @@ -1650,6 +1650,7 @@ class ARCHIPACK_OT_door_draw(ArchpackDrawTool, Operator): filepath = StringProperty(default="") feedback = None stack = [] + object_name = "" @classmethod def poll(cls, context): @@ -1690,6 +1691,8 @@ class ARCHIPACK_OT_door_draw(ArchpackDrawTool, Operator): bpy.ops.archipack.door(auto_manipulate=False, filepath=self.filepath) o = context.active_object + self.object_name = o.name + bpy.ops.archipack.generate_hole('INVOKE_DEFAULT') o.select = True context.scene.objects.active = o @@ -1697,7 +1700,10 @@ class ARCHIPACK_OT_door_draw(ArchpackDrawTool, Operator): def modal(self, context, event): context.area.tag_redraw() - o = context.active_object + o = context.scene.objects.get(self.object_name) + if o is None: + return {'FINISHED'} + d = archipack_door.datablock(o) hole = None @@ -1721,6 +1727,16 @@ class ARCHIPACK_OT_door_draw(ArchpackDrawTool, Operator): d.y = wall.data.archipack_wall2[0].width if event.value == 'PRESS': + + if event.type in {'C'}: + bpy.ops.archipack.door(mode='DELETE') + self.feedback.disable() + bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW') + bpy.ops.archipack.door_preset_menu( + 'INVOKE_DEFAULT', + preset_operator="archipack.door_draw") + return {'FINISHED'} + if event.type in {'LEFTMOUSE', 'RET', 'NUMPAD_ENTER', 'SPACE'}: if wall is not None: context.scene.objects.active = wall @@ -1781,6 +1797,7 @@ class ARCHIPACK_OT_door_draw(ArchpackDrawTool, Operator): self.feedback.instructions(context, "Draw a door", "Click & Drag over a wall", [ ('LEFTCLICK, RET, SPACE, ENTER', 'Create a door'), ('BACKSPACE, CTRL+Z', 'undo last'), + ('C', 'Choose another door'), ('SHIFT', 'Make independant copy'), ('RIGHTCLICK or ESC', 'exit') ]) diff --git a/archipack/archipack_snap.py b/archipack/archipack_snap.py index eb3898d3..92e09595 100644 --- a/archipack/archipack_snap.py +++ b/archipack/archipack_snap.py @@ -142,10 +142,11 @@ def snap_point(takeloc=None, # for ArchipackSnapBase to be able to handle both modes # must implements corresponding helper create and delete actions SnapStore.mode = mode - res = bpy.ops.archipack.snap('INVOKE_DEFAULT') + bpy.ops.archipack.snap('INVOKE_DEFAULT') # return helper so we are able to move it "live" return SnapStore.helper + class ArchipackSnapBase(): """ Helper class for snap Operators @@ -273,7 +274,7 @@ class ARCHIPACK_OT_snap(ArchipackSnapBase, Operator): # NOTE: this part only run after transform LEFTMOUSE RELEASE # or with ESC and RIGHTMOUSE if event.type not in {'ESC', 'RIGHTMOUSE', 'LEFTMOUSE', 'MOUSEMOVE'}: - print("Snap.modal skip unknown event %s %s" % (event.type, event.value)) + # print("Snap.modal skip unknown event %s %s" % (event.type, event.value)) # self.report({'WARNING'}, "ARCHIPACK_OT_snap unknown event") return{'PASS_THROUGH'} if event.type in ('ESC', 'RIGHTMOUSE'): diff --git a/archipack/archipack_window.py b/archipack/archipack_window.py index 4b052643..3979b181 100644 --- a/archipack/archipack_window.py +++ b/archipack/archipack_window.py @@ -1841,6 +1841,7 @@ class ARCHIPACK_OT_window_draw(ArchpackDrawTool, Operator): filepath = StringProperty(default="") feedback = None stack = [] + object_name = "" @classmethod def poll(cls, context): @@ -1881,6 +1882,8 @@ class ARCHIPACK_OT_window_draw(ArchpackDrawTool, Operator): bpy.ops.archipack.window(auto_manipulate=False, filepath=self.filepath) o = context.active_object + self.object_name = o.name + bpy.ops.archipack.generate_hole('INVOKE_DEFAULT') o.select = True context.scene.objects.active = o @@ -1888,7 +1891,11 @@ class ARCHIPACK_OT_window_draw(ArchpackDrawTool, Operator): def modal(self, context, event): context.area.tag_redraw() - o = context.active_object + o = context.scene.objects.get(self.object_name) + + if o is None: + return {'FINISHED'} + d = archipack_window.datablock(o) hole = None if d is not None: @@ -1911,6 +1918,14 @@ class ARCHIPACK_OT_window_draw(ArchpackDrawTool, Operator): d.y = wall.data.archipack_wall2[0].width if event.value == 'PRESS': + + if event.type in {'C'}: + bpy.ops.archipack.window(mode='DELETE') + self.feedback.disable() + bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW') + bpy.ops.archipack.window_preset_menu('INVOKE_DEFAULT', preset_operator="archipack.window_draw") + return {'FINISHED'} + if event.type in {'LEFTMOUSE', 'RET', 'NUMPAD_ENTER', 'SPACE'}: if wall is not None: context.scene.objects.active = wall @@ -1970,6 +1985,7 @@ class ARCHIPACK_OT_window_draw(ArchpackDrawTool, Operator): self.feedback.instructions(context, "Draw a window", "Click & Drag over a wall", [ ('LEFTCLICK, RET, SPACE, ENTER', 'Create a window'), ('BACKSPACE, CTRL+Z', 'undo last'), + ('C', 'Choose another window'), ('SHIFT', 'Make independant copy'), ('RIGHTCLICK or ESC', 'exit') ]) |