Commit: 93c10797dc35e17bbd96f3711a151acf2d184848 Author: Richard Antalik Date: Mon Jan 25 04:55:10 2021 +0100 Branches: blender-v2.92-release https://developer.blender.org/rB93c10797dc35e17bbd96f3711a151acf2d184848
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 =================================================================== M source/blender/sequencer/intern/effects.c =================================================================== 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; _______________________________________________ Bf-blender-cvs mailing list [email protected] https://lists.blender.org/mailman/listinfo/bf-blender-cvs
