From 8cd8b3e9bda443ec8f560117d93a4f06fe91cb11 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Oct 2020 01:02:31 +1000 Subject: readfile: always run setup_app_data after updating defaults When blend files were loaded with app-templates, setup_app_data was running before defaults were updated. This is likely to cause problems with order of initialization so always update the startup file beforehand. --- source/blender/windowmanager/intern/wm_files.c | 40 ++++++++++++-------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_files.c') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 3f58ba9e5a0..44367969ed7 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1034,20 +1034,17 @@ void wm_homefile_read(bContext *C, if (!use_factory_settings || (filepath_startup[0] != '\0')) { if (BLI_access(filepath_startup, R_OK) == 0) { - success = BKE_blendfile_read(C, - filepath_startup, - &(const struct BlendFileReadParams){ - .is_startup = true, - .skip_flags = skip_flags | BLO_READ_SKIP_USERDEF, - }, - NULL); + success = BKE_blendfile_read_ex(C, + filepath_startup, + &(const struct BlendFileReadParams){ + .is_startup = true, + .skip_flags = skip_flags | BLO_READ_SKIP_USERDEF, + }, + NULL, + update_defaults && use_data, + app_template); } if (success) { - if (update_defaults) { - if (use_data) { - BLO_update_defaults_startup_blend(CTX_data_main(C), app_template); - } - } is_factory_startup = filepath_startup_is_factory; } } @@ -1066,15 +1063,16 @@ void wm_homefile_read(bContext *C, } if (success == false) { - success = BKE_blendfile_read_from_memory(C, - datatoc_startup_blend, - datatoc_startup_blend_size, - true, - &(const struct BlendFileReadParams){ - .is_startup = true, - .skip_flags = skip_flags, - }, - NULL); + success = BKE_blendfile_read_from_memory_ex(C, + datatoc_startup_blend, + datatoc_startup_blend_size, + &(const struct BlendFileReadParams){ + .is_startup = true, + .skip_flags = skip_flags, + }, + NULL, + true, + NULL); if (use_data && BLI_listbase_is_empty(&wmbase)) { wm_clear_default_size(C); -- cgit v1.2.3