Fix error if no ifc file set (#1620)

* Fix error trying to access unset ifc file

* Return prematurely from operator if no file is set

* Revert "Return prematurely from operator if no file is set"

This reverts commit f876cfbcef.

* Revert "Fix error trying to access unset ifc file"

This reverts commit 6782c47d86.

* Prevent error message if ifc_types enum is empty

* Hide panel if no ifc file to avoid error
This commit is contained in:
Gorgious56
2021-08-03 01:07:56 +02:00
committed by GitHub
parent 7c0405fab0
commit 5562c9d2b5
2 changed files with 5 additions and 1 deletions
@@ -9,6 +9,10 @@ class BIM_PT_authoring(Panel):
bl_region_type = "UI"
bl_category = "BlenderBIM"
@classmethod
def poll(cls, context):
return IfcStore.get_file()
def draw(self, context):
tprops = context.scene.BIMTypeProperties
col = self.layout.column(align=True)
@@ -42,7 +42,7 @@ def getIfcTypes(self, context):
def getAvailableTypes(self, context):
global available_types_enum
if len(available_types_enum) < 1:
if len(available_types_enum) < 1 and getIfcTypes(self, context):
elements = IfcStore.get_file().by_type(self.ifc_class)
available_types_enum.extend((str(e.id()), e.Name, "") for e in elements)
return available_types_enum