Changeset View
Changeset View
Standalone View
Standalone View
source/blender/sequencer/intern/strip_transform.c
| Show All 34 Lines | |||||||||||||||||||
| #include "SEQ_effects.h" | #include "SEQ_effects.h" | ||||||||||||||||||
| #include "SEQ_iterator.h" | #include "SEQ_iterator.h" | ||||||||||||||||||
| #include "SEQ_relations.h" | #include "SEQ_relations.h" | ||||||||||||||||||
| #include "SEQ_sequencer.h" | #include "SEQ_sequencer.h" | ||||||||||||||||||
| #include "SEQ_time.h" | #include "SEQ_time.h" | ||||||||||||||||||
| #include "SEQ_transform.h" | #include "SEQ_transform.h" | ||||||||||||||||||
| #include "CLG_log.h" | |||||||||||||||||||
| static CLG_LogRef LOG = {"seq.strip_transform"}; | |||||||||||||||||||
| static int seq_tx_get_start(Sequence *seq) | static int seq_tx_get_start(Sequence *seq) | ||||||||||||||||||
| { | { | ||||||||||||||||||
| return seq->start; | return seq->start; | ||||||||||||||||||
| } | } | ||||||||||||||||||
| static int seq_tx_get_end(Sequence *seq) | static int seq_tx_get_end(Sequence *seq) | ||||||||||||||||||
| { | { | ||||||||||||||||||
| return seq->start + seq->len; | return seq->start + seq->len; | ||||||||||||||||||
| } | } | ||||||||||||||||||
| ▲ Show 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | static int shuffle_seq_time_offset_test(SeqCollection *strips_to_shuffle, | ||||||||||||||||||
| ListBase *seqbasep, | ListBase *seqbasep, | ||||||||||||||||||
| char dir) | char dir) | ||||||||||||||||||
| { | { | ||||||||||||||||||
| int offset = 0; | int offset = 0; | ||||||||||||||||||
| Sequence *seq; | Sequence *seq; | ||||||||||||||||||
| SEQ_ITERATOR_FOREACH (seq, strips_to_shuffle) { | SEQ_ITERATOR_FOREACH (seq, strips_to_shuffle) { | ||||||||||||||||||
| LISTBASE_FOREACH (Sequence *, seq_other, seqbasep) { | LISTBASE_FOREACH (Sequence *, seq_other, seqbasep) { | ||||||||||||||||||
| if (!seq_overlap(seq, seq_other)) { | if (!seq_overlap(seq, seq_other)) { | ||||||||||||||||||
| continue; | continue; | ||||||||||||||||||
| } | } | ||||||||||||||||||
| if (UNLIKELY(SEQ_collection_has_strip(seq_other, strips_to_shuffle))) { | |||||||||||||||||||
| CLOG_WARN(&LOG, | |||||||||||||||||||
| "Strip overlaps with itself or another strip, that is to be shuffled." | |||||||||||||||||||
| "This should never happen."); | |||||||||||||||||||
| continue; | |||||||||||||||||||
| } | |||||||||||||||||||
campbellbarton: While this is correct, I'd suggest to make this case more explicit.
```
/* The result of… | |||||||||||||||||||
Done Inline Actions
Unless I'm mistaken, the exceptional case is SEQ_collection_has_strip, so only that should warn. campbellbarton: Unless I'm mistaken, the exceptional case is `SEQ_collection_has_strip`, so only that should… | |||||||||||||||||||
| if (dir == 'L') { | if (dir == 'L') { | ||||||||||||||||||
| offset = min_ii(offset, seq_other->startdisp - seq->enddisp); | offset = min_ii(offset, seq_other->startdisp - seq->enddisp); | ||||||||||||||||||
| } | } | ||||||||||||||||||
| else { | else { | ||||||||||||||||||
| offset = max_ii(offset, seq_other->enddisp - seq->startdisp); | offset = max_ii(offset, seq_other->enddisp - seq->startdisp); | ||||||||||||||||||
| } | } | ||||||||||||||||||
| } | } | ||||||||||||||||||
| } | } | ||||||||||||||||||
| ▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines | |||||||||||||||||||
While this is correct, I'd suggest to make this case more explicit.
/* The result of transform is a self-intersecting strip, ideally this would never ... etc ...*/ if (SEQ_collection_has_strip(seq_other, strips_to_shuffle)) { CLOG_WARN(... warning ...); continue; }