mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-31 17:06:29 +00:00
Interface now displays a hint when trying to edit a non-mesh-like object
& Fix case where the active object would go into edit mode even if not mesh-like when multiple objects were selected
This commit is contained in:
@@ -724,7 +724,6 @@ class OverrideModeSetEdit(bpy.types.Operator):
|
|||||||
objs = context.selected_objects or [context.active_object]
|
objs = context.selected_objects or [context.active_object]
|
||||||
if context.active_object:
|
if context.active_object:
|
||||||
context.active_object.select_set(True)
|
context.active_object.select_set(True)
|
||||||
edited_objs = []
|
|
||||||
for obj in objs:
|
for obj in objs:
|
||||||
if not obj:
|
if not obj:
|
||||||
continue
|
continue
|
||||||
@@ -766,9 +765,15 @@ class OverrideModeSetEdit(bpy.types.Operator):
|
|||||||
obj.select_set(False)
|
obj.select_set(False)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not context.selected_objects:
|
if not context.selected_objects or len(context.selected_objects) != len(objs):
|
||||||
return {"FINISHED"}
|
# We are trying to edit at least one non-mesh-like object : Display a hint to the user
|
||||||
bpy.ops.object.mode_set(mode="EDIT", toggle=True)
|
self.report({"INFO"}, "Only mesh-like objects can be edited")
|
||||||
|
|
||||||
|
if context.active_object not in context.selected_objects:
|
||||||
|
# The active object is non-mesh-like. Set a valid object (or None) as active
|
||||||
|
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)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
|
|||||||
Reference in New Issue
Block a user