diff --git a/src/ifcblenderexport/blenderbim/bim/module/material/data.py b/src/ifcblenderexport/blenderbim/bim/module/material/data.py index ca5c2e3c15..6ecc3153c8 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/material/data.py +++ b/src/ifcblenderexport/blenderbim/bim/module/material/data.py @@ -31,25 +31,33 @@ class Data: @classmethod def load_materials(cls): + cls.materials = {} cls.load_element("IfcMaterial", cls.materials) @classmethod def load_constituents(cls): + cls.constituent_sets = {} + cls.constituents = {} cls.load_element("IfcMaterialConstituent", cls.constituents) cls.load_element("IfcMaterialConstituentSet", cls.constituent_sets) @classmethod def load_layers(cls): + cls.layer_sets = {} + cls.layers = {} cls.load_element("IfcMaterialLayer", cls.layers) cls.load_element("IfcMaterialLayerSet", cls.layer_sets) @classmethod def load_profiles(cls): + cls.profile_sets = {} + cls.profiles = {} cls.load_element("IfcMaterialProfile", cls.profiles) cls.load_element("IfcMaterialProfileSet", cls.profile_sets) @classmethod def load_lists(cls): + cls.lists = {} cls.load_element("IfcMaterialList", cls.lists) @classmethod diff --git a/src/ifcblenderexport/blenderbim/bim/module/material/operator.py b/src/ifcblenderexport/blenderbim/bim/module/material/operator.py index 6a354ab121..f84eec7d83 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/material/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/module/material/operator.py @@ -25,6 +25,7 @@ class AddMaterial(bpy.types.Operator): self.file = IfcStore.get_file() result = add_material.Usecase(self.file, {"Name": obj.name}).execute() obj.BIMObjectProperties.ifc_definition_id = result.id() + Data.load() return {"FINISHED"} @@ -40,6 +41,7 @@ class RemoveMaterial(bpy.types.Operator): self.file, {"material": self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)} ).execute() obj.BIMObjectProperties.ifc_definition_id = 0 + Data.load() return {"FINISHED"} diff --git a/src/ifcblenderexport/blenderbim/bim/module/material/ui.py b/src/ifcblenderexport/blenderbim/bim/module/material/ui.py index 4dcfce99f2..9e639a9c51 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/material/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/module/material/ui.py @@ -39,6 +39,11 @@ class BIM_PT_object_material(Panel): Data.load(self.oprops.ifc_definition_id) self.product_data = Data.products[self.oprops.ifc_definition_id] + if not Data.materials: + row = self.layout.row() + row.label(text="No Materials Available") + return + if self.product_data: if self.product_data["type"] == "IfcMaterialConstituentSet": self.material_set_data = Data.constituent_sets[self.product_data["id"]]