Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / sequencer.c
index 11ee8a5ca6f7f6690c34a58762b197a93e7b2566..424f4269f3c4dff70656198219299894bfaea6ea 100644 (file)
@@ -63,9 +63,9 @@
 #include "BLT_translation.h"
 
 #include "BKE_animsys.h"
-#include "BKE_depsgraph.h"
 #include "BKE_global.h"
 #include "BKE_image.h"
+#include "BKE_layer.h"
 #include "BKE_main.h"
 #include "BKE_sequencer.h"
 #include "BKE_movieclip.h"
@@ -75,6 +75,8 @@
 #include "BKE_library.h"
 #include "BKE_idprop.h"
 
+#include "DEG_depsgraph.h"
+
 #include "RNA_access.h"
 
 #include "RE_pipeline.h"
 #include "BKE_context.h"
 #include "BKE_sound.h"
 
+#include "RE_engine.h"
+
 #ifdef WITH_AUDASPACE
-#  include AUD_SPECIAL_H
+#  include <AUD_Special.h>
 #endif
 
 /* mutable state for sequencer */
@@ -3260,6 +3264,10 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
        // have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first);  /* UNUSED */
        have_comp = (scene->r.scemode & R_DOCOMP) && scene->use_nodes && scene->nodetree;
 
+       /* Get depsgraph and scene layer for the strip. */
+       ViewLayer *view_layer = BKE_view_layer_from_scene_get(scene);
+       Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
+
        orig_data.scemode = scene->r.scemode;
        orig_data.cfra = scene->r.cfra;
        orig_data.subframe = scene->r.subframe;
@@ -3315,10 +3323,12 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
                        context->scene->r.seq_prev_type = 3 /* == OB_SOLID */;
 
                /* opengl offscreen render */
-               BKE_scene_update_for_newframe(context->eval_ctx, context->bmain, scene, scene->lay);
+               context->eval_ctx->engine_type = RE_engines_find(scene->view_render.engine_id);
+               BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer);
                ibuf = sequencer_view3d_cb(
                        /* set for OpenGL render (NULL when scrubbing) */
-                       scene, camera, width, height, IB_rect, draw_flags, context->scene->r.seq_prev_type,
+                       context->eval_ctx, scene, view_layer, camera, width, height, IB_rect,
+                       draw_flags, context->scene->r.seq_prev_type,
                        scene->r.alphamode, context->gpu_samples, viewname,
                        context->gpu_fx, context->gpu_offscreen, err_out);
                if (ibuf == NULL) {
@@ -3345,7 +3355,14 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
                        if (re == NULL)
                                re = RE_NewSceneRender(scene);
 
-                       BKE_scene_update_for_newframe(context->eval_ctx, context->bmain, scene, scene->lay);
+                       /* NOTE: Without this tag rendering from command line fails.
+                        * TODO(sergey): Need some proper solution with ported
+                        * BKE_scene_set_background() or DEG_on_visible_change() ?
+                        */
+                       RE_SetDepsgraph(re, depsgraph);
+                       DEG_graph_id_tag_update(context->bmain, depsgraph, &scene->id, 0);
+
+                       BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer);
                        RE_BlenderFrame(re, context->bmain, scene, NULL, camera, scene->lay, frame, false);
 
                        /* restore previous state after it was toggled on & off by RE_BlenderFrame */
@@ -3405,7 +3422,7 @@ finally:
        scene->r.subframe = orig_data.subframe;
 
        if (is_frame_update) {
-               BKE_scene_update_for_newframe(context->eval_ctx, context->bmain, scene, scene->lay);
+               BKE_scene_graph_update_for_newframe(context->eval_ctx, depsgraph, context->bmain, scene, view_layer);
        }
 
 #ifdef DURIAN_CAMERA_SWITCH