mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Fix bug in 4c93270ad for IfcMaterialLayers
This commit is contained in:
@@ -888,5 +888,8 @@ class SelectMaterialInMaterialsUI(bpy.types.Operator):
|
||||
item_index, _ = material_item
|
||||
props.active_material_index = item_index
|
||||
|
||||
self.report({"INFO"}, f"Material '{material.Name}' is selected in Materials UI.")
|
||||
self.report(
|
||||
{"INFO"},
|
||||
f"Material '{tool.Material.get_material_name(material) or 'Unnamed'}' is selected in Materials UI.",
|
||||
)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -429,3 +429,14 @@ class Material(bonsai.core.tool.Material):
|
||||
|
||||
i += cls.purge_unused_materials()
|
||||
return i
|
||||
|
||||
@classmethod
|
||||
def get_material_name(cls, material: ifcopenshell.entity_instance) -> Union[str, None]:
|
||||
ifc_class = material.is_a()
|
||||
if ifc_class == "IfcMaterialList":
|
||||
return None
|
||||
elif ifc_class == "IfcMaterialLayerSet":
|
||||
# Optional IfcLabel.
|
||||
return material.LayerSetName
|
||||
# Optional IfcLabel except for IfcMaterial.
|
||||
return material.Name
|
||||
|
||||
Reference in New Issue
Block a user