mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
log external styles names when they fail to load
This commit is contained in:
@@ -330,16 +330,21 @@ class ActivateExternalStyle(bpy.types.Operator, tool.Ifc.Operator):
|
||||
style_path = Path(tool.Ifc.resolve_uri(external_style.Location))
|
||||
|
||||
if style_path.suffix != ".blend":
|
||||
self.report({"ERROR"}, f"Error loading external style - only Blender external styles are supported")
|
||||
self.report(
|
||||
{"ERROR"},
|
||||
f"Error loading external style for \"{material.name}\" - only Blender external styles are supported",
|
||||
)
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not style_path.exists():
|
||||
self.report({"ERROR"}, f"Error loading external style - cannot find file: '{style_path}'")
|
||||
self.report(
|
||||
{"ERROR"}, f"Error loading external style for \"{material.name}\" - cannot find file: '{style_path}'"
|
||||
)
|
||||
return {"CANCELLED"}
|
||||
|
||||
db = tool.Blender.append_data_block(str(style_path), data_block_type, data_block)
|
||||
if not db["data_block"]:
|
||||
self.report({"ERROR"}, f"Error loading external style - {db['msg']}")
|
||||
self.report({"ERROR"}, f"Error loading external style for \"{material.name}\" - {db['msg']}")
|
||||
return {"CANCELLED"}
|
||||
|
||||
self.copy_material_attributes(db["data_block"], material)
|
||||
|
||||
@@ -259,7 +259,7 @@ def update_shading_style(self, context):
|
||||
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 - "):
|
||||
if str(error).startswith("Error: Error loading external style for "):
|
||||
return
|
||||
raise error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user