diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-10-17 01:17:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-10-17 01:59:59 +0400 |
commit | 887da1345c5b73b93181d110eb67b435dff83000 (patch) | |
tree | b925b2c6382fd6d82350c02148a41a03e3ad46e2 /source | |
parent | b0ef0087410c43b3b8a88020f6e08801265eef53 (diff) |
Sequencer: jump now takes end-points into account
Useful because it's effectively the start-point for any strip which is obscured.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 76 |
1 files changed, 31 insertions, 45 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index e19cd3e51df..3a57aef17aa 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2459,73 +2459,59 @@ static int find_next_prev_edit(Scene *scene, int cfra, const bool do_skip_mute, const bool do_center) { Editing *ed = BKE_sequencer_editing_get(scene, false); - Sequence *seq, *best_seq = NULL, *frame_seq = NULL; + Sequence *seq; - int dist, best_dist; + int dist, best_dist, best_frame = cfra; + int seq_frames[2], seq_frames_tot; + best_dist = MAXFRAME * 2; if (ed == NULL) return cfra; for (seq = ed->seqbasep->first; seq; seq = seq->next) { - int seq_frame; + int i; if (do_skip_mute && (seq->flag & SEQ_MUTE)) { continue; } if (do_center) { - seq_frame = (seq->startdisp + seq->enddisp) / 2; + seq_frames[0] = (seq->startdisp + seq->enddisp) / 2; + seq_frames_tot = 1; } else { - seq_frame = seq->startdisp; - } + seq_frames[0] = seq->startdisp; + seq_frames[1] = seq->enddisp; - dist = MAXFRAME * 2; - - switch (side) { - case SEQ_SIDE_LEFT: - if (seq_frame < cfra) { - dist = cfra - seq_frame; - } - break; - case SEQ_SIDE_RIGHT: - if (seq_frame > cfra) { - dist = seq_frame - cfra; - } - else if (seq_frame == cfra) { - frame_seq = seq; - } - break; + seq_frames_tot = 2; } - if (dist < best_dist) { - best_dist = dist; - best_seq = seq; - } - } + for (i = 0; i < seq_frames_tot; i++) { + const int seq_frame = seq_frames[i]; - /* if no sequence to the right is found and the - * frame is on the start of the last sequence, - * move to the end of the last sequence */ - if (frame_seq) { - if (do_center) { - cfra = (frame_seq->startdisp + frame_seq->enddisp) / 2; - } - else { - cfra = frame_seq->enddisp; - } - } + dist = MAXFRAME * 2; - if (best_seq) { - if (do_center) { - cfra = (best_seq->startdisp + best_seq->enddisp) / 2; - } - else { - cfra = best_seq->startdisp; + switch (side) { + case SEQ_SIDE_LEFT: + if (seq_frame < cfra) { + dist = cfra - seq_frame; + } + break; + case SEQ_SIDE_RIGHT: + if (seq_frame > cfra) { + dist = seq_frame - cfra; + } + break; + } + + if (dist < best_dist) { + best_frame = seq_frame; + best_dist = dist; + } } } - return cfra; + return best_frame; } static bool strip_jump_internal(Scene *scene, |