diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-06 13:07:27 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-16 20:55:33 +0300 |
commit | 34ab90f546f097cada951b2c9ca22bf271996980 (patch) | |
tree | ebcdb3d37120ac1d8fb16462b9104badd1800329 /source/blender/depsgraph/intern/eval/deg_eval.cc | |
parent | 0c495005dd83913864acb510c1d4194a2275dbb0 (diff) |
Depsgraph: remove EvaluationContext, pass Depsgraph instead.
The depsgraph was always created within a fixed evaluation context. Passing
both risks the depsgraph and evaluation context not matching, and it
complicates the Python API where we'd have to expose both which is not so
easy to understand.
This also removes the global evaluation context in main, which assumed there
to be a single active scene and view layer.
Differential Revision: https://developer.blender.org/D3152
Diffstat (limited to 'source/blender/depsgraph/intern/eval/deg_eval.cc')
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index d40e3e85979..4dd3842070e 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -69,7 +69,6 @@ static void schedule_children(TaskPool *pool, const int thread_id); struct DepsgraphEvalState { - EvaluationContext *eval_ctx; Depsgraph *graph; bool do_stats; }; @@ -86,11 +85,11 @@ static void deg_task_run_func(TaskPool *pool, /* Perform operation. */ if (state->do_stats) { const double start_time = PIL_check_seconds_timer(); - node->evaluate(state->eval_ctx); + node->evaluate((::Depsgraph*)state->graph); node->stats.current_time += PIL_check_seconds_timer() - start_time; } else { - node->evaluate(state->eval_ctx); + node->evaluate((::Depsgraph*)state->graph); } /* Schedule children. */ BLI_task_pool_delayed_push_begin(pool, thread_id); @@ -229,21 +228,20 @@ static void schedule_children(TaskPool *pool, */ void deg_evaluate_on_refresh(Depsgraph *graph) { - /* Set time for the current graph evaluation context. */ - TimeSourceDepsNode *time_src = graph->find_time_source(); /* 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. */ - EvaluationContext eval_ctx; - DEG_evaluation_context_init_from_depsgraph(&eval_ctx, (::Depsgraph*)graph, graph->mode); - eval_ctx.ctime = time_src->cfra; + + /* TODO: Calling this forces the scene datablock to be expanded, + * otherwise we get crashes on load with copy-on-write. There may + * be a better solution for this. */ + DEG_get_evaluated_view_layer((const ::Depsgraph*)graph); + /* Set up evaluation state. */ DepsgraphEvalState state; - state.eval_ctx = &eval_ctx; state.graph = graph; state.do_stats = do_time_debug; /* Set up task scheduler and pull for threaded evaluation. */ |