From 9e5c3ff6752a05fcf45e3c3ed9e3265110e41224 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 3 May 2024 17:38:04 +0500 Subject: [PATCH] fix bug appending blender material when style.Location isn't .blend it wasn't considering that .Location could be either None or not a .blend file and was failing in those cases --- src/blenderbim/blenderbim/bim/module/style/operator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/style/operator.py b/src/blenderbim/blenderbim/bim/module/style/operator.py index 466a8ce3f6..600554ae93 100644 --- a/src/blenderbim/blenderbim/bim/module/style/operator.py +++ b/src/blenderbim/blenderbim/bim/module/style/operator.py @@ -251,14 +251,15 @@ class BrowseExternalStyle(bpy.types.Operator): ) def invoke(self, context, event): - external_style = None + style_elements = None if self.active_surface_style_id: style = tool.Ifc.get().by_id(self.active_surface_style_id) - external_style = tool.Style.get_style_elements(style).get("IfcExternallyDefinedSurfaceStyle", None) + style_elements = tool.Style.get_style_elements(style) # automatically select previously selected external style in file browser # if it exists in the file - if external_style and self.filepath == "": + if style_elements and self.filepath == "" and tool.Style.has_blender_external_style(style_elements): + external_style = style_elements["IfcExternallyDefinedSurfaceStyle"] style_path = Path(tool.Ifc.resolve_uri(external_style.Location)) self.directory = str(style_path.parent) self.filepath = str(style_path)