From 937fa21ccefab081f43c54a52ee73928b73ad2bb Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Thu, 16 Feb 2023 17:34:18 +0500 Subject: [PATCH] Fix to prevent pyrna_enum_to_py warnings using BIM Tool Prevents couple `pyrna_enum_to_py` warnings that occured using BIM Tool ``` WARN (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:1341 pyrna_enum_to_py: current value '0' matches no enum in 'BIMModelProperties', '', 'ifc_class_browser' WARN (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:1341 pyrna_enum_to_py: current value '0' matches no enum in 'BIMModelProperties', '', 'relating_type_id' WARN (bpy.rna): C:\Users\blender\git\blender-v340\blender.git\source\blender\python\intern\bpy_rna.c:1341 pyrna_enum_to_py: current value '0' matches no enum in 'BIMModelProperties', '', 'ifc_class' ``` --- src/blenderbim/blenderbim/bim/module/model/data.py | 5 +++-- src/blenderbim/blenderbim/bim/module/model/ui.py | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/data.py b/src/blenderbim/blenderbim/bim/module/model/data.py index 46b87bcff0..508079681c 100644 --- a/src/blenderbim/blenderbim/bim/module/model/data.py +++ b/src/blenderbim/blenderbim/bim/module/model/data.py @@ -90,7 +90,7 @@ class AuthoringData: @classmethod def type_thumbnail(cls): - if not cls.props.relating_type_id: + if not cls.data["relating_types_ids"]: return 0 element = tool.Ifc.get().by_id(int(cls.props.relating_type_id)) return cls.type_thumbnails.get(element.id(), None) or 0 @@ -221,7 +221,8 @@ class AuthoringData: @classmethod def relating_types_browser(cls): - return cls.relating_types(ifc_class=cls.props.ifc_class_browser) + if cls.data["ifc_classes"]: + return cls.relating_types(ifc_class=cls.props.ifc_class_browser) @classmethod def new_constr_class_info(cls, ifc_class): diff --git a/src/blenderbim/blenderbim/bim/module/model/ui.py b/src/blenderbim/blenderbim/bim/module/model/ui.py index 7750befda9..e7f90de964 100644 --- a/src/blenderbim/blenderbim/bim/module/model/ui.py +++ b/src/blenderbim/blenderbim/bim/module/model/ui.py @@ -20,7 +20,7 @@ import bpy import blenderbim.tool as tool from bpy.types import Panel, Operator, Menu from blenderbim.bim.module.model.data import AuthoringData, ArrayData, StairData, SverchokData, WindowData, DoorData -from blenderbim.bim.module.model.prop import store_cursor_position +from blenderbim.bim.module.model.prop import store_cursor_position, get_ifc_class from blenderbim.bim.module.model.stair import update_stair_modifier from blenderbim.bim.module.model.window import update_window_modifier_bmesh from blenderbim.bim.module.model.door import update_door_modifier_bmesh @@ -40,11 +40,9 @@ class LaunchTypeManager(bpy.types.Operator): def invoke(self, context, event): props = context.scene.BIMModelProperties props.type_page = 1 - if props.ifc_class: + if get_ifc_class(None, context): props.type_class = props.ifc_class bpy.ops.bim.load_type_thumbnails(ifc_class=props.ifc_class, offset=0, limit=9) - if not AuthoringData.is_loaded: - AuthoringData.load() return context.window_manager.invoke_popup(self, width=550) def draw(self, context):