Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-12-08 16:45:15 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-12-08 17:05:38 +0300
commit82c0a5416855b3dc762d3d03bdae637cd7f8dd83 (patch)
treec08ad8e155d9b7cca8f70b95cf21671219a6b530 /source/blender/blenkernel/intern/group.c
parentaf47ae07023f4a5b817bedca82c7b007ddefc8ba (diff)
Depsgraph: Use dedicated function for group evaluation
It is still based on generic collection evaluation, but the idea is to avoid having view_layer pointer passed from group to it's evaluation function. This is essential for copy-on-write, where we need to pass view_layer pointer from a copied datablock, but that copy is not yet available at construction time. Also, this is NOT the case where we want to expand datablock at a construction time, just to keep our life easier.
Diffstat (limited to 'source/blender/blenkernel/intern/group.c')
-rw-r--r--source/blender/blenkernel/intern/group.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 1bc2e951fe7..fbd4f07a93f 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -55,6 +55,8 @@
#include "BKE_object.h"
#include "BKE_scene.h"
+#define DEBUG_PRINT if (G.debug & G_DEBUG_DEPSGRAPH) printf
+
/** Free (or release) any data used by this group (does not free the group itself). */
void BKE_group_free(Group *group)
{
@@ -379,3 +381,36 @@ void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx
FOREACH_GROUP_OBJECT_END
}
}
+
+/* ******** Dependency graph evaluation ******** */
+
+static void group_eval_layer_collections(
+ const struct EvaluationContext *eval_ctx,
+ Group *group,
+ ListBase *layer_collections,
+ LayerCollection *parent_layer_collection)
+{
+ LINKLIST_FOREACH (LayerCollection *, layer_collection, layer_collections) {
+ /* Evaluate layer collection itself. */
+ BKE_layer_eval_layer_collection(eval_ctx,
+ layer_collection,
+ parent_layer_collection);
+ /* Evaluate nested collections. */
+ group_eval_layer_collections(eval_ctx,
+ group,
+ &layer_collection->layer_collections,
+ layer_collection);
+ }
+}
+
+void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx,
+ Group *group)
+{
+ DEBUG_PRINT("%s on %s (%p)\n", __func__, group->id.name, group);
+ BKE_layer_eval_layer_collection_pre(eval_ctx, &group->id, group->view_layer);
+ group_eval_layer_collections(eval_ctx,
+ group,
+ &group->view_layer->layer_collections,
+ NULL);
+ BKE_layer_eval_layer_collection_post(eval_ctx, group->view_layer);
+}