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/blenkernel/intern/scene.c | |
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/blenkernel/intern/scene.c')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index aa812dff877..cd10713897a 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1309,7 +1309,7 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on bool run_callbacks = DEG_id_type_any_updated(depsgraph); if (run_callbacks) { - BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_DEPSGRAPH_UPDATE_PRE); + BKE_callback_exec_id(bmain, &scene->id, BKE_CB_EVT_DEPSGRAPH_UPDATE_PRE); } for (int pass = 0; pass < 2; pass++) { @@ -1327,7 +1327,8 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on BKE_scene_update_sound(depsgraph, bmain); /* Notify python about depsgraph update. */ if (run_callbacks) { - BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_DEPSGRAPH_UPDATE_POST); + BKE_callback_exec_id_depsgraph( + bmain, &scene->id, depsgraph, BKE_CB_EVT_DEPSGRAPH_UPDATE_POST); } /* Inform editors about possible changes. */ DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, false); @@ -1362,7 +1363,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain) ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); /* Keep this first. */ - BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_FRAME_CHANGE_PRE); + BKE_callback_exec_id(bmain, &scene->id, BKE_CB_EVT_FRAME_CHANGE_PRE); for (int pass = 0; pass < 2; pass++) { /* Update animated image textures for particles, modifiers, gpu, etc, @@ -1384,7 +1385,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain) /* Notify editors and python about recalc. */ if (pass == 0) { - BKE_callback_exec(bmain, &scene->id, BKE_CB_EVT_FRAME_CHANGE_POST); + BKE_callback_exec_id_depsgraph(bmain, &scene->id, depsgraph, BKE_CB_EVT_FRAME_CHANGE_POST); } /* Inform editors about possible changes. */ |