Preferences: support loading factory preferences
Previously it was only possible to load factory startup & preferences.
This commit is contained in:
@@ -84,6 +84,7 @@ class USERPREF_PT_save_preferences(Panel):
|
||||
col = layout.column(align=True)
|
||||
col.operator("wm.save_userpref")
|
||||
col.operator("wm.read_userpref")
|
||||
col.operator("wm.read_factory_userpref")
|
||||
|
||||
|
||||
# Panel mix-in.
|
||||
|
||||
@@ -438,7 +438,9 @@ bool BKE_blendfile_read_from_memory(bContext *C,
|
||||
bfd = BLO_read_from_memory(filebuf, filelength, params->skip_flags, reports);
|
||||
if (bfd) {
|
||||
if (update_defaults) {
|
||||
BLO_update_defaults_startup_blend(bfd->main, NULL);
|
||||
if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
|
||||
BLO_update_defaults_startup_blend(bfd->main, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
setup_app_blend_file_data(C, bfd, "<memory2>", params, reports);
|
||||
|
||||
@@ -1767,7 +1767,7 @@ static int wm_userpref_read_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
const bool use_data = false;
|
||||
const bool use_userdef = true;
|
||||
const bool use_factory_settings = false; /* TODO, support this. */
|
||||
const bool use_factory_settings = STREQ(op->type->idname, "WM_OT_read_factory_userpref");
|
||||
|
||||
UserDef U_backup = U;
|
||||
|
||||
@@ -1810,6 +1810,15 @@ void WM_OT_read_userpref(wmOperatorType *ot)
|
||||
ot->exec = wm_userpref_read_exec;
|
||||
}
|
||||
|
||||
void WM_OT_read_factory_userpref(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Load Factory Preferences";
|
||||
ot->idname = "WM_OT_read_factory_userpref";
|
||||
|
||||
ot->invoke = WM_operator_confirm;
|
||||
ot->exec = wm_userpref_read_exec;
|
||||
}
|
||||
|
||||
static int wm_history_file_read_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
|
||||
{
|
||||
ED_file_read_bookmarks();
|
||||
|
||||
@@ -3505,6 +3505,7 @@ void wm_operatortypes_register(void)
|
||||
WM_operatortype_append(WM_OT_save_homefile);
|
||||
WM_operatortype_append(WM_OT_save_userpref);
|
||||
WM_operatortype_append(WM_OT_read_userpref);
|
||||
WM_operatortype_append(WM_OT_read_factory_userpref);
|
||||
WM_operatortype_append(WM_OT_userpref_autoexec_path_add);
|
||||
WM_operatortype_append(WM_OT_userpref_autoexec_path_remove);
|
||||
WM_operatortype_append(WM_OT_window_fullscreen_toggle);
|
||||
|
||||
@@ -45,6 +45,7 @@ void WM_OT_userpref_autoexec_path_add(struct wmOperatorType *ot);
|
||||
void WM_OT_userpref_autoexec_path_remove(struct wmOperatorType *ot);
|
||||
void WM_OT_save_userpref(struct wmOperatorType *ot);
|
||||
void WM_OT_read_userpref(struct wmOperatorType *ot);
|
||||
void WM_OT_read_factory_userpref(struct wmOperatorType *ot);
|
||||
void WM_OT_read_history(struct wmOperatorType *ot);
|
||||
void WM_OT_read_homefile(struct wmOperatorType *ot);
|
||||
void WM_OT_read_factory_settings(struct wmOperatorType *ot);
|
||||
|
||||
Reference in New Issue
Block a user