mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +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
|
items = cls.material.MaterialProfiles
|
||||||
elif cls.material.is_a("IfcMaterialConstituentSet"):
|
elif cls.material.is_a("IfcMaterialConstituentSet"):
|
||||||
items = cls.material.MaterialConstituents
|
items = cls.material.MaterialConstituents
|
||||||
|
elif cls.material.is_a("IfcMaterialList"):
|
||||||
|
items = cls.material.Materials
|
||||||
|
|
||||||
icon = "LAYER_ACTIVE"
|
icon = "LAYER_ACTIVE"
|
||||||
if "Layer" in cls.material.is_a():
|
if "Layer" in cls.material.is_a():
|
||||||
@@ -191,7 +193,9 @@ class ObjectMaterialData:
|
|||||||
data["name"] = "No Profile"
|
data["name"] = "No Profile"
|
||||||
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 item.is_a("IfcMaterial"):
|
||||||
|
data["material"] = item.Name or "Unnamed"
|
||||||
|
else:
|
||||||
data["material"] = item.Material.Name or "Unnamed"
|
data["material"] = item.Material.Name or "Unnamed"
|
||||||
results.append(data)
|
results.append(data)
|
||||||
return results
|
return results
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ class AssignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
objects = [bpy.data.objects.get(self.obj)] if self.obj else tool.Blender.get_selected_objects()
|
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):
|
class UnassignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
@@ -185,7 +185,7 @@ class UnassignMaterial(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
objects = [bpy.data.objects.get(self.obj)] if self.obj else tool.Blender.get_selected_objects()
|
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):
|
class AddConstituent(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
@@ -350,10 +350,8 @@ class AddListItem(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"material.add_list_item",
|
"material.add_list_item",
|
||||||
self.file,
|
self.file,
|
||||||
**{
|
material_list=self.file.by_id(self.list_item_set),
|
||||||
"material_list": self.file.by_id(self.list_item_set),
|
material=self.file.by_id(int(obj.BIMObjectMaterialProperties.material)),
|
||||||
"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)
|
setattr(op, f"{ObjectMaterialData.data['set_item_name']}_index", index)
|
||||||
|
|
||||||
def draw_read_only_set_ui(self):
|
def draw_read_only_set_ui(self):
|
||||||
row = self.layout.row(align=True)
|
if ObjectMaterialData.data["material_class"] != "IfcMaterialList":
|
||||||
row.label(text="Name")
|
row = self.layout.row(align=True)
|
||||||
row.label(text=ObjectMaterialData.data["set"]["name"])
|
row.label(text="Name")
|
||||||
|
row.label(text=ObjectMaterialData.data["set"]["name"])
|
||||||
|
|
||||||
if ObjectMaterialData.data["set"]["description"]:
|
if ObjectMaterialData.data["set"]["description"]:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="Description")
|
row.label(text="Description")
|
||||||
|
|||||||
Reference in New Issue
Block a user