Fix bug where material / style UI was showing without a loaded IFC

This commit is contained in:
Dion Moult
2021-03-08 12:11:29 +11:00
parent dc909f1fc6
commit cfaa90b1fb
2 changed files with 10 additions and 1 deletions
@@ -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):
@@ -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