show materials descriptions in the tooltip when assigning a material

Example - https://i.imgur.com/yi96BMa.png
This commit is contained in:
Andrej730
2024-07-08 12:20:08 +05:00
parent b45a995bb3
commit ee5b3d1775
@@ -297,9 +297,14 @@ class ObjectMaterialData:
return getattr(material, "Name", None) or "Unnamed"
@classmethod
def materials(cls):
def materials(cls) -> list[tool.Blender.BLENDER_ENUM_ITEM]:
is_ifc2x3 = tool.Ifc.get_schema() == "IFC2X3"
return sorted(
[(str(m.id()), m.Name or "Unnamed", "") for m in tool.Ifc.get().by_type("IfcMaterial")], key=lambda x: x[1]
[
(str(m.id()), m.Name or "Unnamed", "" if is_ifc2x3 else (m.Description or ""))
for m in tool.Ifc.get().by_type("IfcMaterial")
],
key=lambda x: x[1],
)
@classmethod