Fix representation items / booleans UI prioritizing item mode object over active obj

It led to confusion when object A would be in Item Mode and you open properties for object B and try to show rep items for B and UI would be unresponsive.
This commit is contained in:
Andrej730
2025-04-02 18:10:59 +05:00
parent f69b02cad9
commit 4672fc341f
2 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -225,7 +225,7 @@ class BIM_PT_representation_items(Panel):
RepresentationItemsData.load()
props = tool.Geometry.get_geometry_props()
obj = props.representation_obj or tool.Blender.get_active_object()
obj = tool.Geometry.get_active_or_representation_obj()
assert obj
props = tool.Geometry.get_object_geometry_props(obj)
+7 -6
View File
@@ -118,23 +118,24 @@ class BooleansData:
@classmethod
def load(cls):
# Only called when some object is active.
cls.data = {}
cls.data["total_booleans"] = cls.booleans()
cls.data["manual_booleans"] = cls.manual_booleans()
cls.is_loaded = True
@classmethod
def booleans(cls):
props = tool.Geometry.get_geometry_props()
obj = props.representation_obj or bpy.context.active_object
def booleans(cls) -> list[ifcopenshell.entity_instance]:
obj = tool.Geometry.get_active_or_representation_obj()
assert obj
if not (representation := tool.Geometry.get_active_representation(obj)):
return []
return tool.Model.get_booleans(representation=representation)
@classmethod
def manual_booleans(cls):
props = tool.Geometry.get_geometry_props()
obj = props.representation_obj or bpy.context.active_object
def manual_booleans(cls) -> list[ifcopenshell.entity_instance]:
obj = tool.Geometry.get_active_or_representation_obj()
assert obj
if not (representation := tool.Geometry.get_active_representation(obj)):
return []
return tool.Model.get_manual_booleans(tool.Ifc.get_entity(obj), representation=representation)