Prevent pyrna_enum_to_py warnings on using BIM Tool hotkeys

Type of warning fixed:
WARN (bpy.rna): pyrna_enum_to_py: current value '0' matches no enum in 'BIMModelProperties', '', 'ifc_class'
This commit is contained in:
Andrej730
2023-03-16 15:53:38 +05:00
parent ff2cda7d18
commit 35e748089b
@@ -26,7 +26,7 @@ from blenderbim.bim.helper import prop_with_search, close_operator_panel
from bpy.types import WorkSpaceTool from bpy.types import WorkSpaceTool
from blenderbim.bim.module.model.data import AuthoringData, RailingData, RoofData from blenderbim.bim.module.model.data import AuthoringData, RailingData, RoofData
from blenderbim.bim.module.drawing.data import TextData from blenderbim.bim.module.drawing.data import TextData
from blenderbim.bim.module.model import prop from blenderbim.bim.module.model.prop import get_ifc_class
class BimTool(WorkSpaceTool): class BimTool(WorkSpaceTool):
@@ -466,10 +466,11 @@ class Hotkey(bpy.types.Operator, tool.Ifc.Operator):
self.active_class = element.is_a() self.active_class = element.is_a()
self.active_material_usage = tool.Model.get_usage_type(element) self.active_material_usage = tool.Model.get_usage_type(element)
try: if get_ifc_class(None, None):
self.has_ifc_class = bool(self.props.ifc_class) try:
except: self.has_ifc_class = bool(self.props.ifc_class)
pass except:
pass
getattr(self, f"hotkey_{self.hotkey}")() getattr(self, f"hotkey_{self.hotkey}")()
def invoke(self, context, event): def invoke(self, context, event):