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>2019-05-13 06:25:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-13 06:25:51 +0300
commita279bbbee56ff941ab4ffc263027a7e154703e93 (patch)
tree793a9acfaea723347f2e447dac91d3ca4224b30d
parentac94c219aea80cb1eb494d03d42762ca5db931f3 (diff)
Preferences: support loading factory preferences
Previously it was only possible to load factory startup & preferences.
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py1
-rw-r--r--source/blender/blenkernel/intern/blendfile.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c11
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c1
-rw-r--r--source/blender/windowmanager/wm_files.h1
5 files changed, 16 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 204afca67bb..020dca91f07 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -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.
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index 160ac36fb61..570c1b9bd4c 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -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);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 66406d95d75..0dc144ff0d7 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -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();
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 964e35f8584..98b79fc75ce 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -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);
diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h
index 388c9182f59..24209504a07 100644
--- a/source/blender/windowmanager/wm_files.h
+++ b/source/blender/windowmanager/wm_files.h
@@ -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);