From 1c9cd058c8b75edbabd24f80d68ed9a2e3b81b35 Mon Sep 17 00:00:00 2001 From: Gorgious Date: Thu, 19 Aug 2021 22:46:01 +0200 Subject: [PATCH] Fix errors if no ifc file --- src/blenderbim/blenderbim/bim/module/attribute/ui.py | 2 ++ src/blenderbim/blenderbim/bim/module/pset/ui.py | 3 ++- src/blenderbim/blenderbim/bim/module/style/ui.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/attribute/ui.py b/src/blenderbim/blenderbim/bim/module/attribute/ui.py index 1fcb0c13cf..5bdb184576 100644 --- a/src/blenderbim/blenderbim/bim/module/attribute/ui.py +++ b/src/blenderbim/blenderbim/bim/module/attribute/ui.py @@ -110,6 +110,8 @@ class BIM_PT_material_attributes(Panel): @classmethod def poll(cls, context): + if not IfcStore.get_file(): + return False try: return bool(context.active_object.active_material.BIMObjectProperties.ifc_definition_id) except: diff --git a/src/blenderbim/blenderbim/bim/module/pset/ui.py b/src/blenderbim/blenderbim/bim/module/pset/ui.py index 5a0d78269c..d7fe3aeddb 100644 --- a/src/blenderbim/blenderbim/bim/module/pset/ui.py +++ b/src/blenderbim/blenderbim/bim/module/pset/ui.py @@ -207,7 +207,8 @@ class BIM_PT_material_psets(Panel): props = context.active_object.active_material.BIMObjectProperties if not props.ifc_definition_id: return False - if IfcStore.get_file().schema == "IFC2X3": + file = IfcStore.get_file() + if not file or file.schema == "IFC2X3": return False # We don't support material psets in IFC2X3 because they suck if props.ifc_definition_id not in Data.products: Data.load(IfcStore.get_file(), props.ifc_definition_id) diff --git a/src/blenderbim/blenderbim/bim/module/style/ui.py b/src/blenderbim/blenderbim/bim/module/style/ui.py index 01273d90bf..a2df554fb5 100644 --- a/src/blenderbim/blenderbim/bim/module/style/ui.py +++ b/src/blenderbim/blenderbim/bim/module/style/ui.py @@ -59,6 +59,8 @@ class BIM_PT_style_attributes(Panel): @classmethod def poll(cls, context): + if not IfcStore.get_file(): + return False try: return bool(context.active_object.active_material.BIMMaterialProperties.ifc_style_id) except: