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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-06-03 15:47:44 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-06-04 10:41:33 +0300
commitc3f00d78796216ce15b6032f980539af6f1b0687 (patch)
tree32be9b0d474e1e37a9b5a83dd78a636bb415c12d /source
parentb998a7b384c6a598ea851fbc06a2df8829c34329 (diff)
Fix T65447: Mask doesn't update in compositor unless there's motion blur on
This is probably just one of the related issues. Root of the problem was that compositor job was using original scene and node tree for compositing. It is not guaranteed to have all the evaluated data. Switched compositor job to use it's own render-pipeline-like dependency graph which has everything evaluated in it. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D4998
Diffstat (limited to 'source')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_build.h12
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc36
-rw-r--r--source/blender/editors/space_node/node_edit.c27
3 files changed, 73 insertions, 2 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index 15abc0c0a64..effcece6e00 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -33,6 +33,7 @@ struct Depsgraph;
/* ------------------------------------------------ */
+struct bNodeTree;
struct CacheFile;
struct Collection;
struct CustomData_MeshMasks;
@@ -65,6 +66,17 @@ void DEG_graph_build_for_render_pipeline(struct Depsgraph *graph,
struct Scene *scene,
struct ViewLayer *view_layer);
+/* Builds minimal dependency graph for compositor preview.
+ *
+ * Note that compositor editor might have pinned node tree, which is different from scene's node
+ * tree.
+ */
+void DEG_graph_build_for_compositor_preview(struct Depsgraph *graph,
+ struct Main *bmain,
+ struct Scene *scene,
+ struct ViewLayer *view_layer,
+ struct bNodeTree *nodetree);
+
/* Tag relations from the given graph for update. */
void DEG_graph_tag_relations_update(struct Depsgraph *graph);
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 138b23888b4..cf1ebccc6c6 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -315,6 +315,42 @@ void DEG_graph_build_for_render_pipeline(Depsgraph *graph,
}
}
+void DEG_graph_build_for_compositor_preview(Depsgraph *graph,
+ Main *bmain,
+ Scene *scene,
+ struct ViewLayer * /*view_layer*/,
+ bNodeTree *nodetree)
+{
+ double start_time = 0.0;
+ if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
+ start_time = PIL_check_seconds_timer();
+ }
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
+ /* Perform sanity checks. */
+ BLI_assert(deg_graph->scene == scene);
+ deg_graph->is_render_pipeline_depsgraph = true;
+ DEG::DepsgraphBuilderCache builder_cache;
+ /* Generate all the nodes in the graph first */
+ DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache);
+ node_builder.begin_build();
+ node_builder.build_scene_render(scene);
+ node_builder.build_nodetree(nodetree);
+ node_builder.end_build();
+ /* Hook up relationships between operations - to determine evaluation
+ * order. */
+ DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
+ relation_builder.begin_build();
+ relation_builder.build_scene_render(scene);
+ relation_builder.build_nodetree(nodetree);
+ relation_builder.build_copy_on_write_relations();
+ /* Finalize building. */
+ graph_build_finalize_common(deg_graph, bmain);
+ /* Finish statistics. */
+ if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) {
+ printf("Depsgraph built in %f seconds.\n", PIL_check_seconds_timer() - start_time);
+ }
+}
+
/* Tag graph relations for update. */
void DEG_graph_tag_relations_update(Depsgraph *graph)
{
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index d54a30047e6..7a6e37bfd4d 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -42,6 +42,8 @@
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "RE_engine.h"
#include "RE_pipeline.h"
@@ -79,14 +81,19 @@ enum {
};
typedef struct CompoJob {
+ /* Input parameters. */
Main *bmain;
Scene *scene;
+ ViewLayer *view_layer;
bNodeTree *ntree;
+ int recalc_flags;
+ /* Evaluated state/ */
+ Depsgraph *compositor_depsgraph;
bNodeTree *localtree;
+ /* Jon system integration. */
const short *stop;
short *do_update;
float *progress;
- int recalc_flags;
} CompoJob;
static void compo_tag_output_nodes(bNodeTree *nodetree, int recalc_flags)
@@ -182,6 +189,9 @@ static void compo_freejob(void *cjv)
if (cj->localtree) {
ntreeLocalMerge(cj->bmain, cj->localtree, cj->ntree);
}
+ if (cj->compositor_depsgraph != NULL) {
+ DEG_graph_free(cj->compositor_depsgraph);
+ }
MEM_freeN(cj);
}
@@ -190,8 +200,19 @@ static void compo_freejob(void *cjv)
static void compo_initjob(void *cjv)
{
CompoJob *cj = cjv;
+ Main *bmain = cj->bmain;
+ Scene *scene = cj->scene;
+ ViewLayer *view_layer = cj->view_layer;
+
+ cj->compositor_depsgraph = DEG_graph_new(scene, view_layer, DAG_EVAL_RENDER);
+ DEG_graph_build_for_compositor_preview(
+ cj->compositor_depsgraph, bmain, scene, view_layer, cj->ntree);
+ DEG_evaluate_on_framechange(bmain, cj->compositor_depsgraph, CFRA);
+
+ bNodeTree *ntree_eval = (bNodeTree *)DEG_get_evaluated_id(cj->compositor_depsgraph,
+ &cj->ntree->id);
- cj->localtree = ntreeLocalize(cj->ntree);
+ cj->localtree = ntreeLocalize(ntree_eval);
if (cj->recalc_flags) {
compo_tag_output_nodes(cj->localtree, cj->recalc_flags);
@@ -283,6 +304,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
CompoJob *cj;
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
/* to fix bug: [#32272] */
if (G.is_rendering) {
@@ -307,6 +329,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
/* customdata for preview thread */
cj->bmain = bmain;
cj->scene = scene;
+ cj->view_layer = view_layer;
cj->ntree = nodetree;
cj->recalc_flags = compo_get_recalc_flags(C);