diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-05-18 22:43:14 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-05-18 22:43:14 +0300 |
commit | 28316e08105965399ff1ad0ed770c064dcc2d6bd (patch) | |
tree | 68bb6f092fc93e751749d87b951bf9e2c9704913 /source/blender/sequencer/intern | |
parent | 8ca9ce09865e6a617d6c2f78f3483ba1fd5d6aef (diff) |
Cleanup: Move strip handle manipulation to time section
Diffstat (limited to 'source/blender/sequencer/intern')
-rw-r--r-- | source/blender/sequencer/intern/strip_add.c | 6 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_edit.c | 20 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_time.c | 23 | ||||
-rw-r--r-- | source/blender/sequencer/intern/strip_transform.c | 45 |
4 files changed, 47 insertions, 47 deletions
diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c index f8e26a56692..77b0fc946d9 100644 --- a/source/blender/sequencer/intern/strip_add.c +++ b/source/blender/sequencer/intern/strip_add.c @@ -174,7 +174,7 @@ Sequence *SEQ_add_effect_strip(Scene *scene, ListBase *seqbase, struct SeqLoadDa if (!load_data->effect.seq1) { seq->len = 1; /* Effect is generator, set non zero length. */ - SEQ_transform_set_right_handle_frame(seq, load_data->effect.end_frame); + SEQ_time_right_handle_frame_set(seq, load_data->effect.end_frame); } seq_add_set_name(scene, seq, load_data); @@ -656,8 +656,8 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo free_proxy_seq(seq); if (lock_range) { - SEQ_transform_set_left_handle_frame(seq, prev_startdisp); - SEQ_transform_set_right_handle_frame(seq, prev_enddisp); + SEQ_time_left_handle_frame_set(seq, prev_startdisp); + SEQ_time_right_handle_frame_set(seq, prev_enddisp); SEQ_transform_fix_single_image_seq_offsets(seq); } diff --git a/source/blender/sequencer/intern/strip_edit.c b/source/blender/sequencer/intern/strip_edit.c index 361230140f7..96bfce8f740 100644 --- a/source/blender/sequencer/intern/strip_edit.c +++ b/source/blender/sequencer/intern/strip_edit.c @@ -276,7 +276,7 @@ static void seq_split_set_left_hold_offset(Sequence *seq, int timeline_frame) { /* Adjust within range of extended stillframes before strip. */ if (timeline_frame < seq->start) { - SEQ_transform_set_left_handle_frame(seq, timeline_frame); + SEQ_time_left_handle_frame_set(seq, timeline_frame); } /* Adjust within range of strip contents. */ else if ((timeline_frame >= seq->start) && (timeline_frame <= (seq->start + seq->len))) { @@ -286,12 +286,12 @@ static void seq_split_set_left_hold_offset(Sequence *seq, int timeline_frame) } /* Adjust within range of extended stillframes after strip. */ else if ((seq->start + seq->len) < timeline_frame) { - const int right_handle_backup = SEQ_transform_get_right_handle_frame(seq); + const int right_handle_backup = SEQ_time_right_handle_frame_get(seq); seq->start += timeline_frame - seq->start; seq->anim_startofs += seq->len - 1; seq->len = 1; - SEQ_transform_set_left_handle_frame(seq, timeline_frame); - SEQ_transform_set_right_handle_frame(seq, right_handle_backup); + SEQ_time_left_handle_frame_set(seq, timeline_frame); + SEQ_time_right_handle_frame_set(seq, right_handle_backup); } } @@ -299,10 +299,10 @@ static void seq_split_set_right_hold_offset(Sequence *seq, int timeline_frame) { /* Adjust within range of extended stillframes before strip. */ if (timeline_frame < seq->start) { - const int left_handle_backup = SEQ_transform_get_left_handle_frame(seq); + const int left_handle_backup = SEQ_time_left_handle_frame_get(seq); seq->start = timeline_frame - 1; - SEQ_transform_set_left_handle_frame(seq, left_handle_backup); - SEQ_transform_set_right_handle_frame(seq, timeline_frame); + SEQ_time_left_handle_frame_set(seq, left_handle_backup); + SEQ_time_right_handle_frame_set(seq, timeline_frame); } /* Adjust within range of strip contents. */ else if ((timeline_frame >= seq->start) && (timeline_frame <= (seq->start + seq->len))) { @@ -311,7 +311,7 @@ static void seq_split_set_right_hold_offset(Sequence *seq, int timeline_frame) } /* Adjust within range of extended stillframes after strip. */ else if ((seq->start + seq->len) < timeline_frame) { - SEQ_transform_set_right_handle_frame(seq, timeline_frame); + SEQ_time_right_handle_frame_set(seq, timeline_frame); } } @@ -324,7 +324,7 @@ static void seq_split_set_right_offset(Sequence *seq, int timeline_frame) seq->startofs += content_offset; } - SEQ_transform_set_right_handle_frame(seq, timeline_frame); + SEQ_time_right_handle_frame_set(seq, timeline_frame); } static void seq_split_set_left_offset(Sequence *seq, int timeline_frame) @@ -336,7 +336,7 @@ static void seq_split_set_left_offset(Sequence *seq, int timeline_frame) seq->endofs += content_offset; } - SEQ_transform_set_left_handle_frame(seq, timeline_frame); + SEQ_time_left_handle_frame_set(seq, timeline_frame); } static bool seq_edit_split_effect_intersect_check(const Sequence *seq, const int timeline_frame) diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c index e18527f68b3..e4f7a5e87e8 100644 --- a/source/blender/sequencer/intern/strip_time.c +++ b/source/blender/sequencer/intern/strip_time.c @@ -177,8 +177,8 @@ void SEQ_time_update_meta_strip_range(Scene *scene, Sequence *seq_meta) seq_time_update_meta_strip(scene, seq_meta); /* Prevent meta-strip to move in timeline. */ - SEQ_transform_set_left_handle_frame(seq_meta, seq_meta->startdisp); - SEQ_transform_set_right_handle_frame(seq_meta, seq_meta->enddisp); + SEQ_time_left_handle_frame_set(seq_meta, seq_meta->startdisp); + SEQ_time_right_handle_frame_set(seq_meta, seq_meta->enddisp); } void SEQ_time_update_sequence(Scene *scene, ListBase *seqbase, Sequence *seq) @@ -524,3 +524,22 @@ bool SEQ_time_has_still_frames(const Sequence *seq) { return SEQ_time_has_right_still_frames(seq) || SEQ_time_has_left_still_frames(seq); } + +int SEQ_time_left_handle_frame_get(Sequence *seq) +{ + return seq->start + seq->startofs; +} +int SEQ_time_right_handle_frame_get(Sequence *seq) +{ + return seq->start + seq->len - seq->endofs; +} + +void SEQ_time_left_handle_frame_set(Sequence *seq, int val) +{ + seq->startofs = val - seq->start; +} + +void SEQ_time_right_handle_frame_set(Sequence *seq, int val) +{ + seq->endofs = seq->start + seq->len - val; +} diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c index 4def31f87e5..8ff577240d6 100644 --- a/source/blender/sequencer/intern/strip_transform.c +++ b/source/blender/sequencer/intern/strip_transform.c @@ -38,25 +38,6 @@ static int seq_tx_get_end(Sequence *seq) return seq->start + seq->len; } -int SEQ_transform_get_left_handle_frame(Sequence *seq) -{ - return seq->start + seq->startofs; -} -int SEQ_transform_get_right_handle_frame(Sequence *seq) -{ - return seq->start + seq->len - seq->endofs; -} - -void SEQ_transform_set_left_handle_frame(Sequence *seq, int val) -{ - seq->startofs = val - seq->start; -} - -void SEQ_transform_set_right_handle_frame(Sequence *seq, int val) -{ - seq->endofs = seq->start + seq->len - val; -} - bool SEQ_transform_single_image_check(Sequence *seq) { return ((seq->len == 1) && @@ -108,13 +89,13 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase) void SEQ_transform_handle_xlimits(Sequence *seq, int leftflag, int rightflag) { if (leftflag) { - if (SEQ_transform_get_left_handle_frame(seq) >= SEQ_transform_get_right_handle_frame(seq)) { - SEQ_transform_set_left_handle_frame(seq, SEQ_transform_get_right_handle_frame(seq) - 1); + if (SEQ_time_left_handle_frame_get(seq) >= SEQ_time_right_handle_frame_get(seq)) { + SEQ_time_left_handle_frame_set(seq, SEQ_time_right_handle_frame_get(seq) - 1); } if (SEQ_transform_single_image_check(seq) == 0) { - if (SEQ_transform_get_left_handle_frame(seq) >= seq_tx_get_end(seq)) { - SEQ_transform_set_left_handle_frame(seq, seq_tx_get_end(seq) - 1); + if (SEQ_time_left_handle_frame_get(seq) >= seq_tx_get_end(seq)) { + SEQ_time_left_handle_frame_set(seq, seq_tx_get_end(seq) - 1); } /* TODO: This doesn't work at the moment. */ @@ -130,13 +111,13 @@ void SEQ_transform_handle_xlimits(Sequence *seq, int leftflag, int rightflag) } if (rightflag) { - if (SEQ_transform_get_right_handle_frame(seq) <= SEQ_transform_get_left_handle_frame(seq)) { - SEQ_transform_set_right_handle_frame(seq, SEQ_transform_get_left_handle_frame(seq) + 1); + if (SEQ_time_right_handle_frame_get(seq) <= SEQ_time_left_handle_frame_get(seq)) { + SEQ_time_right_handle_frame_set(seq, SEQ_time_left_handle_frame_get(seq) + 1); } if (SEQ_transform_single_image_check(seq) == 0) { - if (SEQ_transform_get_right_handle_frame(seq) <= seq_tx_get_start(seq)) { - SEQ_transform_set_right_handle_frame(seq, seq_tx_get_start(seq) + 1); + if (SEQ_time_right_handle_frame_get(seq) <= seq_tx_get_start(seq)) { + SEQ_time_right_handle_frame_set(seq, seq_tx_get_start(seq) + 1); } } } @@ -157,12 +138,12 @@ void SEQ_transform_fix_single_image_seq_offsets(Sequence *seq) /* make sure the image is always at the start since there is only one, * adjusting its start should be ok */ - left = SEQ_transform_get_left_handle_frame(seq); + left = SEQ_time_left_handle_frame_get(seq); start = seq->start; if (start != left) { offset = left - start; - SEQ_transform_set_left_handle_frame(seq, SEQ_transform_get_left_handle_frame(seq) - offset); - SEQ_transform_set_right_handle_frame(seq, SEQ_transform_get_right_handle_frame(seq) - offset); + SEQ_time_left_handle_frame_set(seq, SEQ_time_left_handle_frame_get(seq) - offset); + SEQ_time_right_handle_frame_set(seq, SEQ_time_right_handle_frame_get(seq) - offset); seq->start += offset; } } @@ -213,8 +194,8 @@ void SEQ_transform_translate_sequence(Scene *evil_scene, Sequence *seq, int delt * start/end point in timeline. */ SEQ_time_update_meta_strip_range(evil_scene, seq); /* Move meta start/end points. */ - SEQ_transform_set_left_handle_frame(seq, seq->startdisp + delta); - SEQ_transform_set_right_handle_frame(seq, seq->enddisp + delta); + SEQ_time_left_handle_frame_set(seq, seq->startdisp + delta); + SEQ_time_right_handle_frame_set(seq, seq->enddisp + delta); } ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(evil_scene)); |