diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-06 12:21:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-13 15:17:37 +0300 |
commit | a1e2415ed51e2da97e3b182f18f462345a02ce14 (patch) | |
tree | 59d54c64e1e19bde4aab0d79aa2a51a66dabc877 /source/blender/depsgraph/intern | |
parent | eec5d3a8a8a26256fbae39d4f1fb01de6a648eea (diff) |
Depsgraph: don't pass evaluation context to update functions.
The depsgraph now contains all the state needed to evaluate it.
Differential Revision: https://developer.blender.org/D3147
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_eval.cc | 10 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval.cc | 14 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval.h | 3 |
3 files changed, 12 insertions, 15 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc index 434c3ec7545..ac92d440bbe 100644 --- a/source/blender/depsgraph/intern/depsgraph_eval.cc +++ b/source/blender/depsgraph/intern/depsgraph_eval.cc @@ -126,20 +126,18 @@ void DEG_evaluation_context_free(EvaluationContext *eval_ctx) } /* Evaluate all nodes tagged for updating. */ -void DEG_evaluate_on_refresh(EvaluationContext *eval_ctx, - Depsgraph *graph) +void DEG_evaluate_on_refresh(Depsgraph *graph) { DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph); deg_graph->ctime = BKE_scene_frame_get(deg_graph->scene); /* Update time on primary timesource. */ DEG::TimeSourceDepsNode *tsrc = deg_graph->find_time_source(); tsrc->cfra = deg_graph->ctime; - DEG::deg_evaluate_on_refresh(eval_ctx, deg_graph); + DEG::deg_evaluate_on_refresh(deg_graph); } /* Frame-change happened for root scene that graph belongs to. */ -void DEG_evaluate_on_framechange(EvaluationContext *eval_ctx, - Main *bmain, +void DEG_evaluate_on_framechange(Main *bmain, Depsgraph *graph, float ctime) { @@ -151,7 +149,7 @@ void DEG_evaluate_on_framechange(EvaluationContext *eval_ctx, tsrc->tag_update(deg_graph); DEG::deg_graph_flush_updates(bmain, deg_graph); /* Perform recalculation updates. */ - DEG::deg_evaluate_on_refresh(eval_ctx, deg_graph); + DEG::deg_evaluate_on_refresh(deg_graph); } bool DEG_needs_eval(Depsgraph *graph) diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 1355e68097b..d40e3e85979 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -227,23 +227,23 @@ static void schedule_children(TaskPool *pool, * * \note Time sources should be all valid! */ -void deg_evaluate_on_refresh(EvaluationContext *eval_ctx, - Depsgraph *graph) +void deg_evaluate_on_refresh(Depsgraph *graph) { /* Set time for the current graph evaluation context. */ TimeSourceDepsNode *time_src = graph->find_time_source(); - eval_ctx->ctime = time_src->cfra; - eval_ctx->depsgraph = (::Depsgraph *)graph; - eval_ctx->view_layer = DEG_get_evaluated_view_layer((::Depsgraph *)graph); /* Nothing to update, early out. */ if (BLI_gset_len(graph->entry_tags) == 0) { return; } const bool do_time_debug = ((G.debug & G_DEBUG_DEPSGRAPH_TIME) != 0); const double start_time = do_time_debug ? PIL_check_seconds_timer() : 0; - /* Set up evaluation context for depsgraph itself. */ + /* Set up evaluation context. */ + EvaluationContext eval_ctx; + DEG_evaluation_context_init_from_depsgraph(&eval_ctx, (::Depsgraph*)graph, graph->mode); + eval_ctx.ctime = time_src->cfra; + /* Set up evaluation state. */ DepsgraphEvalState state; - state.eval_ctx = eval_ctx; + state.eval_ctx = &eval_ctx; state.graph = graph; state.do_stats = do_time_debug; /* Set up task scheduler and pull for threaded evaluation. */ diff --git a/source/blender/depsgraph/intern/eval/deg_eval.h b/source/blender/depsgraph/intern/eval/deg_eval.h index 576ab89dec1..0fb60e8f779 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.h +++ b/source/blender/depsgraph/intern/eval/deg_eval.h @@ -45,7 +45,6 @@ struct Depsgraph; * * \note Time sources should be all valid! */ -void deg_evaluate_on_refresh(EvaluationContext *eval_ctx, - Depsgraph *graph); +void deg_evaluate_on_refresh(Depsgraph *graph); } // namespace DEG |