mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +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 []:
|
for item in items or []:
|
||||||
data = {"id": item.id(), "name": item.Name or "Unnamed", "icon": icon}
|
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"):
|
if item.is_a("IfcMaterialLayer"):
|
||||||
data["name"] += f" ({item.LayerThickness})"
|
data["name"] += f" ({item.LayerThickness})"
|
||||||
if not item.is_a("IfcMaterialList"):
|
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_attributes, self.layout)
|
||||||
blenderbim.bim.helper.draw_attributes(self.props.material_set_usage_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" and not self.mprops.profiles:
|
||||||
if ObjectMaterialData.data["set_item_name"] == "profile":
|
row = self.layout.row(align=True)
|
||||||
row.prop(self.mprops, "profiles", icon="ITALIC", text="")
|
row.label(text="No Profiles Available")
|
||||||
prop_with_search(row, self.props, "material", icon="MATERIAL", text="")
|
row.operator("bim.add_profile_def", icon="ADD", text="")
|
||||||
op = row.operator(f"bim.add_{ObjectMaterialData.data['set_item_name']}", icon="ADD", text="")
|
else:
|
||||||
setattr(op, f"{ObjectMaterialData.data['set_item_name']}_set", ObjectMaterialData.data["set"]["id"])
|
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"])
|
total_items = len(ObjectMaterialData.data["set_items"])
|
||||||
for index, set_item in enumerate(ObjectMaterialData.data["set_items"]):
|
for index, set_item in enumerate(ObjectMaterialData.data["set_items"]):
|
||||||
|
|||||||
Reference in New Issue
Block a user