mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 01:30:01 +00:00
Implement user interface customization features and enhance metadata handling
This commit is contained in:
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user