From 6640ed92c09c83bfe01cab539f212957b5ca2e16 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 10 Aug 2020 08:11:09 +0200 Subject: Fix T79346: VSE custom proxy file is broken In last set of refactoring patches, code implementing this feature has been accidentally removed. Reviewed By: brecht Differential Revision: https://developer.blender.org/D8449 --- source/blender/blenkernel/intern/sequencer.c | 42 ++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/sequencer.c') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 5481cfe8193..d147ad9ee87 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3155,12 +3155,33 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, return ibuf; } +static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *context, + Sequence *seq, + int cfra) +{ + char name[PROXY_MAXFILE]; + StripProxy *proxy = seq->strip->proxy; + + if (proxy->anim == NULL) { + if (seq_proxy_get_custom_file_fname(seq, name, context->view_id)) { + proxy->anim = openanim(name, IB_rect, 0, seq->strip->colorspace_settings.name); + } + if (proxy->anim == NULL) { + return NULL; + } + } + + int frameno = (int)BKE_sequencer_give_stripelem_index(seq, cfra) + seq->anim_startofs; + return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); +} + /** * Render individual view for multi-view or single (default view) for mono-view. */ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, Sequence *seq, float nr, + float cfra, StripAnim *sanim, bool *r_is_proxy_image) { @@ -3170,10 +3191,19 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, IMB_anim_set_preseek(sanim->anim, seq->anim_preseek); if (seq_can_use_proxy(seq, psize)) { - ibuf = IMB_anim_absolute(sanim->anim, - nr + seq->anim_startofs, - seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, - psize); + /* Try to get a proxy image. + * Movie proxies are handled by ImBuf module with exception of `custom file` setting. */ + if (context->scene->ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE && + seq->strip->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { + ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, cfra); + } + else { + ibuf = IMB_anim_absolute(sanim->anim, + nr + seq->anim_startofs, + seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, + psize); + } + if (ibuf != NULL) { *r_is_proxy_image = true; } @@ -3222,7 +3252,7 @@ static ImBuf *seq_render_movie_strip( for (ibuf_view_id = 0, sanim = seq->anims.first; sanim; sanim = sanim->next, ibuf_view_id++) { if (sanim->anim) { ibuf_arr[ibuf_view_id] = seq_render_movie_strip_view( - context, seq, nr, sanim, r_is_proxy_image); + context, seq, nr, cfra, sanim, r_is_proxy_image); } } @@ -3259,7 +3289,7 @@ static ImBuf *seq_render_movie_strip( MEM_freeN(ibuf_arr); } else { - ibuf = seq_render_movie_strip_view(context, seq, nr, sanim, r_is_proxy_image); + ibuf = seq_render_movie_strip_view(context, seq, nr, cfra, sanim, r_is_proxy_image); } if (ibuf == NULL) { -- cgit v1.2.3