From bfaa89cdecf7d8d732d297ab3e34056e9d2b6645 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 3 Aug 2021 09:43:39 +1000 Subject: [PATCH] Fix #1608. Fix warnings when no people or organisations existed. --- src/blenderbim/blenderbim/bim/handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/handler.py b/src/blenderbim/blenderbim/bim/handler.py index 7c02de271f..447f1f9eb4 100644 --- a/src/blenderbim/blenderbim/bim/handler.py +++ b/src/blenderbim/blenderbim/bim/handler.py @@ -4,6 +4,7 @@ import addon_utils import ifcopenshell.api.owner.settings from bpy.app.handlers import persistent from blenderbim.bim.ifc import IfcStore +from blenderbim.bim.module.owner.prop import getPersons, getOrganisations from ifcopenshell.api.attribute.data import Data as AttributeData from ifcopenshell.api.material.data import Data as MaterialData from ifcopenshell.api.style.data import Data as StyleData @@ -211,12 +212,12 @@ def setDefaultProperties(scene): ) ifcopenshell.api.owner.settings.get_person = ( lambda ifc: ifc.by_id(int(bpy.context.scene.BIMOwnerProperties.user_person)) - if bpy.context.scene.BIMOwnerProperties.user_person + if getPersons(None, bpy.context) and bpy.context.scene.BIMOwnerProperties.user_person else None ) ifcopenshell.api.owner.settings.get_organisation = ( lambda ifc: ifc.by_id(int(bpy.context.scene.BIMOwnerProperties.user_organisation)) - if bpy.context.scene.BIMOwnerProperties.user_organisation + if getOrganisations(None, bpy.context) and bpy.context.scene.BIMOwnerProperties.user_organisation else None ) ifcopenshell.api.owner.settings.get_application = get_application