mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix #3843. Regression where IfcMaterialList UI didn't show list of materials.
This commit is contained in:
@@ -173,6 +173,8 @@ class ObjectMaterialData:
|
||||
items = cls.material.MaterialProfiles
|
||||
elif cls.material.is_a("IfcMaterialConstituentSet"):
|
||||
items = cls.material.MaterialConstituents
|
||||
elif cls.material.is_a("IfcMaterialList"):
|
||||
items = cls.material.Materials
|
||||
|
||||
icon = "LAYER_ACTIVE"
|
||||
if "Layer" in cls.material.is_a():
|
||||
@@ -191,7 +193,9 @@ class ObjectMaterialData:
|
||||
data["name"] = "No Profile"
|
||||
if item.is_a("IfcMaterialLayer"):
|
||||
data["name"] += f" ({item.LayerThickness})"
|
||||
if not item.is_a("IfcMaterialList"):
|
||||
if item.is_a("IfcMaterial"):
|
||||
data["material"] = item.Name or "Unnamed"
|
||||
else:
|
||||
data["material"] = item.Material.Name or "Unnamed"
|
||||
results.append(data)
|
||||
return results
|
||||
|
||||
@@ -174,7 +174,7 @@ class AssignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
objects = [bpy.data.objects.get(self.obj)] if self.obj else tool.Blender.get_selected_objects()
|
||||
core.assign_material(tool.Ifc, tool.Material, material_type= self.material_type , objects=objects )
|
||||
core.assign_material(tool.Ifc, tool.Material, material_type=self.material_type, objects=objects)
|
||||
|
||||
|
||||
class UnassignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
||||
@@ -185,7 +185,7 @@ class UnassignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
def _execute(self, context):
|
||||
objects = [bpy.data.objects.get(self.obj)] if self.obj else tool.Blender.get_selected_objects()
|
||||
core.unassign_material(tool.Ifc, tool.Material, objects=objects )
|
||||
core.unassign_material(tool.Ifc, tool.Material, objects=objects)
|
||||
|
||||
|
||||
class AddConstituent(bpy.types.Operator, tool.Ifc.Operator):
|
||||
@@ -350,10 +350,8 @@ class AddListItem(bpy.types.Operator, tool.Ifc.Operator):
|
||||
ifcopenshell.api.run(
|
||||
"material.add_list_item",
|
||||
self.file,
|
||||
**{
|
||||
"material_list": self.file.by_id(self.list_item_set),
|
||||
"material": self.file.by_id(int(obj.BIMObjectMaterialProperties.material)),
|
||||
},
|
||||
material_list=self.file.by_id(self.list_item_set),
|
||||
material=self.file.by_id(int(obj.BIMObjectMaterialProperties.material)),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -284,9 +284,11 @@ class BIM_PT_object_material(Panel):
|
||||
setattr(op, f"{ObjectMaterialData.data['set_item_name']}_index", index)
|
||||
|
||||
def draw_read_only_set_ui(self):
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Name")
|
||||
row.label(text=ObjectMaterialData.data["set"]["name"])
|
||||
if ObjectMaterialData.data["material_class"] != "IfcMaterialList":
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Name")
|
||||
row.label(text=ObjectMaterialData.data["set"]["name"])
|
||||
|
||||
if ObjectMaterialData.data["set"]["description"]:
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text="Description")
|
||||
|
||||
Reference in New Issue
Block a user