diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-05 18:14:46 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-05 18:14:46 +0300 |
commit | 84a154ac68d01583b318cca43d8d8bbded127700 (patch) | |
tree | 6414db1d253a5bbf0314a95b1cef47e2ef9da83c /source/blender/editors/space_sequencer | |
parent | ae9beb1cead99ced03798f6acad8082408323991 (diff) | |
parent | df267bd4c48a3b73ad959951419161ae8f9ed126 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e1163fd3207..9a0578fe220 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -671,6 +671,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) Sequence *seqn = NULL; bool skip_dup = false; + /* Unlike soft-cut, it's important to use the same value for both strips. */ + const bool is_end_exact = ((seq->start + seq->len) == cutframe); + /* backup values */ ts.start = seq->start; ts.machine = seq->machine; @@ -683,7 +686,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) ts.anim_startofs = seq->anim_startofs; ts.anim_endofs = seq->anim_endofs; ts.len = seq->len; - + /* First Strip! */ /* strips with extended stillfames before */ @@ -695,6 +698,8 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) BKE_sequence_calc(scene, seq); } + /* Important to offset the start when 'cutframe == seq->start' + * because we need at least one frame of content after start/end still have clipped it. */ if ((seq->startstill) && (cutframe <= seq->start)) { /* don't do funny things with METAs ... */ if (seq->type == SEQ_TYPE_META) { @@ -709,13 +714,15 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) } } /* normal strip */ - else if ((cutframe >= seq->start) && (cutframe < (seq->start + seq->len))) { + else if ((is_end_exact == false) && + ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len)))) + { seq->endofs = 0; seq->endstill = 0; seq->anim_endofs += (seq->start + seq->len) - cutframe; } /* strips with extended stillframes after */ - else if (((seq->start + seq->len) == cutframe) || + else if ((is_end_exact == true) || (((seq->start + seq->len) < cutframe) && (seq->endstill))) { seq->endstill -= seq->enddisp - cutframe; @@ -735,7 +742,11 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) if (seqn) { seqn->flag |= SELECT; - + + /* Important not to re-assign this (unlike soft-cut) */ +#if 0 + is_end_exact = ((seqn->start + seqn->len) == cutframe); +#endif /* Second Strip! */ /* strips with extended stillframes before */ if ((seqn->startstill) && (cutframe == seqn->start + 1)) { @@ -744,9 +755,11 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } - + /* normal strip */ - else if ((cutframe >= seqn->start) && (cutframe < (seqn->start + seqn->len))) { + else if ((is_end_exact == false) && + ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len)))) + { seqn->start = cutframe; seqn->startstill = 0; seqn->startofs = 0; @@ -755,9 +768,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn->anim_endofs = ts.anim_endofs; seqn->endstill = ts.endstill; } - + /* strips with extended stillframes after */ - else if (((seqn->start + seqn->len) == cutframe) || + else if ((is_end_exact == true) || (((seqn->start + seqn->len) < cutframe) && (seqn->endstill))) { seqn->start = cutframe; @@ -766,7 +779,7 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe) seqn->endstill = ts.enddisp - cutframe - 1; seqn->startstill = 0; } - + BKE_sequence_reload_new_file(scene, seqn, false); BKE_sequence_calc(scene, seqn); } @@ -779,6 +792,8 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) Sequence *seqn = NULL; bool skip_dup = false; + bool is_end_exact = ((seq->start + seq->len) == cutframe); + /* backup values */ ts.start = seq->start; ts.machine = seq->machine; @@ -791,10 +806,12 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) ts.anim_startofs = seq->anim_startofs; ts.anim_endofs = seq->anim_endofs; ts.len = seq->len; - + /* First Strip! */ /* strips with extended stillfames before */ - + + /* Important to offset the start when 'cutframe == seq->start' + * because we need at least one frame of content after start/end still have clipped it. */ if ((seq->startstill) && (cutframe <= seq->start)) { /* don't do funny things with METAs ... */ if (seq->type == SEQ_TYPE_META) { @@ -809,11 +826,13 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) } } /* normal strip */ - else if ((cutframe >= seq->start) && (cutframe < (seq->start + seq->len))) { + else if ((is_end_exact == false) && + (cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) + { seq->endofs = (seq->start + seq->len) - cutframe; } /* strips with extended stillframes after */ - else if (((seq->start + seq->len) == cutframe) || + else if ((is_end_exact == true) || (((seq->start + seq->len) < cutframe) && (seq->endstill))) { seq->endstill -= seq->enddisp - cutframe; @@ -832,7 +851,9 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) if (seqn) { seqn->flag |= SELECT; - + + is_end_exact = ((seqn->start + seqn->len) == cutframe); + /* Second Strip! */ /* strips with extended stillframes before */ if ((seqn->startstill) && (cutframe == seqn->start + 1)) { @@ -843,15 +864,17 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) } /* normal strip */ - if ((cutframe >= seqn->start) && (cutframe < (seqn->start + seqn->len))) { + else if ((is_end_exact == false) && + (cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) + { seqn->startstill = 0; seqn->startofs = cutframe - ts.start; seqn->endofs = ts.endofs; seqn->endstill = ts.endstill; } - + /* strips with extended stillframes after */ - else if (((seqn->start + seqn->len) == cutframe) || + else if ((is_end_exact == true) || (((seqn->start + seqn->len) < cutframe) && (seqn->endstill))) { seqn->start = cutframe - ts.len + 1; @@ -859,7 +882,7 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe) seqn->endstill = ts.enddisp - cutframe - 1; seqn->startstill = 0; } - + BKE_sequence_calc(scene, seqn); } return seqn; |