Less console errors if failed to find external styles library

Now:
```
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
```

Before:
```
File "\blenderbim\bim\module\style\prop.py", line 250, in update_shading_style
Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
Traceback (most recent call last):
  File "\blenderbim\bim\module\style\prop.py", line 255, in update_shading_style
    bpy.ops.bim.activate_external_style(material_name=blender_material.name)
  File "L:\Games\SteamLibrary\steamapps\common\Blender\4.0\scripts\modules\bpy\ops.py", line 109, in __call__
    ret = _op_call(self.idname_py(), kw)
RuntimeError: Error: Error loading external style - cannot find file: 'D:\Dropbox\GitHub\OD_Textures\Closed (Encrypted)\Materials.blend'
```
This commit is contained in:
Andrej730
2023-12-19 11:09:23 +05:00
parent 96db699ad2
commit 289b2d1e9d
@@ -252,7 +252,12 @@ def update_shading_style(self, context):
style_elements = tool.Style.get_style_elements(blender_material)
if self.active_style_type == "External":
if tool.Style.has_blender_external_style(style_elements):
bpy.ops.bim.activate_external_style(material_name=blender_material.name)
try:
bpy.ops.bim.activate_external_style(material_name=blender_material.name)
except RuntimeError as error:
if str(error).startswith("Error: Error loading external style - "):
return
raise error
elif self.active_style_type == "Shading":
style_elements = tool.Style.get_style_elements(blender_material)