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-22 07:28:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-22 07:28:10 +0300
commitb79ff12e11ebac06317d4e10df34318d415d4dc7 (patch)
treed9d595c023bcb0affc0703269aa7503c44722319 /source/blender
parentfc0312f538acc6411965cb664f8a5744d274e188 (diff)
Preferences: add handler for loading factory preferences
Allows app-templates to define their own adjustments to preferences. This matches `load_factory_startup_post`, use when loading preferences.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/BLI_callbacks.h1
-rw-r--r--source/blender/python/intern/bpy_app_handlers.c1
-rw-r--r--source/blender/windowmanager/intern/wm_files.c14
3 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
index ed8af49d640..4d9fc66a806 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenlib/BLI_callbacks.h
@@ -52,6 +52,7 @@ typedef enum {
BLI_CB_EVT_DEPSGRAPH_UPDATE_PRE,
BLI_CB_EVT_DEPSGRAPH_UPDATE_POST,
BLI_CB_EVT_VERSION_UPDATE,
+ BLI_CB_EVT_LOAD_FACTORY_USERDEF_POST,
BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST,
BLI_CB_EVT_TOT,
} eCbEvent;
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 7134bf520ac..dde3d026d47 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -61,6 +61,7 @@ static PyStructSequence_Field app_cb_info_fields[] = {
{(char *)"depsgraph_update_pre", (char *)"on depsgraph update (pre)"},
{(char *)"depsgraph_update_post", (char *)"on depsgraph update (post)"},
{(char *)"version_update", (char *)"on ending the versioning code"},
+ {(char *)"load_factory_preferences_post", (char *)"on loading factory preferences (after)"},
{(char *)"load_factory_startup_post", (char *)"on loading factory startup (after)"},
/* sets the permanent tag */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 529492470f7..097db49aea6 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -491,7 +491,7 @@ static void wm_file_read_post(bContext *C,
const bool is_startup_file,
const bool is_factory_startup,
const bool use_data,
- const bool UNUSED(use_userdef),
+ const bool use_userdef,
const bool reset_app_template)
{
bool addons_loaded = false;
@@ -537,15 +537,23 @@ static void wm_file_read_post(bContext *C,
Main *bmain = CTX_data_main(C);
- if (use_data) {
- WM_operatortype_last_properties_clear_all();
+ if (use_userdef) {
+ if (is_factory_startup) {
+ BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_USERDEF_POST);
+ }
+ }
+ if (use_data) {
/* important to do before NULL'ing the context */
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_VERSION_UPDATE);
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_POST);
if (is_factory_startup) {
BLI_callback_exec(bmain, NULL, BLI_CB_EVT_LOAD_FACTORY_STARTUP_POST);
}
+ }
+
+ if (use_data) {
+ WM_operatortype_last_properties_clear_all();
/* After load post, so for example the driver namespace can be filled
* before evaluating the depsgraph. */