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/blenkernel/intern/scene.c | |
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/blenkernel/intern/scene.c')
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9a7c10d31de..50b90a073f9 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -995,7 +995,7 @@ Scene *BKE_scene_set_name(Main *bmain, const char *name) /* Used by metaballs, return *all* objects (including duplis) existing in the scene (including scene's sets) */ int BKE_scene_base_iter_next( - const EvaluationContext *eval_ctx, SceneBaseIter *iter, + Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob) { bool run_again = true; @@ -1014,7 +1014,9 @@ int BKE_scene_base_iter_next( /* the first base */ if (iter->phase == F_START) { - ViewLayer *view_layer = eval_ctx->view_layer; + ViewLayer *view_layer = (depsgraph) ? + DEG_get_evaluated_view_layer(depsgraph) : + BKE_view_layer_from_scene_get(*scene); *base = view_layer->object_bases.first; if (*base) { *ob = (*base)->object; @@ -1062,12 +1064,12 @@ int BKE_scene_base_iter_next( } else { if (iter->phase != F_DUPLI) { - if ( (*base)->object->transflag & OB_DUPLI) { + if (depsgraph && (*base)->object->transflag & OB_DUPLI) { /* groups cannot be duplicated for mballs yet, * this enters eternal loop because of * makeDispListMBall getting called inside of group_duplilist */ if ((*base)->object->dup_group == NULL) { - iter->duplilist = object_duplilist_ex(eval_ctx, (*scene), (*base)->object, false); + iter->duplilist = object_duplilist_ex(depsgraph, (*scene), (*base)->object, false); iter->dupob = iter->duplilist->first; @@ -1350,7 +1352,7 @@ static bool check_rendered_viewport_visible(Main *bmain) return false; } -/* TODO(campbell): shouldn't we be able to use 'eval_ctx->view_layer' here? +/* TODO(campbell): shouldn't we be able to use 'DEG_get_view_layer' here? * Currently this is NULL on load, so don't. */ static void prepare_mesh_for_viewport_render( Main *bmain, const ViewLayer *view_layer) |