From 744fa41e7ef3a16c3efa46e07183b66f1590584d Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 25 Jan 2021 04:42:46 +0100 Subject: Fix T83266: Proxy building with meta strips fails Building proxy with meta strip selected resulted in attempt to render meta strip itself and save result as image as is done when building image proxies. Remove meta strip from list of supported strips. Multicam, Meta and scene strip are cleared from poll function in UI as well. Reviewed By: sergey Differential Revision: https://developer.blender.org/D10001 --- source/blender/editors/space_sequencer/sequencer_proxy.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_sequencer/sequencer_proxy.c b/source/blender/editors/space_sequencer/sequencer_proxy.c index b04363a4f33..b208f320591 100644 --- a/source/blender/editors/space_sequencer/sequencer_proxy.c +++ b/source/blender/editors/space_sequencer/sequencer_proxy.c @@ -145,8 +145,7 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports) bool selected = false; /* Check for no selected strips */ SEQ_CURRENT_BEGIN (ed, seq) { - if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META) || - (seq->flag & SELECT) == 0) { + if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE) || (seq->flag & SELECT) == 0) { continue; } @@ -284,7 +283,7 @@ static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op) SEQ_CURRENT_BEGIN (ed, seq) { if ((seq->flag & SELECT)) { - if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META)) { + if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) { SEQ_proxy_set(seq, turnon); if (seq->strip->proxy == NULL) { continue; @@ -339,7 +338,7 @@ void SEQUENCER_OT_enable_proxies(wmOperatorType *ot) /* Identifiers. */ ot->name = "Set Selected Strip Proxies"; ot->idname = "SEQUENCER_OT_enable_proxies"; - ot->description = "Enable selected proxies on all selected Movie, Image and Meta strips"; + ot->description = "Enable selected proxies on all selected Movie and Image strips"; /* Api callbacks. */ ot->invoke = sequencer_enable_proxies_invoke; -- cgit v1.2.3 From 93c10797dc35e17bbd96f3711a151acf2d184848 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 25 Jan 2021 04:55:10 +0100 Subject: Fix T82698: Speed effect not working on generator strips Generator strips with zero inputs have their length set to 1 pernamently. In some cases it is useful to use speed effect on these strips because they can be animated. This can be done by using their length as is on timeline as content length. This is very simplified and temporary solution, as cutting these strips won't give expected results. Lot of code relies on length of these strips being fixed to 1, resolving this properly should be done by T59540. Reviewed By: sergey Differential Revision: https://developer.blender.org/D10026 --- source/blender/sequencer/intern/effects.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'source/blender') diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index e8e80c8da83..1631a4534d6 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -3150,6 +3150,18 @@ static void store_icu_yrange_speed(Sequence *seq, short UNUSED(adrcode), float * } } +/* Generator strips with zero inputs have their length set to 1 pernamently. In some cases it is + * useful to use speed effect on these strips because they can be animated. This can be done by + * using their length as is on timeline as content length. See T82698. */ +int seq_effect_speed_get_strip_content_length(const Sequence *seq) +{ + if (SEQ_effect_get_num_inputs(seq->type) == 0) { + return seq->enddisp - seq->startdisp; + } + + return seq->len; +} + void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool force) { int timeline_frame; @@ -3184,9 +3196,11 @@ void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool force) fallback_fac = 1.0; + const int target_strip_length = seq_effect_speed_get_strip_content_length(seq->seq1); + if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { - if ((seq->seq1->enddisp != seq->seq1->start) && (seq->seq1->len != 0)) { - fallback_fac = (float)seq->seq1->len / (float)(seq->seq1->enddisp - seq->seq1->start); + if ((seq->seq1->enddisp != seq->seq1->start) && (target_strip_length != 0)) { + fallback_fac = (float)target_strip_length / (float)(seq->seq1->enddisp - seq->seq1->start); flags = SEQ_SPEED_INTEGRATE; fcu = NULL; } @@ -3216,8 +3230,8 @@ void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool force) cursor += facf; - if (cursor >= seq->seq1->len) { - v->frameMap[timeline_frame] = seq->seq1->len - 1; + if (cursor >= target_strip_length) { + v->frameMap[timeline_frame] = target_strip_length - 1; } else { v->frameMap[timeline_frame] = cursor; @@ -3239,12 +3253,12 @@ void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool force) } if (flags & SEQ_SPEED_COMPRESS_IPO_Y) { - facf *= seq->seq1->len; + facf *= target_strip_length; } facf *= v->globalSpeed; - if (facf >= seq->seq1->len) { - facf = seq->seq1->len - 1; + if (facf >= target_strip_length) { + facf = target_strip_length - 1; } else { v->lastValidFrame = timeline_frame; -- cgit v1.2.3 From e16c786022c48d9679ea306504c06ac25677e553 Mon Sep 17 00:00:00 2001 From: Richard Antalik Date: Mon, 25 Jan 2021 05:03:15 +0100 Subject: Fix T83267: Crash prefetching scene strip in meta strip Scene strips can't be prefetched and seq_prefetch_do_skip_frame() should check if scene strip is in timeline. But it did not recurse into meta strips, which resulted in crash. Reviewed By: sergey Differential Revision: https://developer.blender.org/D9999 --- source/blender/sequencer/intern/prefetch.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'source/blender') diff --git a/source/blender/sequencer/intern/prefetch.c b/source/blender/sequencer/intern/prefetch.c index 6deea305224..b0e9e3c5003 100644 --- a/source/blender/sequencer/intern/prefetch.c +++ b/source/blender/sequencer/intern/prefetch.c @@ -55,6 +55,7 @@ #include "SEQ_prefetch.h" #include "SEQ_render.h" +#include "SEQ_sequencer.h" #include "image_cache.h" #include "prefetch.h" @@ -358,18 +359,23 @@ void seq_prefetch_free(Scene *scene) scene->ed->prefetch_job = NULL; } -static bool seq_prefetch_do_skip_frame(Scene *scene) +/* Skip frame if we need to render 3D scene strip. Rendering 3D scene requires main lock or setting + * up render job that doesn't have API to do openGL renders which can be used for sequencer. */ +static bool seq_prefetch_do_skip_frame(PrefetchJob *pfjob, ListBase *seqbase) { - Editing *ed = scene->ed; - PrefetchJob *pfjob = seq_prefetch_job_get(scene); float cfra = seq_prefetch_cfra(pfjob); Sequence *seq_arr[MAXSEQ + 1]; - int count = seq_get_shown_sequences(ed->seqbasep, cfra, 0, seq_arr); + int count = seq_get_shown_sequences(seqbase, cfra, 0, seq_arr); SeqRenderData *ctx = &pfjob->context_cpy; ImBuf *ibuf = NULL; /* Disable prefetching 3D scene strips, but check for disk cache. */ for (int i = 0; i < count; i++) { + if (seq_arr[i]->type == SEQ_TYPE_META && + seq_prefetch_do_skip_frame(pfjob, &seq_arr[i]->seqbase)) { + return true; + } + if (seq_arr[i]->type == SEQ_TYPE_SCENE && (seq_arr[i]->flag & SEQ_SCENE_STRIPS) == 0) { int cached_types = 0; @@ -457,7 +463,8 @@ static void *seq_prefetch_frames(void *job) */ pfjob->scene_eval->ed->prefetch_job = pfjob; - if (seq_prefetch_do_skip_frame(pfjob->scene)) { + ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(pfjob->scene, false)); + if (seq_prefetch_do_skip_frame(pfjob, seqbase)) { pfjob->num_frames_prefetched++; continue; } -- cgit v1.2.3