Revert "Fix T67577: Add-on unregister can't access preferences on factory reset"
This reverts commit f18ed7ad89.
Better leave the fix for 2.9 series.
This commit is contained in:
@@ -516,13 +516,9 @@ static void wm_file_read_post(bContext *C,
|
|||||||
BPY_execute_string(
|
BPY_execute_string(
|
||||||
C, (const char *[]){"bl_app_template_utils", NULL}, "bl_app_template_utils.reset()");
|
C, (const char *[]){"bl_app_template_utils", NULL}, "bl_app_template_utils.reset()");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (use_userdef) {
|
|
||||||
/* sync addons, these may have changed from the defaults */
|
/* sync addons, these may have changed from the defaults */
|
||||||
BPY_execute_string(C, (const char *[]){"addon_utils", NULL}, "addon_utils.reset_all()");
|
BPY_execute_string(C, (const char *[]){"addon_utils", NULL}, "addon_utils.reset_all()");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_data) {
|
if (use_data) {
|
||||||
BPY_python_reset(C);
|
BPY_python_reset(C);
|
||||||
}
|
}
|
||||||
@@ -771,9 +767,9 @@ const char *WM_init_state_app_template_get(void)
|
|||||||
void wm_homefile_read(bContext *C,
|
void wm_homefile_read(bContext *C,
|
||||||
ReportList *reports,
|
ReportList *reports,
|
||||||
bool use_factory_settings,
|
bool use_factory_settings,
|
||||||
const bool use_empty_data,
|
bool use_empty_data,
|
||||||
const bool use_data,
|
bool use_data,
|
||||||
const bool use_userdef,
|
bool use_userdef,
|
||||||
const char *filepath_startup_override,
|
const char *filepath_startup_override,
|
||||||
const char *app_template_override,
|
const char *app_template_override,
|
||||||
bool *r_is_factory_startup)
|
bool *r_is_factory_startup)
|
||||||
@@ -813,20 +809,6 @@ void wm_homefile_read(bContext *C,
|
|||||||
SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC);
|
SET_FLAG_FROM_TEST(G.f, (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0, G_FLAG_SCRIPT_AUTOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_userdef) {
|
|
||||||
#ifdef WITH_PYTHON
|
|
||||||
/* This only runs once Blender has already started. */
|
|
||||||
if (CTX_py_init_get(C)) {
|
|
||||||
/* This is restored by 'wm_file_read_post', disable before loading any preferences
|
|
||||||
* so an add-on can read their own preferences when un-registering, see T67577.
|
|
||||||
*
|
|
||||||
* Note that this would fit into a matching 'wm_file_read_pre' function,
|
|
||||||
* but this gets complicated by blend files not always loading, call inline instead. */
|
|
||||||
BPY_execute_string(C, (const char *[]){"addon_utils", NULL}, "addon_utils.disable_all()");
|
|
||||||
}
|
|
||||||
#endif /* WITH_PYTHON */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (use_data) {
|
if (use_data) {
|
||||||
BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE);
|
BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE);
|
||||||
BLI_timer_on_file_load();
|
BLI_timer_on_file_load();
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ void wm_history_file_read(void);
|
|||||||
void wm_homefile_read(struct bContext *C,
|
void wm_homefile_read(struct bContext *C,
|
||||||
struct ReportList *reports,
|
struct ReportList *reports,
|
||||||
bool use_factory_settings,
|
bool use_factory_settings,
|
||||||
const bool use_empty_data,
|
bool use_empty_data,
|
||||||
const bool use_data,
|
bool use_data,
|
||||||
const bool use_userdef,
|
bool use_userdef,
|
||||||
const char *filepath_startup_override,
|
const char *filepath_startup_override,
|
||||||
const char *app_template_override,
|
const char *app_template_override,
|
||||||
bool *r_is_factory_startup);
|
bool *r_is_factory_startup);
|
||||||
|
|||||||
Reference in New Issue
Block a user