Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2021-01-25 06:55:10 +0300
committerRichard Antalik <richardantalik@gmail.com>2021-01-25 06:55:10 +0300
commit93c10797dc35e17bbd96f3711a151acf2d184848 (patch)
tree1fd456ad1cdd546560f6ed719b24101431799980 /source/blender/sequencer
parent744fa41e7ef3a16c3efa46e07183b66f1590584d (diff)
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
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r--source/blender/sequencer/intern/effects.c28
1 files changed, 21 insertions, 7 deletions
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;