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:
authorDalai Felinto <dfelinto@gmail.com>2017-12-15 13:33:25 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-12-15 13:59:04 +0300
commit3a47fb764cdc4731aa3c386cffb08f5146018c4b (patch)
tree2dd43c71b60329860de5191023facd798a13fc18 /source/blender/render
parent1f5106de610b115b87ab6121d7871d447ca48cd2 (diff)
Depsgraph / Render / Collection: Tag groups for rendering
We need to tag groups before and after rendering, so the group collections viewport and render visibility are taken into account. Note: This is a workaround, that will be removed once the render engine have its own depsgraph, instead of re-using the viewport depsgraph.
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/intern/source/pipeline.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 7fdaf38a9ff..999e0f7f70e 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -37,6 +37,7 @@
#include <errno.h>
#include "DNA_anim_types.h"
+#include "DNA_group_types.h"
#include "DNA_image_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
@@ -2113,6 +2114,31 @@ static void tag_dependend_objects_for_render(Scene *scene, int UNUSED(renderlay)
}
#endif
+#define DEPSGRAPH_WORKAROUND_GROUP_HACK
+
+#ifdef DEPSGRAPH_WORKAROUND_GROUP_HACK
+/**
+ * Make sure the COLLECTION_VIEWPORT / COLLECTION_RENDER is considered
+ * for the collections visibility.
+ *
+ * This won't be needed anymore once we have depsgraph per render engine.
+ */
+static void tag_groups_for_render(Render *re)
+{
+ for (Group *group = re->main->group.first; group; group = group->id.next) {
+ DEG_id_tag_update(&group->id, 0);
+ }
+
+#ifdef WITH_FREESTYLE
+ if (re->freestyle_bmain) {
+ for (Group *group = re->freestyle_bmain->group.first; group; group = group->id.next) {
+ DEG_id_tag_update(&group->id, 0);
+ }
+ }
+#endif
+}
+#endif
+
static void tag_scenes_for_render(Render *re)
{
bNode *node;
@@ -2196,6 +2222,10 @@ static void ntree_render_scenes(Render *re)
if (re->scene->nodetree == NULL) return;
tag_scenes_for_render(re);
+
+#ifdef DEPSGRAPH_WORKAROUND_GROUP_HACK
+ tag_groups_for_render(re);
+#endif
/* now foreach render-result node tagged we do a full render */
/* results are stored in a way compisitor will find it */
@@ -2413,6 +2443,10 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
}
}
+#ifdef DEPSGRAPH_WORKAROUND_GROUP_HACK
+ tag_groups_for_render(re);
+#endif
+
/* composite */
if (ntree) {
ntreeCompositTagRender(re->scene);
@@ -2564,6 +2598,11 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
#ifdef WITH_FREESTYLE
free_all_freestyle_renders();
#endif
+
+#ifdef DEPSGRAPH_WORKAROUND_GROUP_HACK
+ /* Restore their visibility based on the viewport visibility flags. */
+ tag_groups_for_render(re);
+#endif
}
/* returns fully composited render-result on given time step (in RenderData) */
@@ -2662,6 +2701,11 @@ static void do_render_composite_fields_blur_3d(Render *re)
free_all_freestyle_renders();
#endif
+#ifdef DEPSGRAPH_WORKAROUND_GROUP_HACK
+ /* Restore their visibility based on the viewport visibility flags. */
+ tag_groups_for_render(re);
+#endif
+
/* weak... the display callback wants an active renderlayer pointer... */
if (re->result != NULL) {
re->result->renlay = render_get_active_layer(re, re->result);
@@ -3223,6 +3267,11 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain,
/* check all scenes involved */
tag_scenes_for_render(re);
+#ifdef DEPSGRAPH_WORKAROUND_GROUP_HACK
+ /* Update group collections visibility. */
+ tag_groups_for_render(re);
+#endif
+
/*
* Disabled completely for now,
* can be later set as render profile option