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:
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c51
-rw-r--r--source/blender/editors/space_sequencer/sequencer_channels_draw.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_drag_drop.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c182
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c130
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h6
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c139
-rw-r--r--source/blender/editors/space_sequencer/sequencer_thumbnails.c47
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c6
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c5
10 files changed, 324 insertions, 248 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 647d13a4d56..0f6d6930530 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -85,6 +85,7 @@ typedef struct SequencerAddData {
#define SEQPROP_NOCHAN (1 << 3)
#define SEQPROP_FIT_METHOD (1 << 4)
#define SEQPROP_VIEW_TRANSFORM (1 << 5)
+#define SEQPROP_PLAYBACK_RATE (1 << 6)
static const EnumPropertyItem scale_fit_methods[] = {
{SEQ_SCALE_TO_FIT, "FIT", 0, "Scale to Fit", "Scale image to fit within the canvas"},
@@ -158,6 +159,14 @@ static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
"Set View Transform",
"Set appropriate view transform based on media color space");
}
+
+ if (flag & SEQPROP_PLAYBACK_RATE) {
+ ot->prop = RNA_def_boolean(ot->srna,
+ "adjust_playback_rate",
+ true,
+ "Adjust Playback Rate",
+ "Play at normal speed regardless of scene FPS");
+ }
}
static void sequencer_generic_invoke_path__internal(bContext *C,
@@ -191,7 +200,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
}
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
- const int strip_end = SEQ_time_right_handle_frame_get(seq);
+ const int strip_end = SEQ_time_right_handle_frame_get(scene, seq);
if ((ELEM(type, -1, seq->type)) && (strip_end < timeline_frame) &&
(timeline_frame - strip_end < proximity)) {
tgt = seq;
@@ -250,6 +259,10 @@ static void load_data_init_from_operator(SeqLoadData *load_data, bContext *C, wm
SEQ_tool_settings_fit_method_set(CTX_data_scene(C), load_data->fit_method);
}
+ if ((prop = RNA_struct_find_property(op->ptr, "adjust_playback_rate"))) {
+ load_data->adjust_playback_rate = RNA_boolean_get(op->ptr, "adjust_playback_rate");
+ }
+
if ((prop = RNA_struct_find_property(op->ptr, "filepath"))) {
RNA_property_string_get(op->ptr, prop, load_data->path);
BLI_strncpy(load_data->name, BLI_path_basename(load_data->path), sizeof(load_data->name));
@@ -327,7 +340,7 @@ static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Sequence
}
if (RNA_boolean_get(op->ptr, "overlap") == true ||
- !SEQ_transform_test_overlap(ed->seqbasep, seq)) {
+ !SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
/* No overlap should be handled or the strip is not overlapping, exit early. */
return;
}
@@ -370,7 +383,7 @@ static bool seq_load_apply_generic_options_only_test_overlap(bContext *C,
SEQ_collection_append_strip(seq, strip_col);
- return SEQ_transform_test_overlap(ed->seqbasep, seq);
+ return SEQ_transform_test_overlap(scene, ed->seqbasep, seq);
}
static bool seq_effect_add_properties_poll(const bContext *UNUSED(C),
@@ -793,8 +806,10 @@ static void sequencer_add_movie_clamp_sound_strip_length(Scene *scene,
return;
}
- 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));
+ SEQ_time_right_handle_frame_set(
+ scene, seq_sound, SEQ_time_right_handle_frame_get(scene, seq_movie));
+ SEQ_time_left_handle_frame_set(
+ scene, seq_sound, SEQ_time_left_handle_frame_get(scene, seq_movie));
}
static void sequencer_add_movie_multiple_strips(bContext *C,
@@ -841,8 +856,8 @@ static void sequencer_add_movie_multiple_strips(bContext *C,
}
}
- load_data->start_frame += SEQ_time_right_handle_frame_get(seq_movie) -
- SEQ_time_left_handle_frame_get(seq_movie);
+ load_data->start_frame += SEQ_time_right_handle_frame_get(scene, seq_movie) -
+ SEQ_time_left_handle_frame_get(scene, seq_movie);
if (overlap_shuffle_override) {
has_seq_overlap |= seq_load_apply_generic_options_only_test_overlap(
C, op, seq_sound, strip_col);
@@ -976,6 +991,7 @@ static int sequencer_add_movie_strip_invoke(bContext *C,
sequencer_disable_one_time_properties(C, op);
RNA_enum_set(op->ptr, "fit_method", SEQ_tool_settings_fit_method_get(scene));
+ RNA_boolean_set(op->ptr, "adjust_playback_rate", true);
/* This is for drag and drop. */
if ((RNA_struct_property_is_set(op->ptr, "files") &&
@@ -1042,8 +1058,9 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
WM_FILESEL_SHOW_PROPS | WM_FILESEL_DIRECTORY,
FILE_DEFAULTDISPLAY,
FILE_SORT_DEFAULT);
- sequencer_generic_props__internal(
- ot, SEQPROP_STARTFRAME | SEQPROP_FIT_METHOD | SEQPROP_VIEW_TRANSFORM);
+ sequencer_generic_props__internal(ot,
+ SEQPROP_STARTFRAME | SEQPROP_FIT_METHOD |
+ SEQPROP_VIEW_TRANSFORM | SEQPROP_PLAYBACK_RATE);
RNA_def_boolean(ot->srna, "sound", true, "Sound", "Load sound with the movie");
RNA_def_boolean(ot->srna,
"use_framerate",
@@ -1073,8 +1090,8 @@ static void sequencer_add_sound_multiple_strips(bContext *C,
}
else {
seq_load_apply_generic_options(C, op, seq);
- load_data->start_frame += SEQ_time_right_handle_frame_get(seq) -
- SEQ_time_left_handle_frame_get(seq);
+ load_data->start_frame += SEQ_time_right_handle_frame_get(scene, seq) -
+ SEQ_time_left_handle_frame_get(scene, seq);
}
}
RNA_END;
@@ -1250,8 +1267,12 @@ static int sequencer_add_image_strip_calculate_length(wmOperator *op,
return RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
}
-static void sequencer_add_image_strip_load_files(
- wmOperator *op, Sequence *seq, SeqLoadData *load_data, const int minframe, const int numdigits)
+static void sequencer_add_image_strip_load_files(wmOperator *op,
+ Scene *scene,
+ Sequence *seq,
+ SeqLoadData *load_data,
+ const int minframe,
+ const int numdigits)
{
const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders");
/* size of Strip->dir. */
@@ -1267,7 +1288,7 @@ static void sequencer_add_image_strip_load_files(
size_t strip_frame = 0;
RNA_BEGIN (op->ptr, itemptr, "files") {
char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0, NULL);
- SEQ_add_image_load_file(seq, strip_frame, filename);
+ SEQ_add_image_load_file(scene, seq, strip_frame, filename);
MEM_freeN(filename);
strip_frame++;
}
@@ -1296,7 +1317,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
}
Sequence *seq = SEQ_add_image_strip(CTX_data_main(C), scene, ed->seqbasep, &load_data);
- sequencer_add_image_strip_load_files(op, seq, &load_data, minframe, numdigits);
+ sequencer_add_image_strip_load_files(op, scene, seq, &load_data, minframe, numdigits);
SEQ_add_image_init_alpha_mode(seq);
/* Adjust length. */
diff --git a/source/blender/editors/space_sequencer/sequencer_channels_draw.c b/source/blender/editors/space_sequencer/sequencer_channels_draw.c
index c11388e8555..81fc87598f8 100644
--- a/source/blender/editors/space_sequencer/sequencer_channels_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_channels_draw.c
@@ -97,7 +97,7 @@ static void displayed_channel_range_get(const SeqChannelDrawContext *context,
rctf strip_boundbox;
BLI_rctf_init(&strip_boundbox, 0.0f, 0.0f, 1.0f, r_channel_range[1]);
- SEQ_timeline_expand_boundbox(context->seqbase, &strip_boundbox);
+ SEQ_timeline_expand_boundbox(context->scene, context->seqbase, &strip_boundbox);
CLAMP(r_channel_range[0], strip_boundbox.ymin, strip_boundbox.ymax);
CLAMP(r_channel_range[1], strip_boundbox.ymin, MAXSEQ);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_drag_drop.c b/source/blender/editors/space_sequencer/sequencer_drag_drop.c
index 8dadb9360e3..586cdad7e74 100644
--- a/source/blender/editors/space_sequencer/sequencer_drag_drop.c
+++ b/source/blender/editors/space_sequencer/sequencer_drag_drop.c
@@ -167,7 +167,7 @@ static void sequencer_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
SpaceSeq *sseq = CTX_wm_space_seq(C);
SeqCollection *strips = SEQ_query_rendered_strips(
- channels, seqbase, scene->r.cfra, sseq->chanshown);
+ scene, channels, seqbase, scene->r.cfra, sseq->chanshown);
/* Get the top most strip channel that is in view.*/
Sequence *seq;
@@ -236,7 +236,7 @@ static void update_overlay_strip_poistion_data(bContext *C, const int mval[2])
Editing *ed = SEQ_editing_get(scene);
for (int i = 0; i < coords->channel_len && !coords->is_intersecting; i++) {
- coords->is_intersecting = SEQ_transform_test_overlap(ed->seqbasep, &dummy_seq);
+ coords->is_intersecting = SEQ_transform_test_overlap(scene, ed->seqbasep, &dummy_seq);
dummy_seq.machine++;
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 25701c323b9..4b9ff1e170e 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_time_left_handle_frame_get(seq) + offset;
- const int enddisp = SEQ_time_right_handle_frame_get(seq) + offset;
+ const int startdisp = SEQ_time_left_handle_frame_get(scene, seq) + offset;
+ const int enddisp = SEQ_time_right_handle_frame_get(scene, seq) + offset;
if ((startdisp > x2 || enddisp < x1) == 0) {
float y_chan = (seq->machine - chan_min) / (float)(chan_range)*draw_range;
@@ -663,19 +663,20 @@ static void drawmeta_contents(Scene *scene,
GPU_blend(GPU_BLEND_NONE);
}
-float sequence_handle_size_get_clamped(Sequence *seq, const float pixelx)
+float sequence_handle_size_get_clamped(const Scene *scene, 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_time_right_handle_frame_get(seq) - SEQ_time_left_handle_frame_get(seq)) /
- 4.0f));
+ return min_ff(maxhandle,
+ ((float)(SEQ_time_right_handle_frame_get(scene, seq) -
+ SEQ_time_left_handle_frame_get(scene, seq)) /
+ 4.0f));
}
/* Draw a handle, on left or right side of strip. */
-static void draw_seq_handle(View2D *v2d,
+static void draw_seq_handle(const Scene *scene,
+ View2D *v2d,
Sequence *seq,
const float handsize_clamped,
const short direction,
@@ -689,8 +690,8 @@ static void draw_seq_handle(View2D *v2d,
uint whichsel = 0;
uchar col[4];
- x1 = SEQ_time_left_handle_frame_get(seq);
- x2 = SEQ_time_right_handle_frame_get(seq);
+ x1 = SEQ_time_left_handle_frame_get(scene, seq);
+ x2 = SEQ_time_right_handle_frame_get(scene, seq);
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
@@ -745,8 +746,8 @@ static void draw_seq_handle(View2D *v2d,
numstr_len = BLI_snprintf_rlen(numstr,
sizeof(numstr),
"%d%d",
- SEQ_time_left_handle_frame_get(seq),
- SEQ_time_right_handle_frame_get(seq));
+ SEQ_time_left_handle_frame_get(scene, seq),
+ SEQ_time_right_handle_frame_get(scene, seq));
float tot_width = BLF_width(fontid, numstr, numstr_len);
if ((x2 - x1) / pixelx > 20 + tot_width) {
@@ -755,13 +756,13 @@ static void draw_seq_handle(View2D *v2d,
if (direction == SEQ_LEFTHANDLE) {
numstr_len = BLI_snprintf_rlen(
- numstr, sizeof(numstr), "%d", SEQ_time_left_handle_frame_get(seq));
+ numstr, sizeof(numstr), "%d", SEQ_time_left_handle_frame_get(scene, seq));
x1 += text_margin;
y1 += 0.09f;
}
else {
numstr_len = BLI_snprintf_rlen(
- numstr, sizeof(numstr), "%d", SEQ_time_right_handle_frame_get(seq) - 1);
+ numstr, sizeof(numstr), "%d", SEQ_time_right_handle_frame_get(scene, seq) - 1);
x1 = x2 - (text_margin + pixelx * BLF_width(fontid, numstr, numstr_len));
y1 += 0.09f;
}
@@ -896,7 +897,8 @@ static void draw_seq_text_get_source(Sequence *seq, char *r_source, size_t sourc
}
}
-static size_t draw_seq_text_get_overlay_string(SpaceSeq *sseq,
+static size_t draw_seq_text_get_overlay_string(const Scene *scene,
+ SpaceSeq *sseq,
Sequence *seq,
char *r_overlay_string,
size_t overlay_string_len)
@@ -922,8 +924,8 @@ 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_time_right_handle_frame_get(seq) -
- SEQ_time_left_handle_frame_get(seq);
+ const int strip_duration = SEQ_time_right_handle_frame_get(scene, seq) -
+ SEQ_time_left_handle_frame_get(scene, seq);
SNPRINTF(strip_duration_text, "%d", strip_duration);
if (i != 0) {
text_array[i++] = text_sep;
@@ -952,7 +954,7 @@ static void draw_seq_text_overlay(Scene *scene,
ListBase *channels = SEQ_channels_displayed_get(ed);
char overlay_string[FILE_MAX];
size_t overlay_string_len = draw_seq_text_get_overlay_string(
- sseq, seq, overlay_string, sizeof(overlay_string));
+ scene, sseq, seq, overlay_string, sizeof(overlay_string));
if (overlay_string_len == 0) {
return;
@@ -990,8 +992,8 @@ static void draw_sequence_extensions_overlay(
float x1, x2, y1, y2;
uchar col[4], blend_col[3];
- x1 = SEQ_time_left_handle_frame_get(seq);
- x2 = SEQ_time_right_handle_frame_get(seq);
+ x1 = SEQ_time_left_handle_frame_get(scene, seq);
+ x2 = SEQ_time_right_handle_frame_get(scene, seq);
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
@@ -1005,28 +1007,32 @@ static void draw_sequence_extensions_overlay(
col[3] = SEQ_render_is_muted(channels, seq) ? MUTE_ALPHA : 200;
UI_GetColorPtrShade3ubv(col, blend_col, 10);
- if (seq->startofs) {
+ const float strip_content_start = SEQ_time_start_frame_get(seq);
+ const float strip_content_end = SEQ_time_start_frame_get(seq) +
+ SEQ_time_strip_length_get(scene, seq);
+ float right_handle_frame = SEQ_time_right_handle_frame_get(scene, seq);
+ float left_handle_frame = SEQ_time_left_handle_frame_get(scene, seq);
+
+ if (left_handle_frame > strip_content_start) {
immUniformColor4ubv(col);
- immRectf(pos, (float)(seq->start), y1 - pixely, x1, y1 - SEQ_STRIP_OFSBOTTOM);
+ immRectf(pos, strip_content_start, y1 - pixely, x1, y1 - SEQ_STRIP_OFSBOTTOM);
/* Outline. */
immUniformColor3ubv(blend_col);
- imm_draw_box_wire_2d(pos, x1, y1 - pixely, (float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM);
+ imm_draw_box_wire_2d(pos, x1, y1 - pixely, strip_content_start, y1 - SEQ_STRIP_OFSBOTTOM);
}
- if (seq->endofs) {
+ if (right_handle_frame < strip_content_end) {
immUniformColor4ubv(col);
- immRectf(pos, x2, y2 + pixely, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
+ immRectf(pos, x2, y2 + pixely, strip_content_end, y2 + SEQ_STRIP_OFSBOTTOM);
- /* Outline. */
- immUniformColor3ubv(blend_col);
- imm_draw_box_wire_2d(
- pos, x2, y2 + pixely, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
+ /* Outline. */ immUniformColor3ubv(blend_col);
+ imm_draw_box_wire_2d(pos, x2, y2 + pixely, strip_content_end, y2 + SEQ_STRIP_OFSBOTTOM);
}
GPU_blend(GPU_BLEND_NONE);
}
static void draw_color_strip_band(
- ListBase *channels, Sequence *seq, uint pos, float text_margin_y, float y1)
+ const Scene *scene, ListBase *channels, Sequence *seq, uint pos, float text_margin_y, float y1)
{
uchar col[4];
SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
@@ -1049,9 +1055,9 @@ static void draw_color_strip_band(
immUniformColor4ubv(col);
immRectf(pos,
- SEQ_time_left_handle_frame_get(seq),
+ SEQ_time_left_handle_frame_get(scene, seq),
y1,
- SEQ_time_right_handle_frame_get(seq),
+ SEQ_time_right_handle_frame_get(scene, seq),
text_margin_y);
/* 1px line to better separate the color band. */
@@ -1059,8 +1065,8 @@ static void draw_color_strip_band(
immUniformColor4ubv(col);
immBegin(GPU_PRIM_LINES, 2);
- immVertex2f(pos, SEQ_time_left_handle_frame_get(seq), text_margin_y);
- immVertex2f(pos, SEQ_time_right_handle_frame_get(seq), text_margin_y);
+ immVertex2f(pos, SEQ_time_left_handle_frame_get(scene, seq), text_margin_y);
+ immVertex2f(pos, SEQ_time_right_handle_frame_get(scene, seq), text_margin_y);
immEnd();
GPU_blend(GPU_BLEND_NONE);
@@ -1112,25 +1118,31 @@ static void draw_seq_background(Scene *scene,
/* Draw the main strip body. */
if (is_single_image) {
- immRectf(
- pos, SEQ_time_left_handle_frame_get(seq), y1, SEQ_time_right_handle_frame_get(seq), y2);
+ immRectf(pos,
+ SEQ_time_left_handle_frame_get(scene, seq),
+ y1,
+ SEQ_time_right_handle_frame_get(scene, seq),
+ y2);
}
else {
immRectf(pos, x1, y1, x2, y2);
}
/* Draw background for hold still regions. */
- if (!is_single_image && SEQ_time_has_still_frames(seq)) {
+ if (!is_single_image) {
UI_GetColorPtrShade3ubv(col, col, -35);
immUniformColor4ubv(col);
- if (SEQ_time_has_left_still_frames(seq)) {
- 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_left_still_frames(scene, seq)) {
+ float left_handle_frame = SEQ_time_left_handle_frame_get(scene, seq);
+ const float content_start = SEQ_time_start_frame_get(seq);
+ immRectf(pos, left_handle_frame, y1, content_start, y2);
}
- if (SEQ_time_has_right_still_frames(seq)) {
- 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);
+ if (SEQ_time_has_right_still_frames(scene, seq)) {
+ float right_handle_frame = SEQ_time_right_handle_frame_get(scene, seq);
+ const float content_end = SEQ_time_start_frame_get(seq) +
+ SEQ_time_strip_length_get(scene, seq);
+ immRectf(pos, content_end, y1, right_handle_frame, y2);
}
}
@@ -1200,9 +1212,9 @@ static void draw_seq_invalid(float x1, float x2, float y2, float text_margin_y)
}
static void calculate_seq_text_offsets(
- View2D *v2d, Sequence *seq, float *x1, float *x2, float pixelx)
+ const Scene *scene, View2D *v2d, Sequence *seq, float *x1, float *x2, float pixelx)
{
- const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx);
+ const float handsize_clamped = sequence_handle_size_get_clamped(scene, seq, pixelx);
float text_margin = 2.0f * handsize_clamped;
*x1 += text_margin;
@@ -1336,7 +1348,7 @@ static void draw_seq_strip(const bContext *C,
View2D *v2d = &region->v2d;
float x1, x2, y1, y2;
- const float handsize_clamped = sequence_handle_size_get_clamped(seq, pixelx);
+ const float handsize_clamped = sequence_handle_size_get_clamped(scene, seq, pixelx);
float pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
/* Check if we are doing "solo preview". */
@@ -1347,15 +1359,17 @@ 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_time_left_handle_frame_get(seq);
+ x1 = SEQ_time_has_left_still_frames(scene, seq) ? SEQ_time_start_frame_get(seq) :
+ SEQ_time_left_handle_frame_get(scene, seq);
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
- x2 = SEQ_time_has_right_still_frames(seq) ? (seq->start + seq->len) :
- SEQ_time_right_handle_frame_get(seq);
+ x2 = SEQ_time_has_right_still_frames(scene, seq) ?
+ SEQ_time_start_frame_get(seq) + SEQ_time_strip_length_get(scene, seq) :
+ SEQ_time_right_handle_frame_get(scene, 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_time_right_handle_frame_get(seq));
- x2 = max_ff(x2, SEQ_time_left_handle_frame_get(seq));
+ x1 = min_ff(x1, SEQ_time_right_handle_frame_get(scene, seq));
+ x2 = max_ff(x2, SEQ_time_left_handle_frame_get(scene, seq));
float text_margin_y;
bool y_threshold;
@@ -1381,12 +1395,12 @@ static void draw_seq_strip(const bContext *C,
/* Draw a color band inside color strip. */
if (seq->type == SEQ_TYPE_COLOR && y_threshold) {
- draw_color_strip_band(channels, seq, pos, text_margin_y, y1);
+ draw_color_strip_band(scene, channels, seq, pos, text_margin_y, y1);
}
/* Draw strip offsets when flag is enabled or during "solo preview". */
if (sseq->flag & SEQ_SHOW_OVERLAY) {
- if (!is_single_image && (seq->startofs || seq->endofs) && pixely > 0) {
+ if (!is_single_image && pixely > 0) {
if ((sseq->timeline_overlay.flag & SEQ_TIMELINE_SHOW_STRIP_OFFSETS) ||
(seq == special_seq_update)) {
draw_sequence_extensions_overlay(scene, seq, pos, pixely, show_strip_color_tag);
@@ -1395,8 +1409,8 @@ static void draw_seq_strip(const bContext *C,
}
immUnbindProgram();
- x1 = SEQ_time_left_handle_frame_get(seq);
- x2 = SEQ_time_right_handle_frame_get(seq);
+ x1 = SEQ_time_left_handle_frame_get(scene, seq);
+ x2 = SEQ_time_right_handle_frame_get(scene, seq);
if ((seq->type == SEQ_TYPE_META) ||
((seq->type == SEQ_TYPE_SCENE) && (seq->flag & SEQ_SCENE_STRIPS))) {
@@ -1444,16 +1458,16 @@ static void draw_seq_strip(const bContext *C,
if (!SEQ_transform_is_locked(channels, seq)) {
draw_seq_handle(
- v2d, seq, handsize_clamped, SEQ_LEFTHANDLE, pos, seq_active, pixelx, y_threshold);
+ scene, v2d, seq, handsize_clamped, SEQ_LEFTHANDLE, pos, seq_active, pixelx, y_threshold);
draw_seq_handle(
- v2d, seq, handsize_clamped, SEQ_RIGHTHANDLE, pos, seq_active, pixelx, y_threshold);
+ scene, v2d, seq, handsize_clamped, SEQ_RIGHTHANDLE, pos, seq_active, pixelx, y_threshold);
}
draw_seq_outline(scene, seq, pos, x1, x2, y1, y2, pixelx, pixely, seq_active);
immUnbindProgram();
- calculate_seq_text_offsets(v2d, seq, &x1, &x2, pixelx);
+ calculate_seq_text_offsets(scene, v2d, seq, &x1, &x2, pixelx);
/* If a waveform is drawn, avoid drawing text when there is not enough vertical space. */
if (seq->type == SEQ_TYPE_SOUND_RAM) {
@@ -1474,7 +1488,7 @@ static void draw_seq_strip(const bContext *C,
}
}
-static void draw_effect_inputs_highlight(Sequence *seq)
+static void draw_effect_inputs_highlight(const Scene *scene, Sequence *seq)
{
Sequence *seq1 = seq->seq1;
Sequence *seq2 = seq->seq2;
@@ -1486,23 +1500,23 @@ static void draw_effect_inputs_highlight(Sequence *seq)
immUniformColor4ub(255, 255, 255, 48);
immRectf(pos,
- SEQ_time_left_handle_frame_get(seq1),
+ SEQ_time_left_handle_frame_get(scene, seq1),
seq1->machine + SEQ_STRIP_OFSBOTTOM,
- SEQ_time_right_handle_frame_get(seq1),
+ SEQ_time_right_handle_frame_get(scene, seq1),
seq1->machine + SEQ_STRIP_OFSTOP);
if (seq2 && seq2 != seq1) {
immRectf(pos,
- SEQ_time_left_handle_frame_get(seq2),
+ SEQ_time_left_handle_frame_get(scene, seq2),
seq2->machine + SEQ_STRIP_OFSBOTTOM,
- SEQ_time_right_handle_frame_get(seq2),
+ SEQ_time_right_handle_frame_get(scene, seq2),
seq2->machine + SEQ_STRIP_OFSTOP);
}
if (seq3 && !ELEM(seq3, seq1, seq2)) {
immRectf(pos,
- SEQ_time_left_handle_frame_get(seq3),
+ SEQ_time_left_handle_frame_get(scene, seq3),
seq3->machine + SEQ_STRIP_OFSBOTTOM,
- SEQ_time_right_handle_frame_get(seq3),
+ SEQ_time_right_handle_frame_get(scene, seq3),
seq3->machine + SEQ_STRIP_OFSTOP);
}
immUnbindProgram();
@@ -1591,7 +1605,8 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain,
}
if (viewport) {
- /* Follows same logic as wm_draw_window_offscreen to make sure to restore the same viewport. */
+ /* Follows same logic as wm_draw_window_offscreen to make sure to restore the same
+ * viewport. */
int view = (sseq->multiview_eye == STEREO_RIGHT_ID) ? 1 : 0;
GPU_viewport_bind(viewport, view, &region->winrct);
}
@@ -2096,10 +2111,10 @@ static int sequencer_draw_get_transform_preview_frame(Scene *scene)
int preview_frame;
if (last_seq->flag & SEQ_RIGHTSEL) {
- preview_frame = SEQ_time_right_handle_frame_get(last_seq) - 1;
+ preview_frame = SEQ_time_right_handle_frame_get(scene, last_seq) - 1;
}
else {
- preview_frame = SEQ_time_left_handle_frame_get(last_seq);
+ preview_frame = SEQ_time_left_handle_frame_get(scene, last_seq);
}
return preview_frame;
@@ -2253,7 +2268,7 @@ void sequencer_draw_preview(const bContext *C,
Editing *ed = SEQ_editing_get(scene);
ListBase *channels = SEQ_channels_displayed_get(ed);
SeqCollection *collection = SEQ_query_rendered_strips(
- channels, ed->seqbasep, timeline_frame, 0);
+ scene, channels, ed->seqbasep, timeline_frame, 0);
Sequence *seq;
Sequence *active_seq = SEQ_select_active_get(scene);
SEQ_ITERATOR_FOREACH (seq, collection) {
@@ -2325,10 +2340,13 @@ 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_time_left_handle_frame_get(seq), seq->start) > v2d->cur.xmax) {
+ if (min_ii(SEQ_time_left_handle_frame_get(scene, seq), SEQ_time_start_frame_get(seq)) >
+ v2d->cur.xmax) {
continue;
}
- if (max_ii(SEQ_time_right_handle_frame_get(seq), seq->start + seq->len) < v2d->cur.xmin) {
+ if (max_ii(SEQ_time_right_handle_frame_get(scene, seq),
+ SEQ_time_start_frame_get(seq) + SEQ_time_strip_length_get(scene, seq)) <
+ v2d->cur.xmin) {
continue;
}
if (seq->machine + 1.0f < v2d->cur.ymin) {
@@ -2353,7 +2371,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
/* When active strip is an effect, highlight its inputs. */
if (SEQ_effect_get_num_inputs(last_seq->type) > 0) {
- draw_effect_inputs_highlight(last_seq);
+ draw_effect_inputs_highlight(scene, last_seq);
}
/* When active is a Multi-cam strip, highlight its source channel. */
else if (last_seq->type == SEQ_TYPE_MULTICAM) {
@@ -2383,9 +2401,9 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
immUniformColor4ub(255, 255, 255, 48);
immRectf(pos,
- SEQ_time_left_handle_frame_get(seq),
+ SEQ_time_left_handle_frame_get(scene, seq),
seq->machine + SEQ_STRIP_OFSBOTTOM,
- SEQ_time_right_handle_frame_get(seq),
+ SEQ_time_right_handle_frame_get(scene, seq),
seq->machine + SEQ_STRIP_OFSTOP);
immUnbindProgram();
@@ -2612,8 +2630,8 @@ static void draw_cache_view(const bContext *C)
continue;
}
- if (SEQ_time_left_handle_frame_get(seq) > v2d->cur.xmax ||
- SEQ_time_right_handle_frame_get(seq) < v2d->cur.xmin) {
+ if (SEQ_time_left_handle_frame_get(scene, seq) > v2d->cur.xmax ||
+ SEQ_time_right_handle_frame_get(scene, seq) < v2d->cur.xmin) {
continue;
}
@@ -2624,9 +2642,9 @@ static void draw_cache_view(const bContext *C)
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_time_left_handle_frame_get(seq),
+ SEQ_time_left_handle_frame_get(scene, seq),
stripe_bot,
- SEQ_time_right_handle_frame_get(seq),
+ SEQ_time_right_handle_frame_get(scene, seq),
stripe_top);
}
@@ -2637,9 +2655,9 @@ static void draw_cache_view(const bContext *C)
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_time_left_handle_frame_get(seq),
+ SEQ_time_left_handle_frame_get(scene, seq),
stripe_bot,
- SEQ_time_right_handle_frame_get(seq),
+ SEQ_time_right_handle_frame_get(scene, seq),
stripe_top);
}
@@ -2650,9 +2668,9 @@ static void draw_cache_view(const bContext *C)
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_time_left_handle_frame_get(seq),
+ SEQ_time_left_handle_frame_get(scene, seq),
stripe_bot,
- SEQ_time_right_handle_frame_get(seq),
+ SEQ_time_right_handle_frame_get(scene, seq),
stripe_top);
}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 76dd43586d1..d507c9ae6bc 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -81,6 +81,7 @@ typedef struct TransSeq {
int anim_startofs, anim_endofs;
/* int final_left, final_right; */ /* UNUSED */
int len;
+ float content_start;
} TransSeq;
/** \} */
@@ -369,8 +370,6 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
else { /* SEQ_RIGHTSEL */
SEQ_time_right_handle_frame_set(scene, seq, snap_frame);
}
- SEQ_transform_handle_xlimits(
- scene, seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
SEQ_transform_fix_single_image_seq_offsets(scene, seq);
}
}
@@ -380,7 +379,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && !SEQ_transform_is_locked(channels, seq)) {
seq->flag &= ~SEQ_OVERLAP;
- if (SEQ_transform_test_overlap(ed->seqbasep, seq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene);
}
}
@@ -393,17 +392,20 @@ 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_time_left_handle_frame_get(seq)));
+ SEQ_offset_animdata(
+ scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
}
}
else if (seq->seq2 && (seq->seq2->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
+ SEQ_offset_animdata(
+ scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
}
}
else if (seq->seq3 && (seq->seq3->flag & SELECT)) {
if (!either_handle_selected) {
- SEQ_offset_animdata(scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(seq)));
+ SEQ_offset_animdata(
+ scene, seq, (snap_frame - SEQ_time_left_handle_frame_get(scene, seq)));
}
}
}
@@ -473,6 +475,7 @@ typedef struct SlipData {
static void transseq_backup(TransSeq *ts, Sequence *seq)
{
+ ts->content_start = SEQ_time_start_frame_get(seq);
ts->start = seq->start;
ts->machine = seq->machine;
ts->startofs = seq->startofs;
@@ -603,7 +606,7 @@ static void sequencer_slip_recursively(Scene *scene, SlipData *data, int offset)
}
/* Make sure, that each strip contains at least 1 frame of content. */
-static void sequencer_slip_apply_limits(SlipData *data, int *offset)
+static void sequencer_slip_apply_limits(const Scene *scene, SlipData *data, int *offset)
{
for (int i = 0; i < data->num_seq; i++) {
if (data->trim[i]) {
@@ -612,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_time_right_handle_frame_get(seq)) {
- diff = SEQ_time_right_handle_frame_get(seq) - seq_content_start - 1;
+ if (seq_content_start >= SEQ_time_right_handle_frame_get(scene, seq)) {
+ diff = SEQ_time_right_handle_frame_get(scene, seq) - seq_content_start - 1;
}
- if (seq_content_end <= SEQ_time_left_handle_frame_get(seq)) {
- diff = SEQ_time_left_handle_frame_get(seq) - seq_content_end + 1;
+ if (seq_content_end <= SEQ_time_left_handle_frame_get(scene, seq)) {
+ diff = SEQ_time_left_handle_frame_get(scene, seq) - seq_content_end + 1;
}
*offset += diff;
}
@@ -649,7 +652,7 @@ static int sequencer_slip_exec(bContext *C, wmOperator *op)
transseq_backup(data->ts + i, data->seq_array[i]);
}
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_recursively(scene, data, offset);
MEM_freeN(data->seq_array);
@@ -695,7 +698,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
applyNumInput(&data->num_input, &offset_fl);
int offset = round_fl_to_int(offset_fl);
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_update_header(scene, area, data, offset);
RNA_int_set(op->ptr, "offset", offset);
@@ -727,7 +730,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
UI_view2d_region_to_view(v2d, mouse_x, 0, &mouseloc[0], &mouseloc[1]);
offset = mouseloc[0] - data->init_mouseloc[0];
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_update_header(scene, area, data, offset);
RNA_int_set(op->ptr, "offset", offset);
@@ -804,7 +807,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
applyNumInput(&data->num_input, &offset_fl);
int offset = round_fl_to_int(offset_fl);
- sequencer_slip_apply_limits(data, &offset);
+ sequencer_slip_apply_limits(scene, data, &offset);
sequencer_slip_update_header(scene, area, data, offset);
RNA_int_set(op->ptr, "offset", offset);
@@ -1052,7 +1055,7 @@ static int sequencer_reload_exec(bContext *C, wmOperator *op)
SEQ_add_reload_new_file(bmain, scene, seq, !adjust_length);
if (adjust_length) {
- if (SEQ_transform_test_overlap(ed->seqbasep, seq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene);
}
}
@@ -1415,14 +1418,14 @@ 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_time_right_handle_frame_get(seq) == split_frame &&
+ if (SEQ_time_right_handle_frame_get(scene, 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_time_left_handle_frame_get(seq) == split_frame &&
+ if (SEQ_time_left_handle_frame_get(scene, seq) == split_frame &&
seq->machine == split_channel) {
seq->flag &= ~SEQ_ALLSEL;
}
@@ -1434,12 +1437,12 @@ 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_time_left_handle_frame_get(seq) >= split_frame) {
+ if (SEQ_time_left_handle_frame_get(scene, seq) >= split_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
else {
- if (SEQ_time_right_handle_frame_get(seq) <= split_frame) {
+ if (SEQ_time_right_handle_frame_get(scene, seq) <= split_frame) {
seq->flag &= ~SEQ_ALLSEL;
}
}
@@ -1766,7 +1769,7 @@ static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if ((seq->type & SEQ_TYPE_EFFECT) == 0 && (seq->flag & SELECT)) {
- if (SEQ_transform_test_overlap(ed->seqbasep, seq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, seq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, seq, scene);
}
}
@@ -1825,12 +1828,12 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* TODO: remove f-curve and assign to split image strips.
* The old animation system would remove the user of `seq->ipo`. */
- start_ofs = timeline_frame = SEQ_time_left_handle_frame_get(seq);
- frame_end = SEQ_time_right_handle_frame_get(seq);
+ start_ofs = timeline_frame = SEQ_time_left_handle_frame_get(scene, seq);
+ frame_end = SEQ_time_right_handle_frame_get(scene, seq);
while (timeline_frame < frame_end) {
/* New seq. */
- se = SEQ_render_give_stripelem(seq, timeline_frame);
+ se = SEQ_render_give_stripelem(scene, seq, timeline_frame);
seq_new = SEQ_sequence_dupli_recursive(scene, scene, seqbase, seq, SEQ_DUPE_UNIQUE_NAME);
@@ -1852,7 +1855,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
if (step > 1) {
seq_new->flag &= ~SEQ_OVERLAP;
- if (SEQ_transform_test_overlap(seqbase, seq_new)) {
+ if (SEQ_transform_test_overlap(scene, seqbase, seq_new)) {
SEQ_transform_seqbase_shuffle(seqbase, seq_new, scene);
}
}
@@ -1978,8 +1981,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_time_left_handle_frame_get(seq), meta_start_frame);
- meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(seq), meta_end_frame);
+ meta_start_frame = min_ii(SEQ_time_left_handle_frame_get(scene, seq), meta_start_frame);
+ meta_end_frame = max_ii(SEQ_time_right_handle_frame_get(scene, seq), meta_end_frame);
}
}
@@ -1989,7 +1992,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
seqm->start = meta_start_frame;
seqm->len = meta_end_frame - meta_start_frame;
SEQ_select_active_set(scene, seqm);
- if (SEQ_transform_test_overlap(active_seqbase, seqm)) {
+ if (SEQ_transform_test_overlap(scene, active_seqbase, seqm)) {
SEQ_transform_seqbase_shuffle(active_seqbase, seqm, scene);
}
@@ -2049,7 +2052,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
LISTBASE_FOREACH (Sequence *, seq, active_seqbase) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_OVERLAP;
- if (SEQ_transform_test_overlap(active_seqbase, seq)) {
+ if (SEQ_transform_test_overlap(scene, active_seqbase, seq)) {
SEQ_transform_seqbase_shuffle(active_seqbase, seq, scene);
}
}
@@ -2160,17 +2163,18 @@ static const EnumPropertyItem prop_side_lr_types[] = {
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
{
- int gap = SEQ_time_left_handle_frame_get(seqb) - SEQ_time_right_handle_frame_get(seqa);
+ int gap = SEQ_time_left_handle_frame_get(scene, seqb) -
+ SEQ_time_right_handle_frame_get(scene, seqa);
int seq_a_start;
int seq_b_start;
- seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(seqb)) +
- SEQ_time_left_handle_frame_get(seqa);
+ seq_b_start = (seqb->start - SEQ_time_left_handle_frame_get(scene, seqb)) +
+ SEQ_time_left_handle_frame_get(scene, seqa);
SEQ_transform_translate_sequence(scene, seqb, seq_b_start - seqb->start);
SEQ_relations_invalidate_cache_preprocessed(scene, seqb);
- seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(seqa)) +
- SEQ_time_right_handle_frame_get(seqb) + gap;
+ seq_a_start = (seqa->start - SEQ_time_left_handle_frame_get(scene, seqa)) +
+ SEQ_time_right_handle_frame_get(scene, seqb) + gap;
SEQ_transform_translate_sequence(scene, seqa, seq_a_start - seqa->start);
SEQ_relations_invalidate_cache_preprocessed(scene, seqa);
}
@@ -2196,13 +2200,17 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
switch (lr) {
case SEQ_SIDE_LEFT:
- 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);
+ if (SEQ_time_right_handle_frame_get(scene, seq) <=
+ SEQ_time_left_handle_frame_get(scene, test)) {
+ dist = SEQ_time_right_handle_frame_get(scene, test) -
+ SEQ_time_left_handle_frame_get(scene, seq);
}
break;
case SEQ_SIDE_RIGHT:
- 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);
+ if (SEQ_time_left_handle_frame_get(scene, seq) >=
+ SEQ_time_right_handle_frame_get(scene, test)) {
+ dist = SEQ_time_left_handle_frame_get(scene, seq) -
+ SEQ_time_right_handle_frame_get(scene, test);
}
break;
}
@@ -2267,7 +2275,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
if ((iseq->type & SEQ_TYPE_EFFECT) &&
(seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
/* This may now overlap. */
- if (SEQ_transform_test_overlap(seqbase, iseq)) {
+ if (SEQ_transform_test_overlap(scene, seqbase, iseq)) {
SEQ_transform_seqbase_shuffle(seqbase, iseq, scene);
}
}
@@ -2317,7 +2325,7 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
switch (active_seq->type) {
case SEQ_TYPE_IMAGE:
- se = SEQ_render_give_stripelem(active_seq, scene->r.cfra);
+ se = SEQ_render_give_stripelem(scene, active_seq, scene->r.cfra);
break;
case SEQ_TYPE_MOVIE:
se = active_seq->strip->stripdata;
@@ -2528,8 +2536,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_time_left_handle_frame_get(seq) < min_seq_startdisp) {
- min_seq_startdisp = SEQ_time_left_handle_frame_get(seq);
+ if (SEQ_time_left_handle_frame_get(scene, seq) < min_seq_startdisp) {
+ min_seq_startdisp = SEQ_time_left_handle_frame_get(scene, seq);
}
}
/* Paste strips relative to the current-frame. */
@@ -2575,7 +2583,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op)
* strip. */
SEQ_transform_translate_sequence(scene, iseq, ofs);
/* Ensure, that pasted strips don't overlap. */
- if (SEQ_transform_test_overlap(ed->seqbasep, iseq)) {
+ if (SEQ_transform_test_overlap(scene, ed->seqbasep, iseq)) {
SEQ_transform_seqbase_shuffle(ed->seqbasep, iseq, scene);
}
}
@@ -2632,7 +2640,7 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if (SEQ_edit_sequence_swap(seq_act, seq_other, &error_msg) == 0) {
+ if (SEQ_edit_sequence_swap(scene, seq_act, seq_other, &error_msg) == 0) {
BKE_report(op->reports, RPT_ERROR, error_msg);
return OPERATOR_CANCELLED;
}
@@ -3057,15 +3065,16 @@ void SEQUENCER_OT_change_scene(struct wmOperatorType *ot)
* \{ */
/** Comparison function suitable to be used with BLI_listbase_sort(). */
-static int seq_cmp_time_startdisp_channel(const void *a, const void *b)
+static int seq_cmp_time_startdisp_channel(void *thunk, const void *a, const void *b)
{
+ const Scene *scene = thunk;
Sequence *seq_a = (Sequence *)a;
Sequence *seq_b = (Sequence *)b;
- int seq_a_start = SEQ_time_left_handle_frame_get(seq_a);
- int seq_b_start = SEQ_time_left_handle_frame_get(seq_b);
+ int seq_a_start = SEQ_time_left_handle_frame_get(scene, seq_a);
+ int seq_b_start = SEQ_time_left_handle_frame_get(scene, seq_b);
- /* If strips have the same start frame favor the one with a higher channel. */
+ /* If strips have the same start frame favor the one with a higher channel.*/
if (seq_a_start == seq_b_start) {
return seq_a->machine > seq_b->machine;
}
@@ -3109,7 +3118,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_time_right_handle_frame_get(seq) > cd->scene->r.sfra)) {
+ (SEQ_time_right_handle_frame_get(cd->scene, seq) > cd->scene->r.sfra)) {
BLI_addtail(cd->text_seq, MEM_dupallocN(seq));
}
return true;
@@ -3156,7 +3165,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BLI_listbase_sort(&text_seq, seq_cmp_time_startdisp_channel);
+ BLI_listbase_sort_r(&text_seq, seq_cmp_time_startdisp_channel, scene);
/* Open and write file. */
file = BLI_fopen(filepath, "w");
@@ -3171,15 +3180,16 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
timecode_str_start,
sizeof(timecode_str_start),
-2,
- FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(seq) - scene->r.sfra, 0)),
+ FRA2TIME(max_ii(SEQ_time_left_handle_frame_get(scene, seq) - scene->r.sfra, 0)),
+ FPS,
+ USER_TIMECODE_SUBRIP);
+ BLI_timecode_string_from_time(
+ timecode_str_end,
+ sizeof(timecode_str_end),
+ -2,
+ FRA2TIME(SEQ_time_right_handle_frame_get(scene, seq) - scene->r.sfra),
FPS,
USER_TIMECODE_SUBRIP);
- BLI_timecode_string_from_time(timecode_str_end,
- sizeof(timecode_str_end),
- -2,
- FRA2TIME(SEQ_time_right_handle_frame_get(seq) - scene->r.sfra),
- FPS,
- USER_TIMECODE_SUBRIP);
fprintf(
file, "%d\n%s --> %s\n%s\n\n", iter++, timecode_str_start, timecode_str_end, data->text);
@@ -3245,8 +3255,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_time_left_handle_frame_get(seq));
- efra = max_ii(efra, SEQ_time_right_handle_frame_get(seq) - 1);
+ sfra = min_ii(sfra, SEQ_time_left_handle_frame_get(scene, seq));
+ efra = max_ii(efra, SEQ_time_right_handle_frame_get(scene, seq) - 1);
}
}
@@ -3399,7 +3409,7 @@ static int sequencer_strip_transform_fit_exec(bContext *C, wmOperator *op)
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && seq->type != SEQ_TYPE_SOUND_RAM) {
const int timeline_frame = CFRA;
- StripElem *strip_elem = SEQ_render_give_stripelem(seq, timeline_frame);
+ StripElem *strip_elem = SEQ_render_give_stripelem(scene, seq, timeline_frame);
if (strip_elem == NULL) {
continue;
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 3f91be9e9e8..644e897f631 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -70,7 +70,9 @@ void color3ubv_from_seq(const struct Scene *curscene,
void sequencer_special_update_set(Sequence *seq);
/* Get handle width in 2d-View space. */
-float sequence_handle_size_get_clamped(struct Sequence *seq, float pixelx);
+float sequence_handle_size_get_clamped(const struct Scene *scene,
+ struct Sequence *seq,
+ float pixelx);
/* UNUSED */
/* void seq_reset_imageofs(struct SpaceSeq *sseq); */
@@ -113,7 +115,7 @@ void channel_draw_context_init(const struct bContext *C,
/* sequencer_edit.c */
struct View2D;
-void seq_rectf(struct Sequence *seq, struct rctf *rectf);
+void seq_rectf(const struct Scene *scene, struct Sequence *seq, struct rctf *rectf);
struct Sequence *find_nearest_seq(struct Scene *scene,
struct View2D *v2d,
int *hand,
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index f237fbc0a12..cfdbeaf0658 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -59,7 +59,7 @@ SeqCollection *all_strips_from_context(bContext *C)
const bool is_preview = sequencer_view_has_preview_poll(C);
if (is_preview) {
- return SEQ_query_rendered_strips(channels, seqbase, scene->r.cfra, 0);
+ return SEQ_query_rendered_strips(scene, channels, seqbase, scene->r.cfra, 0);
}
return SEQ_query_all_strips(seqbase);
@@ -74,7 +74,7 @@ SeqCollection *selected_strips_from_context(bContext *C)
const bool is_preview = sequencer_view_has_preview_poll(C);
if (is_preview) {
- SeqCollection *strips = SEQ_query_rendered_strips(channels, seqbase, scene->r.cfra, 0);
+ SeqCollection *strips = SEQ_query_rendered_strips(scene, channels, seqbase, scene->r.cfra, 0);
SEQ_filter_selected_strips(strips);
return strips;
}
@@ -108,7 +108,8 @@ static void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRIN
}
/* Used for mouse selection in SEQUENCER_OT_select. */
-static void select_active_side(ListBase *seqbase, int sel_side, int channel, int frame)
+static void select_active_side(
+ const Scene *scene, ListBase *seqbase, int sel_side, int channel, int frame)
{
Sequence *seq;
@@ -116,13 +117,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_time_left_handle_frame_get(seq))) {
+ if (frame > (SEQ_time_left_handle_frame_get(scene, seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_RIGHT:
- if (frame < (SEQ_time_left_handle_frame_get(seq))) {
+ if (frame < (SEQ_time_left_handle_frame_get(scene, seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
@@ -137,7 +138,8 @@ static void select_active_side(ListBase *seqbase, int sel_side, int channel, int
}
/* Used for mouse selection in SEQUENCER_OT_select_side. */
-static void select_active_side_range(ListBase *seqbase,
+static void select_active_side_range(const Scene *scene,
+ ListBase *seqbase,
const int sel_side,
const int frame_ranges[MAXSEQ],
const int frame_ignore)
@@ -152,13 +154,13 @@ static void select_active_side_range(ListBase *seqbase,
}
switch (sel_side) {
case SEQ_SIDE_LEFT:
- if (frame > (SEQ_time_left_handle_frame_get(seq))) {
+ if (frame > (SEQ_time_left_handle_frame_get(scene, seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
break;
case SEQ_SIDE_RIGHT:
- if (frame < (SEQ_time_left_handle_frame_get(seq))) {
+ if (frame < (SEQ_time_left_handle_frame_get(scene, seq))) {
seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
seq->flag |= SELECT;
}
@@ -173,14 +175,14 @@ static void select_active_side_range(ListBase *seqbase,
}
/* Used for mouse selection in SEQUENCER_OT_select */
-static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
+static void select_linked_time(const Scene *scene, ListBase *seqbase, Sequence *seq_link)
{
Sequence *seq;
for (seq = seqbase->first; seq; seq = seq->next) {
if (seq_link->machine != seq->machine) {
- 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;
+ int left_match = (SEQ_time_left_handle_frame_get(scene, seq) == seq_link->startdisp) ? 1 : 0;
+ int right_match = (SEQ_time_right_handle_frame_get(scene, seq) == seq_link->enddisp) ? 1 : 0;
if (left_match && right_match) {
/* Direct match, copy the selection settings. */
@@ -245,10 +247,10 @@ void ED_sequencer_select_sequence_single(Scene *scene, Sequence *seq, bool desel
recurs_sel_seq(seq);
}
-void seq_rectf(Sequence *seq, rctf *rect)
+void seq_rectf(const Scene *scene, Sequence *seq, rctf *rect)
{
- rect->xmin = SEQ_time_left_handle_frame_get(seq);
- rect->xmax = SEQ_time_right_handle_frame_get(seq);
+ rect->xmin = SEQ_time_left_handle_frame_get(scene, seq);
+ rect->xmax = SEQ_time_right_handle_frame_get(scene, seq);
rect->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM;
rect->ymax = seq->machine + SEQ_STRIP_OFSTOP;
}
@@ -273,12 +275,14 @@ 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 (SEQ_time_left_handle_frame_get(test) == (SEQ_time_right_handle_frame_get(seq))) {
+ if (SEQ_time_left_handle_frame_get(scene, test) ==
+ (SEQ_time_right_handle_frame_get(scene, seq))) {
return seq;
}
break;
case SEQ_SIDE_RIGHT:
- if (SEQ_time_right_handle_frame_get(test) == (SEQ_time_left_handle_frame_get(seq))) {
+ if (SEQ_time_right_handle_frame_get(scene, test) ==
+ (SEQ_time_left_handle_frame_get(scene, seq))) {
return seq;
}
break;
@@ -311,18 +315,20 @@ 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_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_time_left_handle_frame_get(scene, seq) <
+ SEQ_time_right_handle_frame_get(scene, seq)) &&
+ (SEQ_time_left_handle_frame_get(scene, seq) <= x &&
+ SEQ_time_right_handle_frame_get(scene, seq) >= x)) ||
+ ((SEQ_time_left_handle_frame_get(scene, seq) >
+ SEQ_time_right_handle_frame_get(scene, seq)) &&
+ (SEQ_time_left_handle_frame_get(scene, seq) >= x &&
+ SEQ_time_right_handle_frame_get(scene, 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_time_left_handle_frame_get(seq) -
- SEQ_time_right_handle_frame_get(seq));
+ handsize = 2.0f * sequence_handle_size_get_clamped(scene, seq, pixelx);
+ displen = (float)abs(SEQ_time_left_handle_frame_get(scene, seq) -
+ SEQ_time_right_handle_frame_get(scene, seq));
/* Don't even try to grab the handles of small strips. */
if (displen / pixelx > 16) {
@@ -337,10 +343,10 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
CLAMP(handsize, 7 * pixelx, 30 * pixelx);
}
- if (handsize + SEQ_time_left_handle_frame_get(seq) >= x) {
+ if (handsize + SEQ_time_left_handle_frame_get(scene, seq) >= x) {
*hand = SEQ_SIDE_LEFT;
}
- else if (-handsize + SEQ_time_right_handle_frame_get(seq) <= x) {
+ else if (-handsize + SEQ_time_right_handle_frame_get(scene, seq) <= x) {
*hand = SEQ_SIDE_RIGHT;
}
}
@@ -583,8 +589,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_time_right_handle_frame_get(seq_iter) <= CFRA)) ||
- ((x >= CFRA) && (SEQ_time_left_handle_frame_get(seq_iter) >= CFRA))) {
+ if (((x < CFRA) && (SEQ_time_right_handle_frame_get(scene, seq_iter) <= CFRA)) ||
+ ((x >= CFRA) && (SEQ_time_left_handle_frame_get(scene, seq_iter) >= CFRA))) {
/* Select left or right. */
seq_iter->flag |= SELECT;
recurs_sel_seq(seq_iter);
@@ -639,8 +645,11 @@ 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_time_left_handle_frame_get(seq));
+ select_active_side(scene,
+ ed->seqbasep,
+ SEQ_SIDE_LEFT,
+ seq->machine,
+ SEQ_time_left_handle_frame_get(scene, seq));
}
else {
seq->flag |= SELECT;
@@ -653,8 +662,11 @@ 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_time_left_handle_frame_get(seq));
+ select_active_side(scene,
+ ed->seqbasep,
+ SEQ_SIDE_RIGHT,
+ seq->machine,
+ SEQ_time_left_handle_frame_get(scene, seq));
}
else {
seq->flag |= SELECT;
@@ -669,7 +681,7 @@ static void sequencer_select_linked_handle(const bContext *C,
else {
select_active_side(
- ed->seqbasep, sel_side, seq->machine, SEQ_time_left_handle_frame_get(seq));
+ scene, ed->seqbasep, sel_side, seq->machine, SEQ_time_left_handle_frame_get(scene, seq));
}
}
}
@@ -734,7 +746,7 @@ static Sequence *seq_select_seq_from_preview(
const bool use_cycle = (!WM_cursor_test_motion_and_update(mval) || extend || toggle);
SeqCollection *strips = SEQ_query_rendered_strips(
- channels, seqbase, scene->r.cfra, sseq->chanshown);
+ scene, channels, seqbase, scene->r.cfra, sseq->chanshown);
/* Allow strips this far from the closest center to be included.
* This allows cycling over center points which are near enough
@@ -921,7 +933,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
ED_sequencer_deselect_all(scene);
}
sequencer_select_strip_impl(ed, seq, handle_clicked, extend, deselect, toggle);
- select_linked_time(ed->seqbasep, seq);
+ select_linked_time(scene, ed->seqbasep, seq);
sequencer_select_do_updates(C, scene);
sequencer_select_set_active(scene, seq);
return OPERATOR_FINISHED;
@@ -1436,13 +1448,13 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op)
bool test = false;
switch (side) {
case -1:
- test = (timeline_frame >= SEQ_time_right_handle_frame_get(seq));
+ test = (timeline_frame >= SEQ_time_right_handle_frame_get(scene, seq));
break;
case 1:
- test = (timeline_frame <= SEQ_time_left_handle_frame_get(seq));
+ test = (timeline_frame <= SEQ_time_left_handle_frame_get(scene, seq));
break;
case 2:
- test = SEQ_time_strip_intersects_frame(seq, timeline_frame);
+ test = SEQ_time_strip_intersects_frame(scene, seq, timeline_frame);
break;
}
@@ -1513,10 +1525,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_time_left_handle_frame_get(seq));
+ *frame_limit_p = max_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(scene, seq));
}
else {
- *frame_limit_p = min_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(seq));
+ *frame_limit_p = min_ii(*frame_limit_p, SEQ_time_left_handle_frame_get(scene, seq));
}
}
}
@@ -1525,7 +1537,7 @@ static int sequencer_select_side_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- select_active_side_range(ed->seqbasep, sel_side, frame_ranges, frame_init);
+ select_active_side_range(scene, ed->seqbasep, sel_side, frame_ranges, frame_init);
ED_outliner_select_sync_from_sequence_tag(C);
@@ -1595,7 +1607,7 @@ static void seq_box_select_seq_from_preview(const bContext *C, rctf *rect, const
SpaceSeq *sseq = CTX_wm_space_seq(C);
SeqCollection *strips = SEQ_query_rendered_strips(
- channels, seqbase, scene->r.cfra, sseq->chanshown);
+ scene, channels, seqbase, scene->r.cfra, sseq->chanshown);
Sequence *seq;
SEQ_ITERATOR_FOREACH (seq, strips) {
if (!seq_box_select_rect_image_isect(scene, seq, rect)) {
@@ -1648,15 +1660,15 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
rctf rq;
- seq_rectf(seq, &rq);
+ seq_rectf(scene, seq, &rq);
if (BLI_rctf_isect(&rq, &rectf, NULL)) {
if (handles) {
/* Get the handles draw size. */
float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
- float handsize = sequence_handle_size_get_clamped(seq, pixelx);
+ float handsize = sequence_handle_size_get_clamped(scene, seq, pixelx);
/* Right handle. */
- if (rectf.xmax > (SEQ_time_right_handle_frame_get(seq) - handsize)) {
+ if (rectf.xmax > (SEQ_time_right_handle_frame_get(scene, seq) - handsize)) {
if (select) {
seq->flag |= SELECT | SEQ_RIGHTSEL;
}
@@ -1669,7 +1681,7 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
}
}
/* Left handle. */
- if (rectf.xmin < (SEQ_time_left_handle_frame_get(seq) + handsize)) {
+ if (rectf.xmin < (SEQ_time_left_handle_frame_get(scene, seq) + handsize)) {
if (select) {
seq->flag |= SELECT | SEQ_LEFTSEL;
}
@@ -1953,7 +1965,8 @@ static bool select_grouped_effect(SeqCollection *strips,
return changed;
}
-static bool select_grouped_time_overlap(SeqCollection *strips,
+static bool select_grouped_time_overlap(const Scene *scene,
+ SeqCollection *strips,
ListBase *UNUSED(seqbase),
Sequence *actseq)
{
@@ -1961,8 +1974,10 @@ static bool select_grouped_time_overlap(SeqCollection *strips,
Sequence *seq;
SEQ_ITERATOR_FOREACH (seq, strips) {
- 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)) {
+ if (SEQ_time_left_handle_frame_get(scene, seq) <
+ SEQ_time_right_handle_frame_get(scene, actseq) &&
+ SEQ_time_right_handle_frame_get(scene, seq) >
+ SEQ_time_left_handle_frame_get(scene, actseq)) {
seq->flag |= SELECT;
changed = true;
}
@@ -1972,7 +1987,8 @@ static bool select_grouped_time_overlap(SeqCollection *strips,
}
/* Query strips that are in lower channel and intersect in time with seq_reference. */
-static void query_lower_channel_strips(Sequence *seq_reference,
+static void query_lower_channel_strips(const Scene *scene,
+ Sequence *seq_reference,
ListBase *seqbase,
SeqCollection *collection)
{
@@ -1980,10 +1996,10 @@ static void query_lower_channel_strips(Sequence *seq_reference,
if (seq_test->machine > seq_reference->machine) {
continue; /* Not lower channel. */
}
- 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)) {
+ if (SEQ_time_right_handle_frame_get(scene, seq_test) <=
+ SEQ_time_left_handle_frame_get(scene, seq_reference) ||
+ SEQ_time_left_handle_frame_get(scene, seq_test) >=
+ SEQ_time_right_handle_frame_get(scene, seq_reference)) {
continue; /* Not intersecting in time. */
}
SEQ_collection_append_strip(seq_test, collection);
@@ -1992,7 +2008,8 @@ static void query_lower_channel_strips(Sequence *seq_reference,
/* Select all strips within time range and with lower channel of initial selection. Then select
* effect chains of these strips. */
-static bool select_grouped_effect_link(SeqCollection *strips,
+static bool select_grouped_effect_link(const Scene *scene,
+ SeqCollection *strips,
ListBase *seqbase,
Sequence *UNUSED(actseq),
const int UNUSED(channel))
@@ -2000,8 +2017,10 @@ static bool select_grouped_effect_link(SeqCollection *strips,
/* Get collection of strips. */
SEQ_filter_selected_strips(strips);
const int selected_strip_count = SEQ_collection_len(strips);
- SEQ_collection_expand(seqbase, strips, query_lower_channel_strips);
- SEQ_collection_expand(seqbase, strips, SEQ_query_strip_effect_chain);
+ // XXX this uses scene as arg, so it does not work with iterator :( I had thought about this, but
+ // expand function is just so useful... I can just add scene and inject it I guess.....
+ SEQ_collection_expand(scene, seqbase, strips, query_lower_channel_strips);
+ SEQ_collection_expand(scene, seqbase, strips, SEQ_query_strip_effect_chain);
/* Check if other strips will be affected. */
const bool changed = SEQ_collection_len(strips) > selected_strip_count;
@@ -2067,10 +2086,10 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
changed |= select_grouped_effect(strips, seqbase, actseq, channel);
break;
case SEQ_SELECT_GROUP_EFFECT_LINK:
- changed |= select_grouped_effect_link(strips, seqbase, actseq, channel);
+ changed |= select_grouped_effect_link(scene, strips, seqbase, actseq, channel);
break;
case SEQ_SELECT_GROUP_OVERLAP:
- changed |= select_grouped_time_overlap(strips, seqbase, actseq);
+ changed |= select_grouped_time_overlap(scene, strips, seqbase, actseq);
break;
default:
BLI_assert(0);
diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.c b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
index 5c929e6673a..a11b5663620 100644
--- a/source/blender/editors/space_sequencer/sequencer_thumbnails.c
+++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.c
@@ -69,15 +69,16 @@ static void thumbnail_endjob(void *data)
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, tj->scene);
}
-static bool check_seq_need_thumbnails(Sequence *seq, rctf *view_area)
+static bool check_seq_need_thumbnails(const Scene *scene, Sequence *seq, rctf *view_area)
{
if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) {
return false;
}
- if (min_ii(SEQ_time_left_handle_frame_get(seq), seq->start) > view_area->xmax) {
+ if (min_ii(SEQ_time_left_handle_frame_get(scene, seq), seq->start) > view_area->xmax) {
return false;
}
- if (max_ii(SEQ_time_right_handle_frame_get(seq), seq->start + seq->len) < view_area->xmin) {
+ if (max_ii(SEQ_time_right_handle_frame_get(scene, seq), seq->start + seq->len) <
+ view_area->xmin) {
return false;
}
if (seq->machine + 1.0f < view_area->ymin) {
@@ -135,6 +136,7 @@ static void thumbnail_start_job(void *data,
float *UNUSED(progress))
{
ThumbnailDrawJob *tj = data;
+ const Scene *scene = tj->scene;
float frame_step;
GHashIterator gh_iter;
@@ -145,7 +147,7 @@ static void thumbnail_start_job(void *data,
Sequence *seq_orig = BLI_ghashIterator_getKey(&gh_iter);
ThumbDataItem *val = BLI_ghash_lookup(tj->sequences_ghash, seq_orig);
- if (check_seq_need_thumbnails(seq_orig, tj->view_area)) {
+ if (check_seq_need_thumbnails(scene, seq_orig, tj->view_area)) {
seq_get_thumb_image_dimensions(
val->seq_dupli, tj->pixelx, tj->pixely, &frame_step, tj->thumb_height, NULL, NULL);
SEQ_render_thumbnails(
@@ -161,7 +163,7 @@ static void thumbnail_start_job(void *data,
Sequence *seq_orig = BLI_ghashIterator_getKey(&gh_iter);
ThumbDataItem *val = BLI_ghash_lookup(tj->sequences_ghash, seq_orig);
- if (check_seq_need_thumbnails(seq_orig, tj->view_area)) {
+ if (check_seq_need_thumbnails(scene, seq_orig, tj->view_area)) {
seq_get_thumb_image_dimensions(
val->seq_dupli, tj->pixelx, tj->pixely, &frame_step, tj->thumb_height, NULL, NULL);
SEQ_render_thumbnails_base_set(&tj->context, val->seq_dupli, seq_orig, tj->view_area, stop);
@@ -197,7 +199,7 @@ static GHash *sequencer_thumbnail_ghash_init(const bContext *C, View2D *v2d, Edi
LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
ThumbDataItem *val_need_update = BLI_ghash_lookup(thumb_data_hash, seq);
- if (val_need_update == NULL && check_seq_need_thumbnails(seq, &v2d->cur)) {
+ if (val_need_update == NULL && check_seq_need_thumbnails(scene, seq, &v2d->cur)) {
ThumbDataItem *val = MEM_callocN(sizeof(ThumbDataItem), "Thumbnail Hash Values");
val->seq_dupli = SEQ_sequence_dupli_recursive(scene, scene, NULL, seq, 0);
val->scene = scene;
@@ -206,7 +208,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_time_left_handle_frame_get(seq);
+ val_need_update->seq_dupli->startdisp = SEQ_time_left_handle_frame_get(scene, seq);
}
}
}
@@ -361,18 +363,20 @@ static int sequencer_thumbnail_closest_previous_frame_get(int timeline_frame,
return best_frame;
}
-static int sequencer_thumbnail_closest_guaranteed_frame_get(Sequence *seq, int timeline_frame)
+static int sequencer_thumbnail_closest_guaranteed_frame_get(struct Scene *scene,
+ Sequence *seq,
+ int timeline_frame)
{
- if (timeline_frame <= SEQ_time_left_handle_frame_get(seq)) {
- return SEQ_time_left_handle_frame_get(seq);
+ if (timeline_frame <= SEQ_time_left_handle_frame_get(scene, seq)) {
+ return SEQ_time_left_handle_frame_get(scene, seq);
}
/* Set of "guaranteed" thumbnails. */
- 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 frame_index = timeline_frame - SEQ_time_left_handle_frame_get(scene, seq);
+ const int frame_step = SEQ_render_thumbnails_guaranteed_set_frame_step_get(scene, 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_time_left_handle_frame_get(seq);
+ SEQ_time_left_handle_frame_get(scene, seq);
return nearest_guaranted_absolute_frame;
}
@@ -387,7 +391,8 @@ static ImBuf *sequencer_thumbnail_closest_from_memory(const SeqRenderData *conte
previously_displayed);
ImBuf *ibuf_previous = SEQ_get_thumbnail(context, seq, frame_previous, crop, clipped);
- int frame_guaranteed = sequencer_thumbnail_closest_guaranteed_frame_get(seq, timeline_frame);
+ int frame_guaranteed = sequencer_thumbnail_closest_guaranteed_frame_get(
+ context->scene, seq, timeline_frame);
ImBuf *ibuf_guaranteed = SEQ_get_thumbnail(context, seq, frame_guaranteed, crop, clipped);
ImBuf *closest_in_memory = NULL;
@@ -450,14 +455,14 @@ 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) ?
+ float upper_thumb_bound = SEQ_time_has_right_still_frames(scene, seq) ?
(seq->start + seq->len) :
- SEQ_time_right_handle_frame_get(seq);
+ SEQ_time_right_handle_frame_get(scene, seq);
if (seq->type == SEQ_TYPE_IMAGE) {
- upper_thumb_bound = SEQ_time_right_handle_frame_get(seq);
+ upper_thumb_bound = SEQ_time_right_handle_frame_get(scene, seq);
}
- float timeline_frame = SEQ_render_thumbnail_first_frame_get(seq, thumb_width, &v2d->cur);
+ float timeline_frame = SEQ_render_thumbnail_first_frame_get(scene, seq, thumb_width, &v2d->cur);
float thumb_x_end;
GSet *last_displayed_thumbnails = last_displayed_thumbnails_list_ensure(C, seq);
@@ -480,8 +485,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_time_left_handle_frame_get(seq), timeline_frame, thumb_x_end)) {
- cut_off = SEQ_time_left_handle_frame_get(seq) - timeline_frame;
+ if (IN_RANGE_INCL(SEQ_time_left_handle_frame_get(scene, seq), timeline_frame, thumb_x_end)) {
+ cut_off = SEQ_time_left_handle_frame_get(scene, seq) - timeline_frame;
clipped = true;
}
@@ -558,7 +563,7 @@ void draw_seq_strip_thumbnail(View2D *v2d,
IMB_freeImBuf(ibuf);
GPU_blend(GPU_BLEND_NONE);
cut_off = 0;
- timeline_frame = SEQ_render_thumbnail_next_frame_get(seq, timeline_frame, thumb_width);
+ timeline_frame = SEQ_render_thumbnail_next_frame_get(scene, seq, timeline_frame, thumb_width);
}
last_displayed_thumbnails_list_cleanup(last_displayed_thumbnails, timeline_frame, FLT_MAX);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index f7ca753c052..4d32c00109a 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -84,7 +84,7 @@ static int sequencer_view_all_exec(bContext *C, wmOperator *op)
box.xmin = ms->disp_range[0] - 1;
box.xmax = ms->disp_range[1] + 1;
}
- SEQ_timeline_expand_boundbox(SEQ_active_seqbase_get(ed), &box);
+ SEQ_timeline_expand_boundbox(scene, SEQ_active_seqbase_get(ed), &box);
View2D *v2d = &region->v2d;
rcti scrub_rect;
@@ -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_time_left_handle_frame_get(seq));
- xmax = max_ii(xmax, SEQ_time_right_handle_frame_get(seq));
+ xmin = min_ii(xmin, SEQ_time_left_handle_frame_get(scene, seq));
+ xmax = max_ii(xmax, SEQ_time_right_handle_frame_get(scene, seq));
ymin = min_ii(ymin, seq->machine);
ymax = max_ii(ymax, seq->machine);
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index f95c5f196b6..0199fa81928 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -548,7 +548,8 @@ static void sequencer_main_clamp_view(const bContext *C, ARegion *region)
}
View2D *v2d = &region->v2d;
- Editing *ed = SEQ_editing_get(CTX_data_scene(C));
+ Scene *scene = CTX_data_scene(C);
+ Editing *ed = SEQ_editing_get(scene);
if (ed == NULL) {
return;
@@ -563,7 +564,7 @@ static void sequencer_main_clamp_view(const bContext *C, ARegion *region)
/* Initialize default view with 7 channels, that are visible even if empty. */
rctf strip_boundbox;
BLI_rctf_init(&strip_boundbox, 0.0f, 0.0f, 1.0f, 7.0f);
- SEQ_timeline_expand_boundbox(ed->seqbasep, &strip_boundbox);
+ SEQ_timeline_expand_boundbox(scene, ed->seqbasep, &strip_boundbox);
/* Clamp Y max. Scrubbing area height must be added, so strips aren't occluded. */
rcti scrub_rect;