mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Material UI now prompts to add a profile if none exist in your library
This commit is contained in:
@@ -179,6 +179,8 @@ class ObjectMaterialData:
|
||||
|
||||
for item in items or []:
|
||||
data = {"id": item.id(), "name": item.Name or "Unnamed", "icon": icon}
|
||||
if item.is_a("IfcMaterialProfile") and not item.Name:
|
||||
data["name"] = item.Profile.ProfileName or "Unnamed"
|
||||
if item.is_a("IfcMaterialLayer"):
|
||||
data["name"] += f" ({item.LayerThickness})"
|
||||
if not item.is_a("IfcMaterialList"):
|
||||
|
||||
@@ -195,12 +195,17 @@ class BIM_PT_object_material(Panel):
|
||||
blenderbim.bim.helper.draw_attributes(self.props.material_set_attributes, self.layout)
|
||||
blenderbim.bim.helper.draw_attributes(self.props.material_set_usage_attributes, self.layout)
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
if ObjectMaterialData.data["set_item_name"] == "profile":
|
||||
row.prop(self.mprops, "profiles", icon="ITALIC", text="")
|
||||
prop_with_search(row, self.props, "material", icon="MATERIAL", text="")
|
||||
op = row.operator(f"bim.add_{ObjectMaterialData.data['set_item_name']}", icon="ADD", text="")
|
||||
setattr(op, f"{ObjectMaterialData.data['set_item_name']}_set", ObjectMaterialData.data["set"]["id"])
|
||||
if ObjectMaterialData.data["set_item_name"] == "profile" and not self.mprops.profiles:
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="No Profiles Available")
|
||||
row.operator("bim.add_profile_def", icon="ADD", text="")
|
||||
else:
|
||||
row = self.layout.row(align=True)
|
||||
if ObjectMaterialData.data["set_item_name"] == "profile":
|
||||
row.prop(self.mprops, "profiles", icon="ITALIC", text="")
|
||||
prop_with_search(row, self.props, "material", icon="MATERIAL", text="")
|
||||
op = row.operator(f"bim.add_{ObjectMaterialData.data['set_item_name']}", icon="ADD", text="")
|
||||
setattr(op, f"{ObjectMaterialData.data['set_item_name']}_set", ObjectMaterialData.data["set"]["id"])
|
||||
|
||||
total_items = len(ObjectMaterialData.data["set_items"])
|
||||
for index, set_item in enumerate(ObjectMaterialData.data["set_items"]):
|
||||
|
||||
Reference in New Issue
Block a user