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>2017-03-15 19:54:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-03-15 20:02:24 +0300
commitc832354e330c575a5c450cf0febebb7cc058df87 (patch)
treeab8fa9d05934abf70b06db0839fbea425fd83264 /source/blender/windowmanager
parentc44cdd5905d3112a46a984b8d49710fb1c1546a0 (diff)
Load user-preferences before startup file
Internal change needed for template support. Loading the user preferences first so it's possible for preferences to control startup behavior. In general it's useful to load preferences before data-files, so we know security settings for eg.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 9e1a4e2e73f..71a1d22ac8f 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -554,7 +554,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* confusing this global... */
G.relbase_valid = 1;
- retval = BKE_blendfile_read(C, filepath, reports);
+ retval = BKE_blendfile_read(C, filepath, reports, 0);
/* when loading startup.blend's, we can be left with a blank path */
if (G.main->name[0]) {
G.save_over = 1;
@@ -652,6 +652,7 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
* And in this case versioning code is to be run.
*/
bool read_userdef_from_memory = true;
+ eBLOReadSkip skip_flags = 0;
/* options exclude eachother */
BLI_assert((from_memory && custom_file) == 0);
@@ -691,9 +692,19 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
/* put aside screens to match with persistent windows later */
wm_window_match_init(C, &wmbase);
+ /* load preferences before startup.blend */
+ if (!from_memory && BLI_exists(prefstr)) {
+ int done = BKE_blendfile_read_userdef(prefstr, NULL);
+ if (done != BKE_BLENDFILE_READ_FAIL) {
+ read_userdef_from_memory = false;
+ skip_flags |= BLO_READ_SKIP_USERDEF;
+ printf("Read new prefs: %s\n", prefstr);
+ }
+ }
+
if (!from_memory) {
if (BLI_access(startstr, R_OK) == 0) {
- success = (BKE_blendfile_read(C, startstr, NULL) != BKE_BLENDFILE_READ_FAIL);
+ success = (BKE_blendfile_read(C, startstr, NULL, skip_flags) != BKE_BLENDFILE_READ_FAIL);
}
if (BLI_listbase_is_empty(&U.themes)) {
if (G.debug & G_DEBUG)
@@ -708,7 +719,9 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
}
if (success == 0) {
- success = BKE_blendfile_read_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL, true);
+ success = BKE_blendfile_read_from_memory(
+ C, datatoc_startup_blend, datatoc_startup_blend_size,
+ NULL, skip_flags, true);
if (BLI_listbase_is_empty(&wmbase)) {
wm_clear_default_size(C);
}
@@ -721,15 +734,6 @@ int wm_homefile_read(bContext *C, ReportList *reports, bool from_memory, const c
#endif
}
- /* check new prefs only after startup.blend was finished */
- if (!from_memory && BLI_exists(prefstr)) {
- int done = BKE_blendfile_read_userdef(prefstr, NULL);
- if (done != BKE_BLENDFILE_READ_FAIL) {
- read_userdef_from_memory = false;
- printf("Read new prefs: %s\n", prefstr);
- }
- }
-
/* prevent buggy files that had G_FILE_RELATIVE_REMAP written out by mistake. Screws up autosaves otherwise
* can remove this eventually, only in a 2.53 and older, now its not written */
G.fileflags &= ~G_FILE_RELATIVE_REMAP;