select decomposition to work on unselectable elements #5739

E.g. ifcspaces or other spatial elements are unselectable by default.
This commit is contained in:
Andrej730
2024-11-13 11:07:54 +05:00
parent a8efc5b1d9
commit d3333fed96
3 changed files with 3 additions and 2 deletions
@@ -1197,7 +1197,7 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
bpy.ops.bim.unjoin_walls()
def hotkey_A_D(self):
if not bpy.context.selected_objects:
if not tool.Blender.get_selected_objects():
return
bpy.ops.bim.select_decomposition()
@@ -245,7 +245,7 @@ class SelectDecomposition(bpy.types.Operator):
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
for obj in context.selected_objects:
for obj in tool.Blender.get_selected_objects():
element = tool.Ifc.get_entity(obj)
if not element:
continue
+1
View File
@@ -147,6 +147,7 @@ class Blender(bonsai.core.tool.Blender):
@classmethod
def get_selected_objects(cls) -> set[bpy.types.Object]:
"""Get selected objects including active object."""
if selected_objects := getattr(bpy.context, "selected_objects", None):
if active_obj := cls.get_active_object():
return set(selected_objects + [active_obj])