Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-02-02 06:01:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-02 06:01:48 +0300
commitd46c910b1a105287bccccd651056a9a0a73b3936 (patch)
tree1058930380845d6c6008eab3f639529a405cc8d3
parentafcbf7cf1357723f59eca8e118a0ca9ef6cf6555 (diff)
Cleanup: match logic for merging G.f & G.fileflags on load
-rw-r--r--source/blender/blenkernel/BKE_global.h8
-rw-r--r--source/blender/blenkernel/intern/blendfile.c6
-rw-r--r--source/blender/blenloader/intern/writefile.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files.c8
4 files changed, 15 insertions, 9 deletions
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);
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 526f9a7390e..df5713f3282 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3782,7 +3782,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.cur_view_layer = view_layer;
/* prevent to save this, is not good convention, and feature with concerns... */
- fg.fileflags = (fileflags & ~G_FILE_FLAGS_RUNTIME);
+ fg.fileflags = (fileflags & ~G_FILE_FLAG_ALL_RUNTIME);
fg.globalf = G.f;
BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 3a5def1df28..224a4cd597e 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -586,7 +586,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* we didn't succeed, now try to read Blender file */
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
- int G_f = G.f;
+ const int G_f_orig = G.f;
ListBase wmbase;
/* put aside screens to match with persistent windows later */
@@ -614,9 +614,9 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* this flag is initialized by the operator but overwritten on read.
* need to re-enable it here else drivers + registered scripts wont work. */
- if (G.f != G_f) {
- const int flags_keep = (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF);
- G.f = (G.f & ~flags_keep) | (G_f & flags_keep);
+ if (G.f != G_f_orig) {
+ const int flags_keep = G_FLAG_ALL_RUNTIME;
+ G.f = (G.f & ~flags_keep) | (G_f_orig & flags_keep);
}
/* match the read WM with current WM */