mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
restoring selection on bim.override_mode_set_edit if nothing worked
it was a bit confusing when you're trying to edit some object, you get error message but you also lose object selection
This commit is contained in:
@@ -746,6 +746,8 @@ class OverrideModeSetEdit(bpy.types.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
objs = context.selected_objects or [context.active_object]
|
||||
active_obj = context.active_object
|
||||
|
||||
if context.active_object:
|
||||
context.active_object.select_set(True)
|
||||
for obj in objs:
|
||||
@@ -797,6 +799,11 @@ class OverrideModeSetEdit(bpy.types.Operator):
|
||||
context.view_layer.objects.active = context.selected_objects[0] if context.selected_objects else None
|
||||
if context.active_object:
|
||||
bpy.ops.object.mode_set(mode="EDIT", toggle=True)
|
||||
else:
|
||||
# restore the selection if nothing worked
|
||||
for obj in objs:
|
||||
obj.select_set(True)
|
||||
context.view_layer.objects.active = active_obj
|
||||
return {"FINISHED"}
|
||||
|
||||
def invoke(self, context, event):
|
||||
|
||||
Reference in New Issue
Block a user