From cfaa90b1fbb8d3b6e2a29e0112418145cbbc032d Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Mon, 8 Mar 2021 12:11:29 +1100 Subject: [PATCH] Fix bug where material / style UI was showing without a loaded IFC --- src/ifcblenderexport/blenderbim/bim/module/material/ui.py | 4 ++++ src/ifcblenderexport/blenderbim/bim/module/style/ui.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ifcblenderexport/blenderbim/bim/module/material/ui.py b/src/ifcblenderexport/blenderbim/bim/module/material/ui.py index 9c702843c3..1aec18d6c1 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/material/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/module/material/ui.py @@ -10,6 +10,10 @@ class BIM_PT_material(Panel): bl_region_type = "WINDOW" bl_context = "material" + @classmethod + def poll(cls, context): + return IfcStore.get_file() + def draw(self, context): row = self.layout.row() if bool(context.active_object.active_material.BIMObjectProperties.ifc_definition_id): diff --git a/src/ifcblenderexport/blenderbim/bim/module/style/ui.py b/src/ifcblenderexport/blenderbim/bim/module/style/ui.py index 05cfa2da97..408e42a846 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/style/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/module/style/ui.py @@ -1,4 +1,5 @@ from bpy.types import Panel +from blenderbim.bim.ifc import IfcStore class BIM_PT_style(Panel): @@ -10,7 +11,11 @@ class BIM_PT_style(Panel): @classmethod def poll(cls, context): - return context.active_object is not None and context.active_object.active_material is not None + return ( + IfcStore.get_file() + and context.active_object is not None + and context.active_object.active_material is not None + ) def draw(self, context): props = context.active_object.active_material.BIMMaterialProperties