diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-09 11:25:04 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-11 11:43:27 +0300 |
commit | a650258158dd7ad8fa9b6cb1b7da749e30ae15c1 (patch) | |
tree | 840b324fbf9739dce8ac50da1acde80e2fb4f140 /source/blender/windowmanager | |
parent | 022de797f1773f512f21cf9038787dd77e0fd5de (diff) |
Python handlers: Pass depsgraph to events where it makes sense
The goal is to make it possible to access evaluated datablocks at a
corresponding context. For example, be able to check evaluated state
if an object used for rendering.
Allows to write scripts in a safe manner for T63548 and T60094.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D5726
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 20 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 6 |
2 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index ae5235c7f58..6a5166d3dec 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -537,16 +537,16 @@ static void wm_file_read_post(bContext *C, if (use_userdef) { if (is_factory_startup) { - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_LOAD_FACTORY_USERDEF_POST); + BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_FACTORY_USERDEF_POST); } } if (use_data) { /* important to do before NULL'ing the context */ - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_VERSION_UPDATE); - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_LOAD_POST); + BKE_callback_exec_null(bmain, BKE_CB_EVT_VERSION_UPDATE); + BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_POST); if (is_factory_startup) { - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST); + BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST); } } @@ -609,7 +609,7 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) WM_cursor_wait(1); - BKE_callback_exec(CTX_data_main(C), NULL, BKE_CB_EVT_LOAD_PRE); + BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE); BLI_timer_on_file_load(); UI_view2d_zoom_cache_reset(); @@ -807,7 +807,7 @@ void wm_homefile_read(bContext *C, } if (use_data) { - BKE_callback_exec(CTX_data_main(C), NULL, BKE_CB_EVT_LOAD_PRE); + BKE_callback_exec_null(CTX_data_main(C), BKE_CB_EVT_LOAD_PRE); BLI_timer_on_file_load(); G.relbase_valid = 0; @@ -1368,7 +1368,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo /* Call pre-save callbacks before writing preview, * that way you can generate custom file thumbnail. */ - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_SAVE_PRE); + BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_PRE); /* Enforce full override check/generation on file save. */ BKE_main_override_library_operations_create(bmain, true); @@ -1421,7 +1421,7 @@ static bool wm_file_write(bContext *C, const char *filepath, int fileflags, Repo wm_history_file_update(); } - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_SAVE_POST); + BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_POST); /* run this function after because the file cant be written before the blend is */ if (ibuf_thumb) { @@ -1646,7 +1646,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_SAVE_PRE); + BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_PRE); /* check current window and close it if temp */ if (win && WM_window_is_temp_screen(win)) { @@ -1674,7 +1674,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) G.save_over = 0; - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_SAVE_POST); + BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_POST); return OPERATOR_FINISHED; } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 517cbbb6212..12f07b8d10e 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -378,10 +378,10 @@ void WM_init(bContext *C, int argc, const char **argv) * note that recovering the last session does its own callbacks. */ CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_VERSION_UPDATE); - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_LOAD_POST); + BKE_callback_exec_null(bmain, BKE_CB_EVT_VERSION_UPDATE); + BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_POST); if (is_factory_startup) { - BKE_callback_exec(bmain, NULL, BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST); + BKE_callback_exec_null(bmain, BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST); } wm_file_read_report(C, bmain); |