diff options
Diffstat (limited to 'source/blender/blenkernel/intern/sequencer.c')
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 131 |
1 files changed, 95 insertions, 36 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 37cc5b77462..5b1bc3426ce 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1136,6 +1136,33 @@ const char *BKE_sequence_give_name(Sequence *seq) return name; } +ListBase *BKE_sequence_seqbase_get(Sequence *seq, int *r_offset) +{ + ListBase *seqbase = NULL; + + switch (seq->type) { + case SEQ_TYPE_META: + { + seqbase = &seq->seqbase; + *r_offset = seq->start; + break; + } + case SEQ_TYPE_SCENE: + { + if (seq->flag & SEQ_SCENE_STRIPS) { + Editing *ed = BKE_sequencer_editing_get(seq->scene, false); + if (ed) { + seqbase = &ed->seqbase; + *r_offset = seq->scene->r.sfra; + } + } + break; + } + } + + return seqbase; +} + /*********************** DO THE SEQUENCE *************************/ static void make_black_ibuf(ImBuf *ibuf) @@ -2467,12 +2494,14 @@ static ImBuf *input_preprocess(const SeqRenderData *context, Sequence *seq, floa multibuf(ibuf, mul); } - if (ibuf->x != context->rectx || ibuf->y != context->recty) { - if (scene->r.mode & R_OSA) { - IMB_scaleImBuf(ibuf, (short)context->rectx, (short)context->recty); - } - else { - IMB_scalefastImBuf(ibuf, (short)context->rectx, (short)context->recty); + if (!is_proxy_image) { + if (ibuf->x != context->rectx || ibuf->y != context->recty) { + if (scene->r.mode & R_OSA) { + IMB_scaleImBuf(ibuf, (short)context->rectx, (short)context->recty); + } + else { + IMB_scalefastImBuf(ibuf, (short)context->rectx, (short)context->recty); + } } } @@ -3285,6 +3314,40 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq return ibuf; } +/** + * Used for meta-strips & scenes with #SEQ_SCENE_STRIPS flag set. + */ +static ImBuf *do_render_strip_seqbase( + const SeqRenderData *context, Sequence *seq, float nr, + bool use_preprocess) +{ + ImBuf *meta_ibuf = NULL, *ibuf = NULL; + ListBase *seqbase = NULL; + int offset; + + seqbase = BKE_sequence_seqbase_get(seq, &offset); + + if (seqbase && !BLI_listbase_is_empty(seqbase)) { + meta_ibuf = seq_render_strip_stack( + context, seqbase, + /* scene strips don't have their start taken into account */ + nr + offset, 0); + } + + if (meta_ibuf) { + ibuf = meta_ibuf; + if (ibuf && use_preprocess) { + ImBuf *i = IMB_dupImBuf(ibuf); + + IMB_freeImBuf(ibuf); + + ibuf = i; + } + } + + return ibuf; +} + static ImBuf *do_render_strip_uncached(const SeqRenderData *context, Sequence *seq, float cfra) { ImBuf *ibuf = NULL; @@ -3295,22 +3358,27 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, Sequence *s switch (type) { case SEQ_TYPE_META: { - ImBuf *meta_ibuf = NULL; - - if (seq->seqbase.first) - meta_ibuf = seq_render_strip_stack(context, &seq->seqbase, seq->start + nr, 0); - - if (meta_ibuf) { - ibuf = meta_ibuf; - if (ibuf && use_preprocess) { - ImBuf *i = IMB_dupImBuf(ibuf); - - IMB_freeImBuf(ibuf); + ibuf = do_render_strip_seqbase(context, seq, nr, use_preprocess); + break; + } - ibuf = i; + case SEQ_TYPE_SCENE: + { + if (seq->flag & SEQ_SCENE_STRIPS) { + /* TODO, full recursive check */ + if (context->scene != seq->scene) { + ibuf = do_render_strip_seqbase(context, seq, nr, use_preprocess); } } + else { + /* scene can be NULL after deletions */ + ibuf = seq_render_scene_strip(context, seq, nr, cfra); + + /* Scene strips update all animation, so we need to restore original state.*/ + BKE_animsys_evaluate_all_animation(context->bmain, context->scene, cfra); + copy_to_ibuf_still(context, seq, nr, ibuf); + } break; } @@ -3361,18 +3429,6 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, Sequence *s break; } - case SEQ_TYPE_SCENE: - { - /* scene can be NULL after deletions */ - ibuf = seq_render_scene_strip(context, seq, nr, cfra); - - /* Scene strips update all animation, so we need to restore original state.*/ - BKE_animsys_evaluate_all_animation(context->bmain, context->scene, cfra); - - copy_to_ibuf_still(context, seq, nr, ibuf); - break; - } - case SEQ_TYPE_MOVIECLIP: { ibuf = seq_render_movieclip_strip(context, seq, nr); @@ -3424,6 +3480,7 @@ static ImBuf *seq_render_strip(const SeqRenderData *context, Sequence *seq, floa ibuf = copy_from_ibuf_still(context, seq, nr); if (ibuf == NULL) { + /* disable caching in that case */ ibuf = BKE_sequencer_preprocessed_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF); if (ibuf == NULL) { @@ -3660,14 +3717,16 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, ListBase *seq for (; i < count; i++) { Sequence *seq = seq_arr[i]; - if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) { - ImBuf *ibuf1 = out; - ImBuf *ibuf2 = seq_render_strip(context, seq, cfra); + if (context->preview_render_size >= 100) { + if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) { + ImBuf *ibuf1 = out; + ImBuf *ibuf2 = seq_render_strip(context, seq, cfra); - out = seq_render_strip_stack_apply_effect(context, seq, cfra, ibuf1, ibuf2); + out = seq_render_strip_stack_apply_effect(context, seq, cfra, ibuf1, ibuf2); - IMB_freeImBuf(ibuf1); - IMB_freeImBuf(ibuf2); + IMB_freeImBuf(ibuf1); + IMB_freeImBuf(ibuf2); + } } BKE_sequencer_cache_put(context, seq_arr[i], cfra, SEQ_STRIPELEM_IBUF_COMP, out); |