mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 03:33:48 +00:00
Fix #5849 : Use Keymap item instead of modal operator for override escape in 3D viewport
- Enables the vanilla Blender autosave feature back, since a running modal operator deactivates it - ESC is not used by any other vanilla keymap in the 3D viewport (may be conflict with other addons) - Hitting ESC over another type of editor (eg enum field in the properties editor) will not trigger disabling ifc item mode - You can now hit ESC in IFC edit mode to cancel editing the geometry and go back to ifc object mode
This commit is contained in:
@@ -138,6 +138,10 @@ def register():
|
||||
kmi = km.keymap_items.new("bim.override_mode_set_object", "TAB", "PRESS")
|
||||
addon_keymaps.append((km, kmi))
|
||||
|
||||
km = wm.keyconfigs.addon.keymaps.new(name="3D View", space_type="VIEW_3D")
|
||||
kmi = km.keymap_items.new("bim.override_escape", "ESC", "PRESS")
|
||||
addon_keymaps.append((km, kmi))
|
||||
|
||||
km = wm.keyconfigs.addon.keymaps.new(name="Outliner", space_type="OUTLINER")
|
||||
kmi = km.keymap_items.new("bim.override_paste_buffer", "V", "PRESS", ctrl=True)
|
||||
addon_keymaps.append((km, kmi))
|
||||
|
||||
@@ -1848,17 +1848,12 @@ class OverrideEscape(bpy.types.Operator):
|
||||
bl_label = "Override Escape"
|
||||
|
||||
def execute(self, context):
|
||||
self.report({"INFO"}, "Operator executed")
|
||||
return {"FINISHED"}
|
||||
|
||||
def modal(self, context, event):
|
||||
if event.type == "ESC" and context.scene.BIMGeometryProperties.mode == "ITEM":
|
||||
if context.scene.BIMGeometryProperties.mode == "ITEM":
|
||||
tool.Geometry.disable_item_mode()
|
||||
return {"PASS_THROUGH"}
|
||||
|
||||
def invoke(self, context, event):
|
||||
context.window_manager.modal_handler_add(self)
|
||||
return {"RUNNING_MODAL"}
|
||||
if context.scene.BIMGeometryProperties.mode == "EDIT":
|
||||
bpy.ops.object.editmode_toggle()
|
||||
tool.Geometry.disable_item_mode()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class OverrideModeSetEdit(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
Reference in New Issue
Block a user