Fix T53478, T53430: Sequencer cut edge case fails
Previous fix for T53430 caused T54200. The edge case for soft & hard cuts weren't working, where the strip used start/end-still & the frame was placed exactly on the start/end of of the sequence content. T54200 fixed the end-still case but broke hard-cuts for all other cases. This fixes the case for soft/hard cuts with/without start/end-still.
This commit is contained in:
parent
241c142248
commit
5da3aecefd
|
@ -670,6 +670,10 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
|
|||
Sequence *seqn = NULL;
|
||||
bool skip_dup = false;
|
||||
|
||||
/* The frame is exactly on the endpoint,
|
||||
* this needs special handling for soft cut (not needed for hard cut). */
|
||||
const bool is_end_exact = ((seq->start + seq->len) == cutframe);
|
||||
|
||||
/* backup values */
|
||||
ts.start = seq->start;
|
||||
ts.machine = seq->machine;
|
||||
|
@ -682,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 */
|
||||
|
||||
|
@ -694,7 +698,9 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
|
|||
BKE_sequence_calc(scene, seq);
|
||||
}
|
||||
|
||||
if ((seq->startstill) && (cutframe < seq->start)) {
|
||||
/* 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) {
|
||||
skip_dup = true;
|
||||
|
@ -708,13 +714,17 @@ 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) && (seq->endstill)) {
|
||||
else if ((is_end_exact == true) ||
|
||||
(((seq->start + seq->len) < cutframe) && (seq->endstill)))
|
||||
{
|
||||
seq->endstill -= seq->enddisp - cutframe;
|
||||
/* don't do funny things with METAs ... */
|
||||
if (seq->type == SEQ_TYPE_META) {
|
||||
|
@ -732,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)) {
|
||||
|
@ -741,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;
|
||||
|
@ -752,16 +768,18 @@ 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) && (seqn->endstill)) {
|
||||
else if ((is_end_exact == true) ||
|
||||
(((seqn->start + seqn->len) < cutframe) && (seqn->endstill)))
|
||||
{
|
||||
seqn->start = cutframe;
|
||||
seqn->startofs = 0;
|
||||
seqn->anim_startofs += ts.len - 1;
|
||||
seqn->endstill = ts.enddisp - cutframe - 1;
|
||||
seqn->startstill = 0;
|
||||
}
|
||||
|
||||
|
||||
BKE_sequence_reload_new_file(scene, seqn, false);
|
||||
BKE_sequence_calc(scene, seqn);
|
||||
}
|
||||
|
@ -774,6 +792,10 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
|
|||
Sequence *seqn = NULL;
|
||||
bool skip_dup = false;
|
||||
|
||||
/* The frame is exactly on the endpoint,
|
||||
* this needs special handling for soft cut (not needed for hard cut). */
|
||||
bool is_end_exact = ((seq->start + seq->len) == cutframe);
|
||||
|
||||
/* backup values */
|
||||
ts.start = seq->start;
|
||||
ts.machine = seq->machine;
|
||||
|
@ -786,11 +808,13 @@ 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 */
|
||||
|
||||
if ((seq->startstill) && (cutframe < seq->start)) {
|
||||
|
||||
/* 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) {
|
||||
skip_dup = true;
|
||||
|
@ -804,11 +828,15 @@ 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) && (seq->endstill)) {
|
||||
else if ((is_end_exact == true) ||
|
||||
(((seq->start + seq->len) < cutframe) && (seq->endstill)))
|
||||
{
|
||||
seq->endstill -= seq->enddisp - cutframe;
|
||||
/* don't do funny things with METAs ... */
|
||||
if (seq->type == SEQ_TYPE_META) {
|
||||
|
@ -825,7 +853,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)) {
|
||||
|
@ -834,23 +864,27 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
|
|||
seqn->endofs = ts.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->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) && (seqn->endstill)) {
|
||||
else if ((is_end_exact == true) ||
|
||||
(((seqn->start + seqn->len) < cutframe) && (seqn->endstill)))
|
||||
{
|
||||
seqn->start = cutframe - ts.len + 1;
|
||||
seqn->startofs = ts.len - 1;
|
||||
seqn->endstill = ts.enddisp - cutframe - 1;
|
||||
seqn->startstill = 0;
|
||||
}
|
||||
|
||||
|
||||
BKE_sequence_calc(scene, seqn);
|
||||
}
|
||||
return seqn;
|
||||
|
|
Loading…
Reference in New Issue