mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
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:
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user