Depsgraph: pass depsgraph to editors update context struct

This way callbacks will know which depsgraph is being changed, and where
evaluated data is coming from.
This commit is contained in:
2018-01-16 15:37:52 +01:00
parent 263f614932
commit 1e0283828f
5 changed files with 10 additions and 2 deletions

View File

@@ -1435,7 +1435,7 @@ void BKE_scene_graph_update_tagged(EvaluationContext *eval_ctx,
/* Update sound system animation (TODO, move to depsgraph). */
BKE_sound_update_scene(bmain, scene);
/* Inform editors about possible changes. */
DEG_ids_check_recalc(bmain, scene, view_layer, false);
DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, false);
/* Clear recalc flags. */
DEG_ids_clear_recalc(bmain);
}
@@ -1482,7 +1482,7 @@ void BKE_scene_graph_update_for_newframe(EvaluationContext *eval_ctx,
/* Notify editors and python about recalc. */
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_FRAME_CHANGE_POST);
/* Inform editors about possible changes. */
DEG_ids_check_recalc(bmain, scene, view_layer, true);
DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, true);
/* clear recalc flags */
DEG_ids_clear_recalc(bmain);
}

View File

@@ -194,6 +194,7 @@ void DEG_graph_flush_update(struct Main *bmain, Depsgraph *depsgraph);
* editors about this.
*/
void DEG_ids_check_recalc(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct ViewLayer *view_layer,
bool time);
@@ -248,6 +249,7 @@ bool DEG_needs_eval(Depsgraph *graph);
typedef struct DEGEditorUpdateContext {
struct Main *bmain;
struct Depsgraph *depsgraph;
struct Scene *scene;
struct ViewLayer *view_layer;
} DEGEditorUpdateContext;

View File

@@ -239,6 +239,7 @@ void depsgraph_update_editors_tag(Main *bmain, Depsgraph *graph, ID *id)
/* TODO(sergey): Make sure this works for CoW-ed datablocks as well. */
DEGEditorUpdateContext update_ctx = {NULL};
update_ctx.bmain = bmain;
update_ctx.depsgraph = (::Depsgraph *)graph;
update_ctx.scene = graph->scene;
update_ctx.view_layer = graph->view_layer;
deg_editors_id_update(&update_ctx, id);
@@ -454,6 +455,7 @@ void DEG_on_visible_update(Main *bmain, const bool UNUSED(do_time))
* editors about this.
*/
void DEG_ids_check_recalc(Main *bmain,
Depsgraph *depsgraph,
Scene *scene,
ViewLayer *view_layer,
bool time)
@@ -476,6 +478,7 @@ void DEG_ids_check_recalc(Main *bmain,
DEGEditorUpdateContext update_ctx = {NULL};
update_ctx.bmain = bmain;
update_ctx.depsgraph = depsgraph;
update_ctx.scene = scene;
update_ctx.view_layer = view_layer;
DEG::deg_editors_scene_update(&update_ctx, (updated || time));

View File

@@ -268,6 +268,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
/* Prepare update context for editors. */
DEGEditorUpdateContext update_ctx;
update_ctx.bmain = bmain;
update_ctx.depsgraph = (::Depsgraph *)graph;
update_ctx.scene = graph->scene;
update_ctx.view_layer = graph->view_layer;
/* Do actual flush. */

View File

@@ -202,6 +202,8 @@ void ED_render_engine_changed(Main *bmain)
for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
update_ctx.scene = scene;
LINKLIST_FOREACH(ViewLayer *, view_layer, &scene->view_layers) {
/* TDODO(sergey): Iterate over depsgraphs instead? */
update_ctx.depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
update_ctx.view_layer = view_layer;
ED_render_id_flush_update(&update_ctx, &scene->id);
}