From d46c910b1a105287bccccd651056a9a0a73b3936 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 2 Feb 2019 14:01:48 +1100 Subject: Cleanup: match logic for merging G.f & G.fileflags on load --- source/blender/blenkernel/BKE_global.h | 8 +++++++- source/blender/blenkernel/intern/blendfile.c | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 75eb5a327de..17baab1f579 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -116,6 +116,10 @@ enum { G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET = (1 << 16), }; +/** Don't overwrite these flags when reading a file. */ +#define G_FLAG_ALL_RUNTIME \ + (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF) + /** #Global.debug */ enum { G_DEBUG = (1 << 0), /* general debug flag, print more info in unexpected cases */ @@ -173,7 +177,9 @@ enum { /* #define G_FILE_GLSL_NO_ENV_LIGHTING (1 << 28) */ /* deprecated */ }; -#define G_FILE_FLAGS_RUNTIME (G_FILE_NO_UI | G_FILE_RELATIVE_REMAP | G_FILE_SAVE_COPY) +/** Don't overwrite these flags when reading a file. */ +#define G_FILE_FLAG_ALL_RUNTIME \ + (G_FILE_NO_UI | G_FILE_RELATIVE_REMAP | G_FILE_SAVE_COPY) /** ENDIAN_ORDER: indicates what endianness the platform where the file was written had. */ #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 164b0a2bd30..075d05eebe8 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -270,8 +270,8 @@ static void setup_app_data( } /* Keep state from preferences. */ - const int fileflags_skip = G_FILE_FLAGS_RUNTIME; - G.fileflags = (G.fileflags & fileflags_skip) | (bfd->fileflags & ~fileflags_skip); + const int fileflags_keep = G_FILE_FLAG_ALL_RUNTIME; + G.fileflags = (G.fileflags & fileflags_keep) | (bfd->fileflags & ~fileflags_keep); /* this can happen when active scene was lib-linked, and doesn't exist anymore */ if (CTX_data_scene(C) == NULL) { @@ -291,7 +291,7 @@ static void setup_app_data( /* special cases, override loaded flags: */ if (G.f != bfd->globalf) { - const int flags_keep = (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF); + const int flags_keep = G_FLAG_ALL_RUNTIME; bfd->globalf = (bfd->globalf & ~flags_keep) | (G.f & flags_keep); } -- cgit v1.2.3