mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +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))
|
style_path = Path(tool.Ifc.resolve_uri(external_style.Location))
|
||||||
|
|
||||||
if style_path.suffix != ".blend":
|
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"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
if not style_path.exists():
|
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"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
db = tool.Blender.append_data_block(str(style_path), data_block_type, data_block)
|
db = tool.Blender.append_data_block(str(style_path), data_block_type, data_block)
|
||||||
if not db["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"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
self.copy_material_attributes(db["data_block"], material)
|
self.copy_material_attributes(db["data_block"], material)
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ def update_shading_style(self, context):
|
|||||||
try:
|
try:
|
||||||
bpy.ops.bim.activate_external_style(material_name=blender_material.name)
|
bpy.ops.bim.activate_external_style(material_name=blender_material.name)
|
||||||
except RuntimeError as error:
|
except RuntimeError as error:
|
||||||
if str(error).startswith("Error: Error loading external style - "):
|
if str(error).startswith("Error: Error loading external style for "):
|
||||||
return
|
return
|
||||||
raise error
|
raise error
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user