From d399f7c6b7c8d132f272099387ebbe8a0ac76401 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 19 Aug 2024 14:36:07 +0500 Subject: [PATCH] bonsai bcf - add save current project button Now there are two separate buttons - "save project" and "save project as". Example - https://i.imgur.com/1vuVfgi.png --- src/bonsai/bonsai/bim/module/bcf/operator.py | 7 +++++++ src/bonsai/bonsai/bim/module/bcf/ui.py | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/bcf/operator.py b/src/bonsai/bonsai/bim/module/bcf/operator.py index c4a5464ebf..a33fff28b5 100644 --- a/src/bonsai/bonsai/bim/module/bcf/operator.py +++ b/src/bonsai/bonsai/bim/module/bcf/operator.py @@ -332,6 +332,7 @@ class SaveBcfProject(bpy.types.Operator): bl_options = {"REGISTER", "UNDO"} filepath: bpy.props.StringProperty(subtype="FILE_PATH") filter_glob: bpy.props.StringProperty(default="*.bcf;*.bcfzip", options={"HIDDEN"}) + save_current_bcf: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"}) def execute(self, context): bcfxml = bcfstore.BcfStore.get_bcfxml() @@ -341,6 +342,12 @@ class SaveBcfProject(bpy.types.Operator): return {"FINISHED"} def invoke(self, context, event): + if self.save_current_bcf: + path = tool.Bcf.get_path() + if path: + self.filepath = str(path) + return self.execute(context) + context.window_manager.fileselect_add(self) return {"RUNNING_MODAL"} diff --git a/src/bonsai/bonsai/bim/module/bcf/ui.py b/src/bonsai/bonsai/bim/module/bcf/ui.py index 0b081daba7..bf5270765f 100644 --- a/src/bonsai/bonsai/bim/module/bcf/ui.py +++ b/src/bonsai/bonsai/bim/module/bcf/ui.py @@ -47,7 +47,9 @@ class BIM_PT_bcf(Panel): return row = layout.row(align=True) - row.operator("bim.save_bcf_project", icon="EXPORT", text="Save Project") + op = row.operator("bim.save_bcf_project", icon="FILE_TICK", text="Save Current Project") + op.save_current_bcf = True + row.operator("bim.save_bcf_project", icon="EXPORT", text="Save Project As...") row.operator("bim.unload_bcf_project", text="", icon="CANCEL") row = layout.row()