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>2020-06-03 05:45:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-03 07:46:52 +0300
commit45b5f4e3dff759100f3eb6155b3eb9261f1fb2f6 (patch)
tree6be0ea326f0e232eb9d3ba223d56d4b170fcec3b /source/blender/windowmanager/intern/wm_files.c
parenta5e9f024f21c76fd53c4734f287f043c3bc0beca (diff)
Cleanup: minor changes to wm_homefile_read
Move app_template assignment to the top of the function, this simplifies further changes.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index cc81e4f2715..c0a1dc33dfd 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -510,12 +510,16 @@ static void wm_file_read_post(bContext *C,
if (is_startup_file) {
/* possible python hasn't been initialized */
if (CTX_py_init_get(C)) {
- if (reset_app_template) {
+ bool reset_all = use_userdef;
+ if (use_userdef || reset_app_template) {
/* Only run when we have a template path found. */
if (BKE_appdir_app_template_any()) {
BPY_execute_string(
C, (const char *[]){"bl_app_template_utils", NULL}, "bl_app_template_utils.reset()");
+ reset_all = true;
}
+ }
+ if (reset_all) {
/* sync addons, these may have changed from the defaults */
BPY_execute_string(C, (const char *[]){"addon_utils", NULL}, "addon_utils.reset_all()");
}
@@ -802,6 +806,23 @@ void wm_homefile_read(bContext *C,
* or use app-template startup.blend which the user hasn't saved. */
bool is_factory_startup = true;
+ const char *app_template = NULL;
+ bool update_defaults = false;
+
+ if (filepath_startup_override != NULL) {
+ /* pass */
+ }
+ else if (app_template_override) {
+ /* This may be clearing the current template by setting to an empty string. */
+ app_template = app_template_override;
+ }
+ else if (!use_factory_settings && U.app_template[0]) {
+ app_template = U.app_template;
+ }
+
+ const bool reset_app_template = ((!app_template && U.app_template[0]) ||
+ (app_template && !STREQ(app_template, U.app_template)));
+
/* options exclude eachother */
BLI_assert((use_factory_settings && filepath_startup_override) == 0);
@@ -861,28 +882,6 @@ void wm_homefile_read(bContext *C,
}
}
- const char *app_template = NULL;
- bool update_defaults = false;
- bool reset_app_template = false;
-
- if (filepath_startup_override != NULL) {
- /* pass */
- }
- else if (app_template_override) {
- /* This may be clearing the current template by setting to an empty string. */
- app_template = app_template_override;
- }
- else if (!use_factory_settings && U.app_template[0]) {
- app_template = U.app_template;
- }
-
- if ((!app_template && U.app_template[0]) ||
- (app_template && !STREQ(app_template, U.app_template))) {
- /* Always load UI when switching to another template. */
- G.fileflags &= ~G_FILE_NO_UI;
- reset_app_template = true;
- }
-
if ((app_template != NULL) && (app_template[0] != '\0')) {
if (!BKE_appdir_app_template_id_search(
app_template, app_template_system, sizeof(app_template_system))) {
@@ -1028,6 +1027,11 @@ void wm_homefile_read(bContext *C,
* 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;
+
+ if (reset_app_template) {
+ /* Always load UI when switching to another template. */
+ G.fileflags &= ~G_FILE_NO_UI;
+ }
}
bmain = CTX_data_main(C);
@@ -1035,7 +1039,6 @@ void wm_homefile_read(bContext *C,
if (use_userdef) {
/* check userdef before open window, keymaps etc */
wm_init_userdef(bmain);
- reset_app_template = true;
}
if (use_data) {