WM: Previous commit broke common-case loading new file

Handle this in the operator
This commit is contained in:
Campbell Barton 2017-03-31 23:42:44 +11:00
parent 7f7c807a92
commit ff693959d8

@ -708,18 +708,11 @@ int wm_homefile_read(
/* load preferences before startup.blend */
if (!use_factory_settings && BLI_exists(filepath_userdef)) {
/* keep existing app-template for regular file-new */
char app_template_buf[sizeof(U.app_template)] = "";
BLI_strncpy(app_template_buf, U.app_template, sizeof(app_template_buf));
UserDef *userdef = BKE_blendfile_userdef_read(filepath_userdef, NULL);
if (userdef != NULL) {
BKE_blender_userdef_set_data(userdef);
MEM_freeN(userdef);
BLI_strncpy(U.app_template, app_template_buf, sizeof(app_template_buf));
read_userdef_from_memory = false;
skip_flags |= BLO_READ_SKIP_USERDEF;
printf("Read prefs: %s\n", filepath_userdef);
@ -1569,6 +1562,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;
}
else if (!use_factory_settings) {
/* TODO: dont reset prefs on 'New File' */
BLI_strncpy(app_template_buf, U.app_template, sizeof(app_template_buf));
app_template = app_template_buf;
}
else {
app_template = NULL;
}