diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-06-19 08:41:07 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-19 09:47:12 +0300 |
commit | fade37ff07ab3b62844068a1a5d60dd74ea787f6 (patch) | |
tree | a3d8903572491de4e00bbee91c9dbe0877fc10e3 /source/blender/blenkernel/intern/blendfile.c | |
parent | 5a77f643f45bdd52a70aecf7b09d8836d540b5a1 (diff) |
Writefile: move file flags to BlendFileWriteParams
This removes G_FILE_HISTORY, G_FILE_SAVE_COPY & G_FILE_USERPREFS.
Using file-flags made logic harder to follow since it's not so clear
which flags are expected to be in G.fileflags & which are meant to be
set and passed as arguments, these are shared between read & write
functions too.
Add BlendFileWriteParams so options which don't need to be stored
aren't mixed up with flags that are stored for reuse.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile.c')
-rw-r--r-- | source/blender/blenkernel/intern/blendfile.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index a3031e9047f..c6af21c6b4e 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -646,7 +646,13 @@ bool BKE_blendfile_userdef_write(const char *filepath, ReportList *reports) Main *mainb = MEM_callocN(sizeof(Main), "empty main"); bool ok = false; - if (BLO_write_file(mainb, filepath, G_FILE_USERPREFS, reports)) { + if (BLO_write_file(mainb, + filepath, + 0, + &(const struct BlendFileWriteParams){ + .use_userdef = true, + }, + reports)) { ok = true; } @@ -768,7 +774,7 @@ WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepat bool BKE_blendfile_workspace_config_write(Main *bmain, const char *filepath, ReportList *reports) { - int fileflags = G.fileflags & ~(G_FILE_NO_UI | G_FILE_HISTORY); + const int fileflags = G.fileflags & ~G_FILE_NO_UI; bool retval = false; BKE_blendfile_write_partial_begin(bmain); @@ -883,7 +889,13 @@ bool BKE_blendfile_write_partial(Main *bmain_src, } /* save the buffer */ - retval = BLO_write_file_ex(bmain_dst, filepath, write_flags, reports, remap_mode, NULL); + retval = BLO_write_file(bmain_dst, + filepath, + write_flags, + &(const struct BlendFileWriteParams){ + .remap_mode = remap_mode, + }, + reports); if (path_list_backup) { BKE_bpath_list_restore(bmain_dst, path_list_flag, path_list_backup); |