From 45f06eeea7b808fad3f2ba4c700ff8a11759e866 Mon Sep 17 00:00:00 2001 From: Gorgious56 Date: Mon, 3 Apr 2023 17:55:44 +0200 Subject: [PATCH] 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 --- .../blenderbim/bim/module/geometry/operator.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/geometry/operator.py b/src/blenderbim/blenderbim/bim/module/geometry/operator.py index 9409960c18..4245fbceec 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/operator.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/operator.py @@ -724,7 +724,6 @@ class OverrideModeSetEdit(bpy.types.Operator): objs = context.selected_objects or [context.active_object] if context.active_object: context.active_object.select_set(True) - edited_objs = [] for obj in objs: if not obj: continue @@ -766,9 +765,15 @@ class OverrideModeSetEdit(bpy.types.Operator): obj.select_set(False) continue - if not context.selected_objects: - return {"FINISHED"} - bpy.ops.object.mode_set(mode="EDIT", toggle=True) + if not context.selected_objects or len(context.selected_objects) != len(objs): + # We are trying to edit at least one non-mesh-like object : Display a hint to the user + 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"} def invoke(self, context, event):