Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2022-06-02 02:39:40 +0300
committerRichard Antalik <richardantalik@gmail.com>2022-06-02 04:16:20 +0300
commit7afcfe111aacc8bc3f456a3287d3cc34765b798a (patch)
treea67d26f084938bf9f05289e756654a7b5387d9d1 /source/blender/editors/space_sequencer
parent604409b8c7071920e6cc7a672571449070375919 (diff)
VSE: Make time operations self-contained
This patch makes it possible to manipulate strips without need to use update functions to recalculate effect and meta strips. Prior to this change function `SEQ_time_update_sequence` had to be used to update mainly effects and meta strips. This was implemented in a way that relied on sorted list of strips, which can't always be done and in rare cases this approach failed. In case of meta strips, `seqbase` had to be passed and compared with "active" one to determine whether meta strip should be updated or not. This is especially weak system that is prone to bugs when functions are used by python API functions. Finally, other strip types had startdisp` and `enddisp` fields updated by this function and a lot of code relied on these fields even if strip start, length and offsets are available. This is completely unnecessary. Implemented changes: All effects and meta strips are updated when strip handles are moved or strip is translated, without need to call any update function. Function `SEQ_time_update_sequence` has been split to `SEQ_time_update_meta_strip_range` and `seq_time_update_effects_strip_range`. These functions should be only used within sequencer module code. Meta update is used for versioning, which is only reason for it not being declared internally. Sequence fields `startdisp` and `enddisp` are now only used for effects to store strip start and end points. These fields should be used only internally within sequencer module code. Use function `SEQ_time_*_handle_frame_get` to get strip start and end points. To update effects and meta strips with reasonable performance, cache for "parent" meta strip and attached effects is added to `SequenceLookup` cache, so it shares invalidation mechanisms. All caches are populated during single iteration. There should be no functional changes. Differential Revision: https://developer.blender.org/D14990
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c21
-rw-r--r--source/blender/editors/space_sequencer/sequencer_drag_drop.c5
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c80
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c151
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c69
-rw-r--r--source/blender/editors/space_sequencer/sequencer_thumbnails.c26
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c4
7 files changed, 159 insertions, 197 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 10c6e828e96..ddd9286e6f8 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -191,10 +191,11 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
}
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
- if ((ELEM(type, -1, seq->type)) && (seq->enddisp < timeline_frame) &&
- (timeline_frame - seq->enddisp < proximity)) {
+ const int strip_end = SEQ_time_right_handle_frame_get(seq);
+ if ((ELEM(type, -1, seq->type)) && (strip_end < timeline_frame) &&
+ (timeline_frame - strip_end < proximity)) {
tgt = seq;
- proximity = timeline_frame - seq->enddisp;
+ proximity = timeline_frame - strip_end;
}
}
@@ -793,9 +794,8 @@ static void sequencer_add_movie_clamp_sound_strip_length(Scene *scene,
return;
}
- SEQ_time_right_handle_frame_set(seq_sound, SEQ_time_right_handle_frame_get(seq_movie));
- SEQ_time_left_handle_frame_set(seq_sound, SEQ_time_left_handle_frame_get(seq_movie));
- SEQ_time_update_sequence(scene, seqbase, seq_sound);
+ SEQ_time_right_handle_frame_set(scene, seq_sound, SEQ_time_right_handle_frame_get(seq_movie));
+ SEQ_time_left_handle_frame_set(scene, seq_sound, SEQ_time_left_handle_frame_get(seq_movie));
}
static void sequencer_add_movie_multiple_strips(bContext *C,
@@ -842,7 +842,8 @@ static void sequencer_add_movie_multiple_strips(bContext *C,
}
}
- load_data->start_frame += seq_movie->enddisp - seq_movie->startdisp;
+ load_data->start_frame += SEQ_time_right_handle_frame_get(seq_movie) -
+ SEQ_time_left_handle_frame_get(seq_movie);
if (overlap_shuffle_override) {
has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(
C, op, seq_sound, strip_col);
@@ -1073,7 +1074,8 @@ static void sequencer_add_sound_multiple_strips(bContext *C,
}
else {
seq_load_apply_generic_options(C, op, seq);
- load_data->start_frame += seq->enddisp - seq->startdisp;
+ load_data->start_frame += SEQ_time_right_handle_frame_get(seq) -
+ SEQ_time_left_handle_frame_get(seq);
}
}
RNA_END;
@@ -1300,8 +1302,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
/* Adjust length. */
if (load_data.image.len == 1) {
- SEQ_time_right_handle_frame_set(seq, load_data.image.end_frame);
- SEQ_time_update_sequence(scene, SEQ_active_seqbase_get(ed), seq);
+ SEQ_time_right_handle_frame_set(scene, seq, load_data.image.end_frame);
}
seq_load_apply_generic_options(C, op, seq);
diff --git a/source/blender/editors/space_sequencer/sequencer_drag_drop.c b/source/blender/editors/space_sequencer/sequencer_drag_drop.c
index 645c0dc9a1d..8dadb9360e3 100644
--- a/source/blender/editors/space_sequencer/sequencer_drag_drop.c
+++ b/source/blender/editors/space_sequencer/sequencer_drag_drop.c
@@ -231,9 +231,8 @@ static void update_overlay_strip_poistion_data(bContext *C, const int mval[2])
else {
/* Check if there is a strip that would intersect with the new strip(s). */
coords->is_intersecting = false;
- Sequence dummy_seq = {.machine = coords->channel,
- .startdisp = coords->start_frame,
- .enddisp = coords->start_frame + coords->strip_len};
+ Sequence dummy_seq = {
+ .machine = coords->channel, .start = coords->start_frame, .len = coords->strip_len};
Editing *ed = SEQ_editing_get(scene);
for (int i = 0; i < coords->channel_len && !coords->is_intersecting; i++) {
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 02e77732e02..08e42a5b4c4 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -617,8 +617,8 @@ static void drawmeta_contents(Scene *scene,
/* Draw only immediate children (1 level depth). */
for (seq = meta_seqbase->first; seq; seq = seq->next) {
- const int startdisp = seq->startdisp + offset;
- const int enddisp = seq->enddisp + offset;
+ const int startdisp = SEQ_time_left_handle_frame_get(seq) + offset;
+ const int enddisp = SEQ_time_right_handle_frame_get(seq) + offset;
if ((startdisp > x2 || enddisp < x1) == 0) {
float y_chan = (seq->machine - chan_min) / (float)(chan_range)*draw_range;
@@ -668,7 +668,7 @@ float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx)
const float maxhandle = (pixelx * SEQ_HANDLE_SIZE) * U.pixelsize;
/* Ensure that handle is not wider, than quarter of strip. */
- return min_ff(maxhandle, ((float)(seq->enddisp - seq->startdisp) / 4.0f));
+ return min_ff(maxhandle, ((float)(SEQ_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq)) / 4.0f));
}
/* Draw a handle, on left or right side of strip. */
@@ -686,8 +686,8 @@ static void draw_seq_handle(View2D *v2d,
uint whichsel = 0;
uchar col[4];
- x1 = seq->startdisp;
- x2 = seq->enddisp;
+ x1 = SEQ_time_left_handle_frame_get(seq);
+ x2 = SEQ_time_right_handle_frame_get(seq);
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
@@ -739,7 +739,7 @@ static void draw_seq_handle(View2D *v2d,
BLF_set_default();
/* Calculate if strip is wide enough for showing the labels. */
- numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d%d", seq->startdisp, seq->enddisp);
+ numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d%d", SEQ_time_left_handle_frame_get(seq), SEQ_time_right_handle_frame_get(seq));
float tot_width = BLF_width(fontid, numstr, numstr_len);
if ((x2 - x1) / pixelx > 20 + tot_width) {
@@ -747,12 +747,12 @@ static void draw_seq_handle(View2D *v2d,
float text_margin = 1.2f * handsize_clamped;
if (direction == SEQ_LEFTHANDLE) {
- numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", seq->startdisp);
+ numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", SEQ_time_left_handle_frame_get(seq));
x1 += text_margin;
y1 += 0.09f;
}
else {
- numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
+ numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", SEQ_time_right_handle_frame_get(seq) - 1);
x1 = x2 - (text_margin + pixelx * BLF_width(fontid, numstr, numstr_len));
y1 += 0.09f;
}
@@ -913,7 +913,7 @@ static size_t draw_seq_text_get_overlay_string(SpaceSeq *sseq,
char strip_duration_text[16];
if (sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_DURATION) {
- const int strip_duration = seq->enddisp - seq->startdisp;
+ const int strip_duration = SEQ_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq);
SNPRINTF(strip_duration_text, "%d", strip_duration);
if (i != 0) {
text_array[i++] = text_sep;
@@ -980,8 +980,8 @@ static void draw_sequence_extensions_overlay(
float x1, x2, y1, y2;
uchar col[4], blend_col[3];
- x1 = seq->startdisp;
- x2 = seq->enddisp;
+ x1 = SEQ_time_left_handle_frame_get(seq);
+ x2 = SEQ_time_right_handle_frame_get(seq);
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
@@ -1038,15 +1038,15 @@ static void draw_color_strip_band(
immUniformColor4ubv(col);
- immRectf(pos, seq->startdisp, y1, seq->enddisp, text_margin_y);
+ immRectf(pos, SEQ_time_left_handle_frame_get(seq), y1, SEQ_time_right_handle_frame_get(seq), text_margin_y);
/* 1px line to better separate the color band. */
UI_GetColorPtrShade3ubv(col, col, -20);
immUniformColor4ubv(col);
immBegin(GPU_PRIM_LINES, 2);
- immVertex2f(pos, seq->startdisp, text_margin_y);
- immVertex2f(pos, seq->enddisp, text_margin_y);
+ immVertex2f(pos, SEQ_time_left_handle_frame_get(seq), text_margin_y);
+ immVertex2f(pos, SEQ_time_right_handle_frame_get(seq), text_margin_y);
immEnd();
GPU_blend(GPU_BLEND_NONE);
@@ -1111,12 +1111,12 @@ static void draw_seq_background(Scene *scene,
immUniformColor4ubv(col);
if (SEQ_time_has_left_still_frames(seq)) {
- const float content_start = min_ff(seq->enddisp, seq->start);
- immRectf(pos, seq->startdisp, y1, content_start, y2);
+ const float content_start = min_ff(SEQ_time_right_handle_frame_get(seq), seq->start);
+ immRectf(pos, SEQ_time_left_handle_frame_get(seq), y1, content_start, y2);
}
if (SEQ_time_has_right_still_frames(seq)) {
- const float content_end = max_ff(seq->startdisp, seq->start + seq->len);
- immRectf(pos, content_end, y1, seq->enddisp, y2);
+ const float content_end = max_ff(SEQ_time_left_handle_frame_get(seq), seq->start + seq->len);
+ immRectf(pos, content_end, y1, SEQ_time_right_handle_frame_get(seq), y2);
}
}
@@ -1333,14 +1333,14 @@ static void draw_seq_strip(const bContext *C,
SEQ_TIMELINE_SHOW_STRIP_COLOR_TAG);
/* Draw strip body. */
- x1 = SEQ_time_has_left_still_frames(seq) ? seq->start : seq->startdisp;
+ x1 = SEQ_time_has_left_still_frames(seq) ? seq->start : SEQ_time_left_handle_frame_get(seq);
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
- x2 = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) : seq->enddisp;
+ x2 = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) : SEQ_time_right_handle_frame_get(seq);
y2 = seq->machine + SEQ_STRIP_OFSTOP;
/* Limit body to strip bounds. Meta strip can end up with content outside of strip range. */
- x1 = min_ff(x1, seq->enddisp);
- x2 = max_ff(x2, seq->startdisp);
+ x1 = min_ff(x1, SEQ_time_right_handle_frame_get(seq));
+ x2 = max_ff(x2, SEQ_time_left_handle_frame_get(seq));
float text_margin_y;
bool y_threshold;
@@ -1380,8 +1380,8 @@ static void draw_seq_strip(const bContext *C,
}
immUnbindProgram();
- x1 = seq->startdisp;
- x2 = seq->enddisp;
+ x1 = SEQ_time_left_handle_frame_get(seq);
+ x2 = SEQ_time_right_handle_frame_get(seq);
if ((seq->type == SEQ_TYPE_META) ||
((seq->type == SEQ_TYPE_SCENE) && (seq->flag & SEQ_SCENE_STRIPS))) {
@@ -1471,23 +1471,23 @@ static void draw_effect_inputs_highlight(Sequence *seq)
immUniformColor4ub(255, 255, 255, 48);
immRectf(pos,
- seq1->startdisp,
+ SEQ_time_left_handle_frame_get(seq1),
seq1->machine + SEQ_STRIP_OFSBOTTOM,
- seq1->enddisp,
+ SEQ_time_right_handle_frame_get(seq1),
seq1->machine + SEQ_STRIP_OFSTOP);
if (seq2 && seq2 != seq1) {
immRectf(pos,
- seq2->startdisp,
+ SEQ_time_left_handle_frame_get(seq2),
seq2->machine + SEQ_STRIP_OFSBOTTOM,
- seq2->enddisp,
+ SEQ_time_right_handle_frame_get(seq2),
seq2->machine + SEQ_STRIP_OFSTOP);
}
if (seq3 && !ELEM(seq3, seq1, seq2)) {
immRectf(pos,
- seq3->startdisp,
+ SEQ_time_left_handle_frame_get(seq3),
seq3->machine + SEQ_STRIP_OFSBOTTOM,
- seq3->enddisp,
+ SEQ_time_right_handle_frame_get(seq3),
seq3->machine + SEQ_STRIP_OFSTOP);
}
immUnbindProgram();
@@ -2081,10 +2081,10 @@ static int sequencer_draw_get_transform_preview_frame(Scene *scene)
int preview_frame;
if (last_seq->flag & SEQ_RIGHTSEL) {
- preview_frame = last_seq->enddisp - 1;
+ preview_frame = SEQ_time_right_handle_frame_get(last_seq) - 1;
}
else {
- preview_frame = last_seq->startdisp;
+ preview_frame = SEQ_time_left_handle_frame_get(last_seq);
}
return preview_frame;
@@ -2310,10 +2310,10 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
if (seq == last_seq && (last_seq->flag & SELECT)) {
continue;
}
- if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) {
+ if (min_ii(SEQ_time_left_handle_frame_get(seq), seq->start) > v2d->cur.xmax) {
continue;
}
- if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) {
+ if (max_ii(SEQ_time_right_handle_frame_get(seq), seq->start + seq->len) < v2d->cur.xmin) {
continue;
}
if (seq->machine + 1.0f < v2d->cur.ymin) {
@@ -2368,9 +2368,9 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
immUniformColor4ub(255, 255, 255, 48);
immRectf(pos,
- seq->startdisp,
+ SEQ_time_left_handle_frame_get(seq),
seq->machine + SEQ_STRIP_OFSBOTTOM,
- seq->enddisp,
+ SEQ_time_right_handle_frame_get(seq),
seq->machine + SEQ_STRIP_OFSTOP);
immUnbindProgram();
@@ -2597,7 +2597,7 @@ static void draw_cache_view(const bContext *C)
continue;
}
- if (seq->startdisp > v2d->cur.xmax || seq->enddisp < v2d->cur.xmin) {
+ if (SEQ_time_left_handle_frame_get(seq) > v2d->cur.xmax || SEQ_time_right_handle_frame_get(seq) < v2d->cur.xmin) {
continue;
}
@@ -2607,7 +2607,7 @@ static void draw_cache_view(const bContext *C)
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_RAW) {
const float bg_color[4] = {1.0f, 0.1f, 0.02f, 0.1f};
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
- immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
+ immRectf(pos, SEQ_time_left_handle_frame_get(seq), stripe_bot, SEQ_time_right_handle_frame_get(seq), stripe_top);
}
stripe_bot += stripe_ht + stripe_ofs_y;
@@ -2616,7 +2616,7 @@ static void draw_cache_view(const bContext *C)
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_PREPROCESSED) {
const float bg_color[4] = {0.1f, 0.1f, 0.75f, 0.1f};
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
- immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
+ immRectf(pos, SEQ_time_left_handle_frame_get(seq), stripe_bot, SEQ_time_right_handle_frame_get(seq), stripe_top);
}
stripe_top = seq->machine + SEQ_STRIP_OFSTOP - stripe_ofs_y;
@@ -2625,7 +2625,7 @@ static void draw_cache_view(const bContext *C)
if (scene->ed->cache_flag & SEQ_CACHE_VIEW_COMPOSITE) {
const float bg_color[4] = {1.0f, 0.6f, 0.0f, 0.1f};
immUniformColor4f(bg_color[0], bg_color[1], bg_color[2], bg_color[3]);
- immRectf(pos, seq->startdisp, stripe_bot, seq->enddisp, stripe_top);
+ immRectf(pos, SEQ_time_left_handle_frame_get(seq), stripe_bot, SEQ_time_right_handle_frame_get(seq), stripe_top);
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 08f98dfb161..75966d4f070 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -77,7 +77,6 @@
typedef struct TransSeq {
int start, machine;
- int startdisp, enddisp;
int startofs, endofs;
int anim_startofs, anim_endofs;
/* int final_left, final_right; */ /* UNUSED */
@@ -345,7 +344,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
Editing *ed = SEQ_editing_get(scene);
- ListBase *seqbase = SEQ_active_seqbase_get(ed);
ListBase *channels = SEQ_channels_displayed_get(ed);
Sequence *seq;
int snap_frame;
@@ -361,15 +359,15 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
}
else {
if (seq->flag & SEQ_LEFTSEL) {
- SEQ_time_left_handle_frame_set(seq, snap_frame);
+ SEQ_time_left_handle_frame_set(scene, seq, snap_frame);
}
else { /* SEQ_RIGHTSEL */
- SEQ_time_right_handle_frame_set(seq, snap_frame);
+ SEQ_time_right_handle_frame_set(scene, seq, snap_frame);
}
- SEQ_transform_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
- SEQ_transform_fix_single_image_seq_offsets(seq);
+ SEQ_transform_handle_xlimits(
+ scene, seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
+ SEQ_transform_fix_single_image_seq_offsets(scene, seq);
}
- SEQ_time_update_sequence(scene, seqbase, seq);
}
}
@@ -390,27 +388,22 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
if (seq->seq1 && (seq->seq1->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp));
+ SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
}
- SEQ_time_update_sequence(scene, seqbase, seq);
}
else if (seq->seq2 && (seq->seq2->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp));
+ SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
}
- SEQ_time_update_sequence(scene, seqbase, seq);
}
else if (seq->seq3 && (seq->seq3->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - seq->startdisp));
+ SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
}
- SEQ_time_update_sequence(scene, seqbase, seq);
}
}
}
- SEQ_sort(SEQ_active_seqbase_get(ed));
-
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@@ -477,8 +470,6 @@ static void transseq_backup(TransSeq *ts, Sequence *seq)
{
ts->start = seq->start;
ts->machine = seq->machine;
- ts->startdisp = seq->startdisp;
- ts->enddisp = seq->enddisp;
ts->startofs = seq->startofs;
ts->endofs = seq->endofs;
ts->anim_startofs = seq->anim_startofs;
@@ -490,8 +481,6 @@ static void transseq_restore(TransSeq *ts, Sequence *seq)
{
seq->start = ts->start;
seq->machine = ts->machine;
- seq->startdisp = ts->startdisp;
- seq->enddisp = ts->enddisp;
seq->startofs = ts->startofs;
seq->endofs = ts->endofs;
seq->anim_startofs = ts->anim_startofs;
@@ -605,22 +594,8 @@ static void sequencer_slip_recursively(Scene *scene, SlipData *data, int offset)
endframe = seq->start + seq->len;
/* Compute the sequence offsets. */
- seq->endofs = endframe - seq->enddisp;
- seq->startofs = seq->startdisp - seq->start;
- }
- else {
- /* No transform data (likely effect strip). Only move start and end. */
- seq->startdisp = data->ts[i].startdisp + offset;
- seq->enddisp = data->ts[i].enddisp + offset;
- }
-
- /* Effects are only added if we they are in a meta-strip.
- * In this case, dependent strips will just be transformed and
- * we can skip calculating for effects.
- * This way we can avoid an extra loop just for effects. */
- if (!(seq->type & SEQ_TYPE_EFFECT)) {
- ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
- SEQ_time_update_sequence(scene, seqbase, seq);
+ seq->endofs = endframe - SEQ_time_right_handle_frame_get(seq);
+ seq->startofs = SEQ_time_left_handle_frame_get(seq) - seq->start;
}
}
@@ -640,12 +615,12 @@ static void sequencer_slip_apply_limits(SlipData *data, int *offset)
int seq_content_end = seq_content_start + seq->len + seq->anim_startofs + seq->anim_endofs;
int diff = 0;
- if (seq_content_start >= seq->enddisp) {
- diff = seq->enddisp - seq_content_start - 1;
+ if (seq_content_start >= SEQ_time_right_handle_frame_get(seq)) {
+ diff = SEQ_time_right_handle_frame_get(seq) - seq_content_start - 1;
}
- if (seq_content_end <= seq->startdisp) {
- diff = seq->startdisp - seq_content_end + 1;
+ if (seq_content_end <= SEQ_time_left_handle_frame_get(seq)) {
+ diff = SEQ_time_left_handle_frame_get(seq) - seq_content_end + 1;
}
*offset += diff;
}
@@ -791,8 +766,6 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
for (int i = 0; i < data->num_seq; i++) {
Sequence *seq = data->seq_array[i];
SEQ_add_reload_new_file(bmain, scene, seq, false);
- ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
- SEQ_time_update_sequence(scene, seqbase, seq);
}
MEM_freeN(data->seq_array);
@@ -1288,7 +1261,6 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
last_seq->seq3 = seq3;
int old_start = last_seq->start;
- SEQ_time_update_recursive(scene, last_seq);
SEQ_relations_invalidate_cache_preprocessed(scene, last_seq);
SEQ_offset_animdata(scene, last_seq, (last_seq->start - old_start));
@@ -1446,13 +1418,15 @@ static int sequencer_split_exec(bContext *C, wmOperator *op)
if (ignore_selection) {
if (use_cursor_position) {
LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) {
- if (seq->enddisp == split_frame && seq->machine == split_channel) {
+ if (SEQ_time_right_handle_frame_get(seq) == split_frame &&
+ seq->machine == split_channel) {
seq_selected = seq->flag & SEQ_ALLSEL;
}
}
if (!seq_selected) {
LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) {
- if (seq->startdisp == split_frame && seq->machine == split_channel) {
+ if (SEQ_time_left_handle_frame_get(seq) == split_frame &&
+ seq->machine == split_channel) {
seq->flag &= ~SEQ_ALLSEL;
}
}
@@ -1463,20 +1437,18 @@ static int sequencer_split_exec(bContext *C, wmOperator *op)
if (split_side != SEQ_SIDE_BOTH) {
LISTBASE_FOREACH (Sequence *, seq, SEQ_active_seqbase_get(ed)) {
if (split_side == SEQ_SIDE_LEFT) {
- if (seq->startdisp >= split_frame) {
+ if (SEQ_time_left_handle_frame_get(seq) >= split_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
else {
- if (seq->enddisp <= split_frame) {
+ if (SEQ_time_right_handle_frame_get(seq) <= split_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
}
}
}
-
- SEQ_sort(SEQ_active_seqbase_get(ed));
}
if (changed) {
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@@ -1791,8 +1763,6 @@ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
/* Update lengths, etc. */
seq = ed->seqbasep->first;
while (seq) {
- ListBase *seqbase = SEQ_active_seqbase_get(ed);
- SEQ_time_update_sequence(scene, seqbase, seq);
SEQ_relations_invalidate_cache_preprocessed(scene, seq);
seq = seq->next;
}
@@ -1883,8 +1853,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
strip_new->stripdata = se_new;
- SEQ_time_update_sequence(scene, seqbase, seq_new);
-
if (step > 1) {
seq_new->flag &= ~SEQ_OVERLAP;
if (SEQ_transform_test_overlap(seqbase, seq_new)) {
@@ -1908,9 +1876,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
}
SEQ_edit_remove_flagged_sequences(scene, seqbase);
-
- SEQ_sort(seqbase);
-
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
@@ -2020,8 +1985,8 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
BLI_addtail(&seqm->seqbase, seq);
SEQ_relations_invalidate_cache_preprocessed(scene, seq);
channel_max = max_ii(seq->machine, channel_max);
- meta_start_frame = min_ii(seq->startdisp, meta_start_frame);
- meta_end_frame = max_ii(seq->enddisp, meta_end_frame);
+ meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(seq), meta_start_frame);
+ meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(seq), meta_end_frame);
}
}
@@ -2030,7 +1995,6 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
SEQ_sequence_base_unique_name_recursive(scene, &ed->seqbase, seqm);
seqm->start = meta_start_frame;
seqm->len = meta_end_frame - meta_start_frame;
- SEQ_time_update_sequence(scene, active_seqbase, seqm);
SEQ_select_active_set(scene, seqm);
if (SEQ_transform_test_overlap(active_seqbase, seqm)) {
SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene);
@@ -2098,7 +2062,6 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- SEQ_sort(active_seqbase);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@@ -2204,19 +2167,18 @@ static const EnumPropertyItem prop_side_lr_types[] = {
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
{
- ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
- int gap = seqb->startdisp - seqa->enddisp;
+ int gap = SEQ_time_left_handle_frame_get(seqb) - SEQ_time_right_handle_frame_get(seqa);
int seq_a_start;
int seq_b_start;
- seq_b_start = (seqb->start - seqb->startdisp) + seqa->startdisp;
+ seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(seqb)) +
+ SEQ_time_left_handle_frame_get(seqa);
SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start);
- SEQ_time_update_sequence(scene, seqbase, seqb);
SEQ_relations_invalidate_cache_preprocessed(scene, seqb);
- seq_a_start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap;
+ seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(seqa)) +
+ SEQ_time_right_handle_frame_get(seqb) + gap;
SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start);
- SEQ_time_update_sequence(scene, seqbase, seqa);
SEQ_relations_invalidate_cache_preprocessed(scene, seqa);
}
@@ -2241,13 +2203,13 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
switch (lr) {
case SEQ_SIDE_LEFT:
- if (seq->enddisp <= test->startdisp) {
- dist = test->enddisp - seq->startdisp;
+ if (SEQ_time_right_handle_frame_get(seq) <= SEQ_time_left_handle_frame_get(test)) {
+ dist = SEQ_time_right_handle_frame_get(test) - SEQ_time_left_handle_frame_get(seq);
}
break;
case SEQ_SIDE_RIGHT:
- if (seq->startdisp >= test->enddisp) {
- dist = seq->startdisp - test->enddisp;
+ if (SEQ_time_left_handle_frame_get(seq) >= SEQ_time_right_handle_frame_get(test)) {
+ dist = SEQ_time_left_handle_frame_get(seq) - SEQ_time_right_handle_frame_get(test);
}
break;
}
@@ -2307,14 +2269,6 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
break;
}
- /* XXX: Should be a generic function. */
- for (iseq = seqbase->first; iseq; iseq = iseq->next) {
- if ((iseq->type & SEQ_TYPE_EFFECT) &&
- (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
- SEQ_time_update_sequence(scene, seqbase, iseq);
- }
- }
-
/* Do this in a new loop since both effects need to be calculated first. */
for (iseq = seqbase->first; iseq; iseq = iseq->next) {
if ((iseq->type & SEQ_TYPE_EFFECT) &&
@@ -2326,10 +2280,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
}
}
- SEQ_sort(SEQ_active_seqbase_get(ed));
-
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
-
return OPERATOR_FINISHED;
}
@@ -2576,8 +2527,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
else {
int min_seq_startdisp = INT_MAX;
LISTBASE_FOREACH (Sequence *, seq, &seqbase_clipboard) {
- if (seq->startdisp < min_seq_startdisp) {
- min_seq_startdisp = seq->startdisp;
+ if (SEQ_time_left_handle_frame_get(seq) < min_seq_startdisp) {
+ min_seq_startdisp = SEQ_time_left_handle_frame_get(seq);
}
}
/* Paste strips relative to the current-frame. */
@@ -2608,13 +2559,17 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
* in the new list. */
BLI_movelisttolist(ed->seqbasep, &nseqbase);
+ /* Make sure, that pasted strips have unique names. This has to be done immediately after adding
+ * strips to seqbase, for lookup cache to work correctly. */
+ for (iseq = iseq_first; iseq; iseq = iseq->next) {
+ SEQ_ensure_unique_name(iseq, scene);
+ }
+
for (iseq = iseq_first; iseq; iseq = iseq->next) {
if (SEQ_clipboard_pasted_seq_was_active(iseq)) {
SEQ_select_active_set(scene, iseq);
}
- /* Make sure, that pasted strips have unique names. */
- SEQ_ensure_unique_name(iseq, scene);
/* Translate after name has been changed, otherwise this will affect animdata of original
* strip. */
SEQ_transform_translate_sequence(scene, iseq, ofs);
@@ -2692,10 +2647,6 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
seq_act->scene_sound = NULL;
seq_other->scene_sound = NULL;
- ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
- SEQ_time_update_sequence(scene, seqbase, seq_act);
- SEQ_time_update_sequence(scene, seqbase, seq_other);
-
if (seq_act->sound) {
BKE_sound_add_scene_sound_defaults(scene, seq_act);
}
@@ -2938,9 +2889,6 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
/* Correct start/end frames so we don't move.
* Important not to set seq->len = len; allow the function to handle it. */
SEQ_add_reload_new_file(bmain, scene, seq, true);
-
- ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(scene));
- SEQ_time_update_sequence(scene, seqbase, seq);
}
else if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) {
bSound *sound = seq->sound;
@@ -3160,7 +3108,7 @@ static bool seq_get_text_strip_cb(Sequence *seq, void *user_data)
ListBase *channels = SEQ_channels_displayed_get(ed);
/* Only text strips that are not muted and don't end with negative frame. */
if ((seq->type == SEQ_TYPE_TEXT) && !SEQ_render_is_muted(channels, seq) &&
- (seq->enddisp > cd->scene->r.sfra)) {
+ (SEQ_time_right_handle_frame_get(seq) > cd->scene->r.sfra)) {
BLI_addtail(cd->text_seq, MEM_dupallocN(seq));
}
return true;
@@ -3218,16 +3166,17 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
char timecode_str_end[32];
/* Write time-code relative to start frame of scene. Don't allow negative time-codes. */
- BLI_timecode_string_from_time(timecode_str_start,
- sizeof(timecode_str_start),
- -2,
- FRA2TIME(max_ii(seq->startdisp - scene->r.sfra, 0)),
- FPS,
- USER_TIMECODE_SUBRIP);
+ BLI_timecode_string_from_time(
+ timecode_str_start,
+ sizeof(timecode_str_start),
+ -2,
+ FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(seq) - scene->r.sfra, 0)),
+ FPS,
+ USER_TIMECODE_SUBRIP);
BLI_timecode_string_from_time(timecode_str_end,
sizeof(timecode_str_end),
-2,
- FRA2TIME(seq->enddisp - scene->r.sfra),
+ FRA2TIME(SEQ_time_right_handle_frame_get(seq) - scene->r.sfra),
FPS,
USER_TIMECODE_SUBRIP);
@@ -3295,8 +3244,8 @@ static int sequencer_set_range_to_strips_exec(bContext *C, wmOperator *op)
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
selected = true;
- sfra = min_ii(sfra, seq->startdisp);
- efra = max_ii(efra, seq->enddisp - 1);
+ sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(seq));
+ efra = max_ii(efra, SEQ_time_right_handle_frame_get(seq) - 1);
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index 074be0fd120..f237fbc0a12 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -116,13 +116,13 @@ static void select_active_side(ListBase *seqbase, int sel_side, int channel, int
if (channel == seq->machine) {
switch (sel_side) {
case SEQ_SIDE_LEFT:
- if (frame > (seq->startdisp)) {
+ if (frame > (SEQ_time_left_handle_frame_get(seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_RIGHT:
- if (frame < (seq->startdisp)) {
+ if (frame < (SEQ_time_left_handle_frame_get(seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
@@ -152,13 +152,13 @@ static void select_active_side_range(ListBase *seqbase,
}
switch (sel_side) {
case SEQ_SIDE_LEFT:
- if (frame > (seq->startdisp)) {
+ if (frame > (SEQ_time_left_handle_frame_get(seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_RIGHT:
- if (frame < (seq->startdisp)) {
+ if (frame < (SEQ_time_left_handle_frame_get(seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
@@ -179,8 +179,8 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
for (seq = seqbase->first; seq; seq = seq->next) {
if (seq_link->machine != seq->machine) {
- int left_match = (seq->startdisp == seq_link->startdisp) ? 1 : 0;
- int right_match = (seq->enddisp == seq_link->enddisp) ? 1 : 0;
+ int left_match = (SEQ_time_left_handle_frame_get(seq) == seq_link->startdisp) ? 1 : 0;
+ int right_match = (SEQ_time_right_handle_frame_get(seq) == seq_link->enddisp) ? 1 : 0;
if (left_match && right_match) {
/* Direct match, copy the selection settings. */
@@ -247,8 +247,8 @@ void ED_sequencer_select_sequence_single(Scene *scene, Sequence *seq, bool desel
void seq_rectf(Sequence *seq, rctf *rect)
{
- rect->xmin = seq->startdisp;
- rect->xmax = seq->enddisp;
+ rect->xmin = SEQ_time_left_handle_frame_get(seq);
+ rect->xmax = SEQ_time_right_handle_frame_get(seq);
rect->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM;
rect->ymax = seq->machine + SEQ_STRIP_OFSTOP;
}
@@ -273,12 +273,12 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
(sel == 0 && (seq->flag & SELECT) == 0))) {
switch (lr) {
case SEQ_SIDE_LEFT:
- if (test->startdisp == (seq->enddisp)) {
+ if (SEQ_time_left_handle_frame_get(test) == (SEQ_time_right_handle_frame_get(seq))) {
return seq;
}
break;
case SEQ_SIDE_RIGHT:
- if (test->enddisp == (seq->startdisp)) {
+ if (SEQ_time_right_handle_frame_get(test) == (SEQ_time_left_handle_frame_get(seq))) {
return seq;
}
break;
@@ -311,13 +311,18 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
while (seq) {
if (seq->machine == (int)y) {
/* Check for both normal strips, and strips that have been flipped horizontally. */
- if (((seq->startdisp < seq->enddisp) && (seq->startdisp <= x && seq->enddisp >= x)) ||
- ((seq->startdisp > seq->enddisp) && (seq->startdisp >= x && seq->enddisp <= x))) {
+ if (((SEQ_time_left_handle_frame_get(seq) < SEQ_time_right_handle_frame_get(seq)) &&
+ (SEQ_time_left_handle_frame_get(seq) <= x &&
+ SEQ_time_right_handle_frame_get(seq) >= x)) ||
+ ((SEQ_time_left_handle_frame_get(seq) > SEQ_time_right_handle_frame_get(seq)) &&
+ (SEQ_time_left_handle_frame_get(seq) >= x &&
+ SEQ_time_right_handle_frame_get(seq) <= x))) {
if (SEQ_transform_sequence_can_be_translated(seq)) {
/* Clamp handles to defined size in pixel space. */
handsize = 2.0f * sequence_handle_size_get_clamped(seq, pixelx);
- displen = (float)abs(seq->startdisp - seq->enddisp);
+ displen = (float)abs(SEQ_time_left_handle_frame_get(seq) -
+ SEQ_time_right_handle_frame_get(seq));
/* Don't even try to grab the handles of small strips. */
if (displen / pixelx > 16) {
@@ -332,10 +337,10 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
CLAMP(handsize, 7 * pixelx, 30 * pixelx);
}
- if (handsize + seq->startdisp >= x) {
+ if (handsize + SEQ_time_left_handle_frame_get(seq) >= x) {
*hand = SEQ_SIDE_LEFT;
}
- else if (-handsize + seq->enddisp <= x) {
+ else if (-handsize + SEQ_time_right_handle_frame_get(seq) <= x) {
*hand = SEQ_SIDE_RIGHT;
}
}
@@ -578,8 +583,8 @@ static void sequencer_select_side_of_frame(const bContext *C,
const float x = UI_view2d_region_to_view_x(v2d, mval[0]);
LISTBASE_FOREACH (Sequence *, seq_iter, SEQ_active_seqbase_get(ed)) {
- if (((x < CFRA) && (seq_iter->enddisp <= CFRA)) ||
- ((x >= CFRA) && (seq_iter->startdisp >= CFRA))) {
+ if (((x < CFRA) && (SEQ_time_right_handle_frame_get(seq_iter) <= CFRA)) ||
+ ((x >= CFRA) && (SEQ_time_left_handle_frame_get(seq_iter) >= CFRA))) {
/* Select left or right. */
seq_iter->flag |= SELECT;
recurs_sel_seq(seq_iter);
@@ -634,7 +639,8 @@ static void sequencer_select_linked_handle(const bContext *C,
case SEQ_SIDE_LEFT:
if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
seq->flag |= SELECT;
- select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp);
+ select_active_side(
+ ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, SEQ_time_left_handle_frame_get(seq));
}
else {
seq->flag |= SELECT;
@@ -647,7 +653,8 @@ static void sequencer_select_linked_handle(const bContext *C,
case SEQ_SIDE_RIGHT:
if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
seq->flag |= SELECT;
- select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp);
+ select_active_side(
+ ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, SEQ_time_left_handle_frame_get(seq));
}
else {
seq->flag |= SELECT;
@@ -661,7 +668,8 @@ static void sequencer_select_linked_handle(const bContext *C,
}
else {
- select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp);
+ select_active_side(
+ ed->seqbasep, sel_side, seq->machine, SEQ_time_left_handle_frame_get(seq));
}
}
}
@@ -1428,10 +1436,10 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op)
bool test = false;
switch (side) {
case -1:
- test = (timeline_frame >= seq->enddisp);
+ test = (timeline_frame >= SEQ_time_right_handle_frame_get(seq));
break;
case 1:
- test = (timeline_frame <= seq->startdisp);
+ test = (timeline_frame <= SEQ_time_left_handle_frame_get(seq));
break;
case 2:
test = SEQ_time_strip_intersects_frame(seq, timeline_frame);
@@ -1505,10 +1513,10 @@ static int sequencer_select_side_exec(bContext *C, wmOperator *op)
if (seq->flag & SELECT) {
selected = true;
if (sel_side == SEQ_SIDE_LEFT) {
- *frame_limit_p = max_ii(*frame_limit_p, seq->startdisp);
+ *frame_limit_p = max_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(seq));
}
else {
- *frame_limit_p = min_ii(*frame_limit_p, seq->startdisp);
+ *frame_limit_p = min_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(seq));
}
}
}
@@ -1648,7 +1656,7 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
float handsize = sequence_handle_size_get_clamped(seq, pixelx);
/* Right handle. */
- if (rectf.xmax > (seq->enddisp - handsize)) {
+ if (rectf.xmax > (SEQ_time_right_handle_frame_get(seq) - handsize)) {
if (select) {
seq->flag |= SELECT | SEQ_RIGHTSEL;
}
@@ -1661,7 +1669,7 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
}
}
/* Left handle. */
- if (rectf.xmin < (seq->startdisp + handsize)) {
+ if (rectf.xmin < (SEQ_time_left_handle_frame_get(seq) + handsize)) {
if (select) {
seq->flag |= SELECT | SEQ_LEFTSEL;
}
@@ -1953,7 +1961,8 @@ static bool select_grouped_time_overlap(SeqCollection *strips,
Sequence *seq;
SEQ_ITERATOR_FOREACH (seq, strips) {
- if (seq->startdisp < actseq->enddisp && seq->enddisp > actseq->startdisp) {
+ if (SEQ_time_left_handle_frame_get(seq) < SEQ_time_right_handle_frame_get(actseq) &&
+ SEQ_time_right_handle_frame_get(seq) > SEQ_time_left_handle_frame_get(actseq)) {
seq->flag |= SELECT;
changed = true;
}
@@ -1971,8 +1980,10 @@ static void query_lower_channel_strips(Sequence *seq_reference,
if (seq_test->machine > seq_reference->machine) {
continue; /* Not lower channel. */
}
- if (seq_test->enddisp <= seq_reference->startdisp ||
- seq_test->startdisp >= seq_reference->enddisp) {
+ if (SEQ_time_right_handle_frame_get(seq_test) <=
+ SEQ_time_left_handle_frame_get(seq_reference) ||
+ SEQ_time_left_handle_frame_get(seq_test) >=
+ SEQ_time_right_handle_frame_get(seq_reference)) {
continue; /* Not intersecting in time. */
}
SEQ_collection_append_strip(seq_test, collection);
diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.c b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
index eab17d876f3..984d3b1f374 100644
--- a/source/blender/editors/space_sequencer/sequencer_thumbnails.c
+++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
@@ -74,10 +74,10 @@ static bool check_seq_need_thumbnails(Sequence *seq, rctf *view_area)
if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) {
return false;
}
- if (min_ii(seq->startdisp, seq->start) > view_area->xmax) {
+ if (min_ii(SEQ_time_left_handle_frame_get(seq), seq->start) > view_area->xmax) {
return false;
}
- if (max_ii(seq->enddisp, seq->start + seq->len) < view_area->xmin) {
+ if (max_ii(SEQ_time_right_handle_frame_get(seq), seq->start + seq->len) < view_area->xmin) {
return false;
}
if (seq->machine + 1.0f < view_area->ymin) {
@@ -206,7 +206,7 @@ static GHash *sequencer_thumbnail_ghash_init(const bContext *C, View2D *v2d, Edi
else {
if (val_need_update != NULL) {
val_need_update->seq_dupli->start = seq->start;
- val_need_update->seq_dupli->startdisp = seq->startdisp;
+ val_need_update->seq_dupli->startdisp = SEQ_time_left_handle_frame_get(seq);
}
}
}
@@ -363,15 +363,16 @@ static int sequencer_thumbnail_closest_previous_frame_get(int timeline_frame,
static int sequencer_thumbnail_closest_guaranteed_frame_get(Sequence *seq, int timeline_frame)
{
- if (timeline_frame <= seq->startdisp) {
- return seq->startdisp;
+ if (timeline_frame <= SEQ_time_left_handle_frame_get(seq)) {
+ return SEQ_time_left_handle_frame_get(seq);
}
/* Set of "guaranteed" thumbnails. */
- const int frame_index = timeline_frame - seq->startdisp;
+ const int frame_index = timeline_frame - SEQ_time_left_handle_frame_get(seq);
const int frame_step = SEQ_render_thumbnails_guaranteed_set_frame_step_get(seq);
const int relative_base_frame = round_fl_to_int((frame_index / (float)frame_step)) * frame_step;
- const int nearest_guaranted_absolute_frame = relative_base_frame + seq->startdisp;
+ const int nearest_guaranted_absolute_frame = relative_base_frame +
+ SEQ_time_left_handle_frame_get(seq);
return nearest_guaranted_absolute_frame;
}
@@ -444,10 +445,11 @@ void draw_seq_strip_thumbnail(View2D *v2d,
float thumb_y_end = y1 + thumb_height;
float cut_off = 0;
- float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) :
- seq->enddisp;
+ float upper_thumb_bound = SEQ_time_has_right_still_frames(seq) ?
+ (seq->start + seq->len) :
+ SEQ_time_right_handle_frame_get(seq);
if (seq->type == SEQ_TYPE_IMAGE) {
- upper_thumb_bound = seq->enddisp;
+ upper_thumb_bound = SEQ_time_right_handle_frame_get(seq);
}
float timeline_frame = SEQ_render_thumbnail_first_frame_get(seq, thumb_width, &v2d->cur);
@@ -473,8 +475,8 @@ void draw_seq_strip_thumbnail(View2D *v2d,
}
/* Set the clipping bound to show the left handle moving over thumbs and not shift thumbs. */
- if (IN_RANGE_INCL(seq->startdisp, timeline_frame, thumb_x_end)) {
- cut_off = seq->startdisp - timeline_frame;
+ if (IN_RANGE_INCL(SEQ_time_left_handle_frame_get(seq), timeline_frame, thumb_x_end)) {
+ cut_off = SEQ_time_left_handle_frame_get(seq) - timeline_frame;
clipped = true;
}
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 93641375d42..857ca6d989b 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -306,8 +306,8 @@ static void seq_view_collection_rect_timeline(Scene *scene, SeqCollection *strip
int xmargin = FPS;
SEQ_ITERATOR_FOREACH (seq, strips) {
- xmin = min_ii(xmin, seq->startdisp);
- xmax = max_ii(xmax, seq->enddisp);
+ xmin = min_ii(xmin, SEQ_time_left_handle_frame_get(seq));
+ xmax = max_ii(xmax, SEQ_time_right_handle_frame_get(seq));
ymin = min_ii(ymin, seq->machine);
ymax = max_ii(ymax, seq->machine);