Implement user interface customization features and enhance metadata handling

This commit is contained in:
falken10vdl
2025-12-11 14:34:42 +01:00
parent 888ab85548
commit 76b6f6b16b
4 changed files with 48 additions and 23 deletions
@@ -1056,6 +1056,18 @@ class LoadProject(bpy.types.Operator, IFCFileSelector, ImportHelper):
return tooltip
def execute(self, context):
if (tool.Blender.get_addon_preferences().user_ui_customization
and self.should_start_fresh_session
and not self.is_advanced):
filepath = self.get_filepath()
metadata_path = Path(str(filepath) + ".metadata.blend")
if metadata_path.exists() and metadata_path.is_file():
try:
bpy.ops.bim.load_blend_metadata_and_ifc(filepath=filepath)
return {"FINISHED"}
except Exception as e:
self.report({"WARNING"}, f"Failed to load metadata file, using regular load: {e}")
@persistent
def load_handler(*args):
bpy.app.handlers.load_post.remove(load_handler)
@@ -1748,6 +1760,13 @@ class ExportIFC(bpy.types.Operator, ExportHelper):
if save_blend_file:
bpy.ops.wm.save_mainfile(filepath=bpy.data.filepath)
bim_props.is_dirty = False
if tool.Blender.get_addon_preferences().user_ui_customization:
try:
bpy.ops.bim.save_blend_metadata_file()
except Exception as e:
settings.logger.warning(f"Failed to save blend metadata file: {e}")
bonsai.bim.handler.refresh_ui_data()
self.report(
{"INFO"},