Fix T56895: crash loading template with Load UI unchecked.

This commit is contained in:
Brecht Van Lommel 2018-09-24 15:41:12 +02:00
parent 8f51308dba
commit 8dfdd248b5
Notes: blender-bot 2023-09-08 04:55:43 +02:00
Referenced by issue #56895, Blender Crashes while changing Workspace Template after Load UI unchecked
2 changed files with 12 additions and 4 deletions

View File

@ -438,13 +438,16 @@ void BKE_view_layer_rename(Main *bmain, Scene *scene, ViewLayer *view_layer, con
}
}
/* fix all the animation data and windows which may link to this */
/* Fix all the animation data and windows which may link to this. */
BKE_animdata_fix_paths_rename_all(NULL, "view_layers", oldname, view_layer->name);
/* WM can be missing on startup. */
wmWindowManager *wm = bmain->wm.first;
for (wmWindow *win = wm->windows.first; win; win = win->next) {
if (win->scene == scene && STREQ(win->view_layer_name, oldname)) {
STRNCPY(win->view_layer_name, view_layer->name);
if (wm) {
for (wmWindow *win = wm->windows.first; win; win = win->next) {
if (win->scene == scene && STREQ(win->view_layer_name, oldname)) {
STRNCPY(win->view_layer_name, view_layer->name);
}
}
}

View File

@ -1689,6 +1689,11 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op)
RNA_property_string_get(op->ptr, prop_app_template, app_template_buf);
app_template = app_template_buf;
if (!STREQ(app_template, U.app_template)) {
/* Always load UI when switching to another template. */
G.fileflags &= ~G_FILE_NO_UI;
}
/* Always load preferences when switching templates with own preferences. */
use_userdef = wm_app_template_has_userpref(app_template) ||
wm_app_template_has_userpref(U.app_template);