Fix #7158. UI didn't expect to find a material constituent set with no constituents.

It's technically valid but makes no sense.
This commit is contained in:
Dion Moult
2025-10-05 19:41:52 +11:00
parent cb77f9bd26
commit 2ede8a2206
2 changed files with 9 additions and 1 deletions
@@ -404,7 +404,7 @@ class ObjectMaterialData:
material = cls.material
if not cls.material or not material.is_a("IfcMaterialConstituentSet"):
return []
return [m.Name for m in material.MaterialConstituents if m.Name]
return [m.Name for m in material.MaterialConstituents or [] if m.Name]
@classmethod
def is_type_material_overridden(cls) -> bool:
@@ -254,6 +254,10 @@ class BIM_PT_object_material(Panel):
active_object = bpy.context.active_object
self.layerset_bounds(box, active_object, location="Top_Exterior")
if not ObjectMaterialData.data["set_items"]:
row = box.row()
row.label(text="No Materials Found")
for set_item in ObjectMaterialData.data["set_items"]:
if (
len(self.props.material_set_item_profile_attributes)
@@ -357,6 +361,10 @@ class BIM_PT_object_material(Panel):
active_object = bpy.context.active_object
self.layerset_bounds(box, active_object, location="Top_Interior")
if not ObjectMaterialData.data["set_items"]:
row = box.row()
row.label(text="No Materials Found")
for set_item in ObjectMaterialData.data["set_items"]:
material_name = set_item["material"]
material_id = set_item["material_id"]