diff options
-rw-r--r-- | source/blender/blenkernel/BKE_layer.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 14 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc | 6 |
3 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 7542e9da2d5..9c06ae4f40d 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -173,6 +173,10 @@ void BKE_layer_eval_view_layer(const struct EvaluationContext *eval_ctx, struct ID *owner_id, struct ViewLayer *view_layer); +void BKE_layer_eval_view_layer_indexed(const struct EvaluationContext *eval_ctx, + struct ID *owner_id, + int view_layer_index); + /* iterators */ void BKE_selected_objects_iterator_begin(BLI_Iterator *iter, void *data_in); diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 8e53dea0c24..4d3b4e43043 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -2385,7 +2385,7 @@ static void layer_eval_collections_recurse(const EvaluationContext *eval_ctx, void BKE_layer_eval_view_layer(const struct EvaluationContext *eval_ctx, struct ID *owner_id, - struct ViewLayer *view_layer) + ViewLayer *view_layer) { layer_eval_layer_collection_pre(owner_id, view_layer); layer_eval_collections_recurse(eval_ctx, @@ -2394,6 +2394,18 @@ void BKE_layer_eval_view_layer(const struct EvaluationContext *eval_ctx, layer_eval_layer_collection_post(view_layer); } +void BKE_layer_eval_view_layer_indexed(const struct EvaluationContext *eval_ctx, + struct ID *owner_id, + int view_layer_index) +{ + BLI_assert(GS(owner_id->name) == ID_SCE); + BLI_assert(view_layer_index >= 0); + Scene *scene = (Scene *)owner_id; + ViewLayer *view_layer = BLI_findlink(&scene->view_layers, view_layer_index); + BLI_assert(view_layer != NULL); + BKE_layer_eval_view_layer(eval_ctx, owner_id, view_layer); +} + /** * Free any static allocated memory. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index 77f5283e0f0..cd9db616bdd 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -157,12 +157,14 @@ void DepsgraphNodeBuilder::build_view_layer( build_movieclip(clip); } /* Collections. */ + int view_layer_index = BLI_findindex(&scene->view_layers, view_layer); + BLI_assert(view_layer_index != -1); add_operation_node(&scene->id, DEG_NODE_TYPE_LAYER_COLLECTIONS, - function_bind(BKE_layer_eval_view_layer, + function_bind(BKE_layer_eval_view_layer_indexed, _1, &scene_cow->id, - view_layer_cow), + view_layer_index), DEG_OPCODE_VIEW_LAYER_EVAL); /* Parameters evaluation for scene relations mainly. */ add_operation_node(&scene->id, |