mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 14:07:43 +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):
|
def _execute(self, context):
|
||||||
objs = context.selected_objects or [context.active_object]
|
objs = context.selected_objects or [context.active_object]
|
||||||
|
active_obj = context.active_object
|
||||||
|
|
||||||
if context.active_object:
|
if context.active_object:
|
||||||
context.active_object.select_set(True)
|
context.active_object.select_set(True)
|
||||||
for obj in objs:
|
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
|
context.view_layer.objects.active = context.selected_objects[0] if context.selected_objects else None
|
||||||
if context.active_object:
|
if context.active_object:
|
||||||
bpy.ops.object.mode_set(mode="EDIT", toggle=True)
|
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"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
|
|||||||
Reference in New Issue
Block a user