Cleanup: VSE: Rename Strip::machine to channel
This should make VSE code more readable and easier to understand from an outside perspective. The name was chosen to be `channel` rather than `channel_index` to keep things short and concise -- it should be clear based on the context whether we are talking about the strip's channel index (singular case, `Strip::channel` or `SeqTimelineChannel::index`) vs. the channel list (plural case, e.g. `Editing::channels`). Pull Request: https://projects.blender.org/blender/blender/pulls/138919
This commit is contained in:
committed by
John Kiril Swenson
parent
1858eba473
commit
35cab63eaf
@@ -210,7 +210,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
|
||||
}
|
||||
|
||||
if (tgt) {
|
||||
return (type == STRIP_TYPE_MOVIE) ? tgt->machine - 1 : tgt->machine;
|
||||
return (type == STRIP_TYPE_MOVIE) ? tgt->channel - 1 : tgt->channel;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -915,7 +915,7 @@ static void sequencer_add_movie_multiple_strips(bContext *C,
|
||||
/* The video has sound, shift the video strip up a channel to make room for the sound
|
||||
* strip. */
|
||||
added_strips.append(strip_sound);
|
||||
seq::strip_channel_set(strip_movie, strip_movie->machine + 1);
|
||||
seq::strip_channel_set(strip_movie, strip_movie->channel + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,7 +977,7 @@ static bool sequencer_add_movie_single_strip(bContext *C,
|
||||
added_strips.append(strip_sound);
|
||||
/* The video has sound, shift the video strip up a channel to make room for the sound
|
||||
* strip. */
|
||||
seq::strip_channel_set(strip_movie, strip_movie->machine + 1);
|
||||
seq::strip_channel_set(strip_movie, strip_movie->channel + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1540,7 +1540,7 @@ static wmOperatorStatus sequencer_add_effect_strip_exec(bContext *C, wmOperator
|
||||
/* Set channel. If unset, use lowest free one above strips. */
|
||||
if (!RNA_struct_property_is_set(op->ptr, "channel")) {
|
||||
if (input1 != nullptr) {
|
||||
int chan = max_ii(input1 ? input1->machine : 0, input2 ? input2->machine : 0);
|
||||
int chan = max_ii(input1 ? input1->channel : 0, input2 ? input2->channel : 0);
|
||||
if (chan < seq::MAX_CHANNELS) {
|
||||
load_data.channel = chan;
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ static float update_overlay_strip_position_data(bContext *C, const int mval[2])
|
||||
|
||||
for (int i = 0; i < coords->channel_len && !coords->is_intersecting; i++) {
|
||||
coords->is_intersecting = seq::transform_test_overlap(scene, ed->seqbasep, &dummy_strip);
|
||||
seq::strip_channel_set(&dummy_strip, dummy_strip.machine + 1);
|
||||
seq::strip_channel_set(&dummy_strip, dummy_strip.channel + 1);
|
||||
}
|
||||
|
||||
return strip_len;
|
||||
@@ -276,7 +276,7 @@ static void sequencer_drop_copy(bContext *C, wmDrag *drag, wmDropBox *drop)
|
||||
/* Get the top most strip channel that is in view. */
|
||||
int max_channel = -1;
|
||||
for (Strip *strip : strips) {
|
||||
max_channel = max_ii(strip->machine, max_channel);
|
||||
max_channel = max_ii(strip->channel, max_channel);
|
||||
}
|
||||
|
||||
if (max_channel != -1) {
|
||||
|
||||
@@ -1508,7 +1508,7 @@ static wmOperatorStatus sequencer_split_exec(bContext *C, wmOperator *op)
|
||||
seq::prefetch_stop(scene);
|
||||
|
||||
LISTBASE_FOREACH_BACKWARD (Strip *, strip, ed->seqbasep) {
|
||||
if (use_cursor_position && strip->machine != split_channel) {
|
||||
if (use_cursor_position && strip->channel != split_channel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1530,7 +1530,7 @@ static wmOperatorStatus sequencer_split_exec(bContext *C, wmOperator *op)
|
||||
if (use_cursor_position) {
|
||||
LISTBASE_FOREACH (Strip *, strip, seq::active_seqbase_get(ed)) {
|
||||
if (seq::time_right_handle_frame_get(scene, strip) == split_frame &&
|
||||
strip->machine == split_channel)
|
||||
strip->channel == split_channel)
|
||||
{
|
||||
strip_selected = strip->flag & STRIP_ALLSEL;
|
||||
}
|
||||
@@ -1538,7 +1538,7 @@ static wmOperatorStatus sequencer_split_exec(bContext *C, wmOperator *op)
|
||||
if (!strip_selected) {
|
||||
LISTBASE_FOREACH (Strip *, strip, seq::active_seqbase_get(ed)) {
|
||||
if (seq::time_left_handle_frame_get(scene, strip) == split_frame &&
|
||||
strip->machine == split_channel)
|
||||
strip->channel == split_channel)
|
||||
{
|
||||
strip->flag &= ~STRIP_ALLSEL;
|
||||
}
|
||||
@@ -2138,8 +2138,8 @@ static wmOperatorStatus sequencer_meta_make_exec(bContext *C, wmOperator * /*op*
|
||||
seq::relations_invalidate_cache(scene, strip);
|
||||
BLI_remlink(active_seqbase, strip);
|
||||
BLI_addtail(&strip_meta->seqbase, strip);
|
||||
channel_max = max_ii(strip->machine, channel_max);
|
||||
channel_min = min_ii(strip->machine, channel_min);
|
||||
channel_max = max_ii(strip->channel, channel_max);
|
||||
channel_min = min_ii(strip->channel, channel_min);
|
||||
meta_start_frame = min_ii(seq::time_left_handle_frame_get(scene, strip), meta_start_frame);
|
||||
meta_end_frame = max_ii(seq::time_right_handle_frame_get(scene, strip), meta_end_frame);
|
||||
}
|
||||
@@ -2153,7 +2153,7 @@ static wmOperatorStatus sequencer_meta_make_exec(bContext *C, wmOperator * /*op*
|
||||
channel_meta->flag = channel_cur->flag;
|
||||
}
|
||||
|
||||
const int channel = active_strip ? active_strip->machine : channel_max;
|
||||
const int channel = active_strip ? active_strip->channel : channel_max;
|
||||
seq::strip_channel_set(strip_meta, channel);
|
||||
BLI_strncpy(strip_meta->name + 2, DATA_("MetaStrip"), sizeof(strip_meta->name) - 2);
|
||||
seq::strip_unique_name_set(scene, &ed->seqbase, strip_meta);
|
||||
@@ -2363,7 +2363,7 @@ static Strip *find_next_prev_strip(Scene *scene, Strip *test, int lr, int sel)
|
||||
|
||||
strip = static_cast<Strip *>(ed->seqbasep->first);
|
||||
while (strip) {
|
||||
if ((strip != test) && (test->machine == strip->machine) &&
|
||||
if ((strip != test) && (test->channel == strip->channel) &&
|
||||
((sel == -1) || (sel == (strip->flag & SELECT))))
|
||||
{
|
||||
dist = MAXFRAME * 2;
|
||||
@@ -3063,7 +3063,7 @@ static int strip_cmp_time_startdisp_channel(void *thunk, const void *a, const vo
|
||||
|
||||
/* If strips have the same start frame favor the one with a higher channel. */
|
||||
if (strip_a_start == strip_b_start) {
|
||||
return strip_a->machine > strip_b->machine;
|
||||
return strip_a->channel > strip_b->channel;
|
||||
}
|
||||
|
||||
return (strip_a_start > strip_b_start);
|
||||
|
||||
@@ -916,7 +916,7 @@ wmOperatorStatus sequencer_retiming_box_select_exec(bContext *C, wmOperator *op)
|
||||
blender::Set<SeqRetimingKey *> and_keys;
|
||||
|
||||
for (Strip *strip : sequencer_visible_strips_get(C)) {
|
||||
if (strip->machine < rectf.ymin || strip->machine > rectf.ymax) {
|
||||
if (strip->channel < rectf.ymin || strip->channel > rectf.ymax) {
|
||||
continue;
|
||||
}
|
||||
if (!seq::retiming_data_is_editable(strip)) {
|
||||
|
||||
@@ -51,7 +51,7 @@ bool retiming_keys_can_be_displayed(const SpaceSeq *sseq)
|
||||
static float strip_y_rescale(const Strip *strip, const float y_value)
|
||||
{
|
||||
const float y_range = STRIP_OFSTOP - STRIP_OFSBOTTOM;
|
||||
return (y_value * y_range) + strip->machine + STRIP_OFSBOTTOM;
|
||||
return (y_value * y_range) + strip->channel + STRIP_OFSBOTTOM;
|
||||
}
|
||||
|
||||
static float key_x_get(const Scene *scene, const Strip *strip, const SeqRetimingKey *key)
|
||||
|
||||
@@ -83,7 +83,7 @@ Strip *strip_under_mouse_get(const Scene *scene, const View2D *v2d, const int mv
|
||||
blender::Vector<Strip *> visible = sequencer_visible_strips_get(scene, v2d);
|
||||
int mouse_channel = int(mouse_co[1]);
|
||||
for (Strip *strip : visible) {
|
||||
if (strip->machine != mouse_channel) {
|
||||
if (strip->channel != mouse_channel) {
|
||||
continue;
|
||||
}
|
||||
rctf body;
|
||||
@@ -161,7 +161,7 @@ static void select_active_side(
|
||||
{
|
||||
|
||||
LISTBASE_FOREACH (Strip *, strip, seqbase) {
|
||||
if (channel == strip->machine) {
|
||||
if (channel == strip->channel) {
|
||||
switch (sel_side) {
|
||||
case seq::SIDE_LEFT:
|
||||
if (frame > seq::time_left_handle_frame_get(scene, strip)) {
|
||||
@@ -192,8 +192,8 @@ static void select_active_side_range(const Scene *scene,
|
||||
const int frame_ignore)
|
||||
{
|
||||
LISTBASE_FOREACH (Strip *, strip, seqbase) {
|
||||
if (strip->machine < seq::MAX_CHANNELS) {
|
||||
const int frame = frame_ranges[strip->machine];
|
||||
if (strip->channel < seq::MAX_CHANNELS) {
|
||||
const int frame = frame_ranges[strip->channel];
|
||||
if (frame == frame_ignore) {
|
||||
continue;
|
||||
}
|
||||
@@ -229,7 +229,7 @@ static void select_linked_time_strip(const Scene *scene,
|
||||
int source_right = seq::time_right_handle_frame_get(scene, strip_source);
|
||||
|
||||
LISTBASE_FOREACH (Strip *, strip_dest, seqbase) {
|
||||
if (strip_source->machine != strip_dest->machine) {
|
||||
if (strip_source->channel != strip_dest->channel) {
|
||||
const bool left_match = (seq::time_left_handle_frame_get(scene, strip_dest) == source_left);
|
||||
const bool right_match = (seq::time_right_handle_frame_get(scene, strip_dest) ==
|
||||
source_right);
|
||||
@@ -295,8 +295,8 @@ void strip_rectf(const Scene *scene, const Strip *strip, rctf *r_rect)
|
||||
{
|
||||
r_rect->xmin = seq::time_left_handle_frame_get(scene, strip);
|
||||
r_rect->xmax = seq::time_right_handle_frame_get(scene, strip);
|
||||
r_rect->ymin = strip->machine + STRIP_OFSBOTTOM;
|
||||
r_rect->ymax = strip->machine + STRIP_OFSTOP;
|
||||
r_rect->ymin = strip->channel + STRIP_OFSBOTTOM;
|
||||
r_rect->ymax = strip->channel + STRIP_OFSTOP;
|
||||
}
|
||||
|
||||
Strip *find_neighboring_strip(Scene *scene, Strip *test, int lr, int sel)
|
||||
@@ -312,7 +312,7 @@ Strip *find_neighboring_strip(Scene *scene, Strip *test, int lr, int sel)
|
||||
sel = SELECT;
|
||||
}
|
||||
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) {
|
||||
if ((strip != test) && (test->machine == strip->machine) &&
|
||||
if ((strip != test) && (test->channel == strip->channel) &&
|
||||
((sel == -1) || (sel && (strip->flag & SELECT)) ||
|
||||
(sel == 0 && (strip->flag & SELECT) == 0)))
|
||||
{
|
||||
@@ -633,7 +633,7 @@ static void sequencer_select_linked_handle(const bContext *C,
|
||||
select_active_side(scene,
|
||||
ed->seqbasep,
|
||||
seq::SIDE_LEFT,
|
||||
strip->machine,
|
||||
strip->channel,
|
||||
seq::time_left_handle_frame_get(scene, strip));
|
||||
}
|
||||
else {
|
||||
@@ -650,7 +650,7 @@ static void sequencer_select_linked_handle(const bContext *C,
|
||||
select_active_side(scene,
|
||||
ed->seqbasep,
|
||||
seq::SIDE_RIGHT,
|
||||
strip->machine,
|
||||
strip->channel,
|
||||
seq::time_left_handle_frame_get(scene, strip));
|
||||
}
|
||||
else {
|
||||
@@ -668,7 +668,7 @@ static void sequencer_select_linked_handle(const bContext *C,
|
||||
select_active_side(scene,
|
||||
ed->seqbasep,
|
||||
sel_side,
|
||||
strip->machine,
|
||||
strip->channel,
|
||||
seq::time_left_handle_frame_get(scene, strip));
|
||||
}
|
||||
}
|
||||
@@ -687,11 +687,11 @@ static int strip_sort_for_depth_select(const void *a, const void *b)
|
||||
const SeqSelect_Link *slink_a = static_cast<const SeqSelect_Link *>(a);
|
||||
const SeqSelect_Link *slink_b = static_cast<const SeqSelect_Link *>(b);
|
||||
|
||||
/* Exactly overlapping strips, sort by machine (so the top-most is first). */
|
||||
if (slink_a->strip->machine < slink_b->strip->machine) {
|
||||
/* Exactly overlapping strips, sort by channel (so the top-most is first). */
|
||||
if (slink_a->strip->channel < slink_b->strip->channel) {
|
||||
return 1;
|
||||
}
|
||||
if (slink_a->strip->machine > slink_b->strip->machine) {
|
||||
if (slink_a->strip->channel > slink_b->strip->channel) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -1028,7 +1028,7 @@ static blender::Vector<Strip *> padded_strips_under_mouse_get(const Scene *scene
|
||||
|
||||
blender::Vector<Strip *> strips;
|
||||
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) {
|
||||
if (strip->machine != int(mouse_co[1])) {
|
||||
if (strip->channel != int(mouse_co[1])) {
|
||||
continue;
|
||||
}
|
||||
if (seq::time_left_handle_frame_get(scene, strip) > v2d->cur.xmax) {
|
||||
@@ -1970,10 +1970,10 @@ static wmOperatorStatus sequencer_select_side_exec(bContext *C, wmOperator *op)
|
||||
copy_vn_i(frame_ranges, ARRAY_SIZE(frame_ranges), frame_init);
|
||||
|
||||
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) {
|
||||
if (UNLIKELY(strip->machine >= seq::MAX_CHANNELS)) {
|
||||
if (UNLIKELY(strip->channel >= seq::MAX_CHANNELS)) {
|
||||
continue;
|
||||
}
|
||||
int *frame_limit_p = &frame_ranges[strip->machine];
|
||||
int *frame_limit_p = &frame_ranges[strip->channel];
|
||||
if (strip->flag & SELECT) {
|
||||
selected = true;
|
||||
if (sel_side == seq::SIDE_LEFT) {
|
||||
@@ -2308,7 +2308,7 @@ static const EnumPropertyItem sequencer_prop_select_grouped_types[] = {
|
||||
(ELEM(_strip->type, STRIP_TYPE_SCENE, STRIP_TYPE_MOVIECLIP, STRIP_TYPE_MASK) || \
|
||||
STRIP_HAS_PATH(_strip))
|
||||
|
||||
#define STRIP_CHANNEL_CHECK(_strip, _chan) ELEM((_chan), 0, (_strip)->machine)
|
||||
#define STRIP_CHANNEL_CHECK(_strip, _chan) ELEM((_chan), 0, (_strip)->channel)
|
||||
|
||||
static bool select_grouped_type(blender::Span<Strip *> strips,
|
||||
ListBase * /*seqbase*/,
|
||||
@@ -2489,7 +2489,7 @@ static void query_lower_channel_strips(const Scene *scene,
|
||||
blender::VectorSet<Strip *> &strips)
|
||||
{
|
||||
LISTBASE_FOREACH (Strip *, strip_test, seqbase) {
|
||||
if (strip_test->machine > strip_reference->machine) {
|
||||
if (strip_test->channel > strip_reference->channel) {
|
||||
continue; /* Not lower channel. */
|
||||
}
|
||||
if (seq::time_right_handle_frame_get(scene, strip_test) <=
|
||||
@@ -2553,7 +2553,7 @@ static wmOperatorStatus sequencer_select_grouped_exec(bContext *C, wmOperator *o
|
||||
}
|
||||
|
||||
const int type = RNA_enum_get(op->ptr, "type");
|
||||
const int channel = RNA_boolean_get(op->ptr, "use_active_channel") ? act_strip->machine : 0;
|
||||
const int channel = RNA_boolean_get(op->ptr, "use_active_channel") ? act_strip->channel : 0;
|
||||
const bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
|
||||
bool changed = false;
|
||||
|
||||
@@ -99,10 +99,10 @@ Vector<Strip *> sequencer_visible_strips_get(const Scene *scene, const View2D *v
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (strip->machine + 1.0f < v2d->cur.ymin) {
|
||||
if (strip->channel + 1.0f < v2d->cur.ymin) {
|
||||
continue;
|
||||
}
|
||||
if (strip->machine > v2d->cur.ymax) {
|
||||
if (strip->channel > v2d->cur.ymax) {
|
||||
continue;
|
||||
}
|
||||
strips.append(strip);
|
||||
@@ -212,8 +212,8 @@ static StripDrawContext strip_draw_context_get(TimelineDrawContext *ctx, Strip *
|
||||
Scene *scene = ctx->scene;
|
||||
|
||||
strip_ctx.strip = strip;
|
||||
strip_ctx.bottom = strip->machine + STRIP_OFSBOTTOM;
|
||||
strip_ctx.top = strip->machine + STRIP_OFSTOP;
|
||||
strip_ctx.bottom = strip->channel + STRIP_OFSBOTTOM;
|
||||
strip_ctx.top = strip->channel + STRIP_OFSTOP;
|
||||
strip_ctx.left_handle = seq::time_left_handle_frame_get(scene, strip);
|
||||
strip_ctx.right_handle = seq::time_right_handle_frame_get(scene, strip);
|
||||
strip_ctx.content_start = seq::time_start_frame_get(strip);
|
||||
@@ -673,8 +673,8 @@ static void drawmeta_contents(TimelineDrawContext *timeline_ctx,
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (Strip *, strip, meta_seqbase) {
|
||||
chan_min = min_ii(chan_min, strip->machine);
|
||||
chan_max = max_ii(chan_max, strip->machine);
|
||||
chan_min = min_ii(chan_min, strip->channel);
|
||||
chan_max = max_ii(chan_max, strip->channel);
|
||||
}
|
||||
|
||||
chan_range = (chan_max - chan_min) + 1;
|
||||
@@ -690,7 +690,7 @@ static void drawmeta_contents(TimelineDrawContext *timeline_ctx,
|
||||
float x1_chan = seq::time_left_handle_frame_get(scene, strip) + offset;
|
||||
float x2_chan = seq::time_right_handle_frame_get(scene, strip) + offset;
|
||||
if (x1_chan <= meta_x2 && x2_chan >= meta_x1) {
|
||||
float y_chan = (strip->machine - chan_min) / float(chan_range) * draw_range;
|
||||
float y_chan = (strip->channel - chan_min) / float(chan_range) * draw_range;
|
||||
float y1_chan, y2_chan;
|
||||
|
||||
if (strip->type == STRIP_TYPE_COLOR) {
|
||||
@@ -1696,7 +1696,7 @@ static void draw_cache_source_iter_fn(void *userdata, const Strip *strip, int ti
|
||||
CacheDrawData *drawdata = static_cast<CacheDrawData *>(userdata);
|
||||
|
||||
const uchar4 col{255, 25, 5, 100};
|
||||
float stripe_bot = strip->machine + STRIP_OFSBOTTOM + drawdata->stripe_ofs_y;
|
||||
float stripe_bot = strip->channel + STRIP_OFSBOTTOM + drawdata->stripe_ofs_y;
|
||||
float stripe_top = stripe_bot + drawdata->stripe_ht;
|
||||
drawdata->quads->add_quad(timeline_frame, stripe_bot, timeline_frame + 1, stripe_top, col);
|
||||
}
|
||||
@@ -1747,7 +1747,7 @@ static void draw_cache_background(const bContext *C, CacheDrawData *draw_data)
|
||||
strips.remove_if([&](Strip *strip) { return strip->type == STRIP_TYPE_SOUND_RAM; });
|
||||
|
||||
for (const Strip *strip : strips) {
|
||||
stripe_bot = strip->machine + STRIP_OFSBOTTOM + draw_data->stripe_ofs_y;
|
||||
stripe_bot = strip->channel + STRIP_OFSBOTTOM + draw_data->stripe_ofs_y;
|
||||
if (sseq->cache_overlay.flag & SEQ_CACHE_SHOW_RAW) {
|
||||
draw_cache_stripe(scene, strip, *draw_data->quads, stripe_bot, draw_data->stripe_ht, bg_raw);
|
||||
}
|
||||
|
||||
@@ -331,9 +331,9 @@ static void seq_view_collection_rect_timeline(const bContext *C,
|
||||
xmin = min_ii(xmin, seq::time_left_handle_frame_get(scene, strip));
|
||||
xmax = max_ii(xmax, seq::time_right_handle_frame_get(scene, strip));
|
||||
|
||||
ymin = min_ii(ymin, strip->machine);
|
||||
ymin = min_ii(ymin, strip->channel);
|
||||
/* "+1" because each channel has a thickness of 1. */
|
||||
ymax = max_ii(ymax, strip->machine + 1);
|
||||
ymax = max_ii(ymax, strip->channel + 1);
|
||||
}
|
||||
|
||||
xmax += xmargin;
|
||||
|
||||
@@ -191,7 +191,7 @@ static TransData *SeqToTransData(Scene *scene,
|
||||
break;
|
||||
}
|
||||
|
||||
td2d->loc[1] = strip->machine; /* Channel - Y location. */
|
||||
td2d->loc[1] = strip->channel; /* Channel - Y location. */
|
||||
td2d->loc[2] = 0.0f;
|
||||
td2d->loc2d = nullptr;
|
||||
|
||||
@@ -510,8 +510,8 @@ static void createTransSeqData(bContext * /*C*/, TransInfo *t)
|
||||
ts->selection_channel_range_min = seq::MAX_CHANNELS + 1;
|
||||
LISTBASE_FOREACH (Strip *, strip, seq::active_seqbase_get(ed)) {
|
||||
if ((strip->flag & SELECT) != 0) {
|
||||
ts->selection_channel_range_min = min_ii(ts->selection_channel_range_min, strip->machine);
|
||||
ts->selection_channel_range_max = max_ii(ts->selection_channel_range_max, strip->machine);
|
||||
ts->selection_channel_range_min = min_ii(ts->selection_channel_range_min, strip->channel);
|
||||
ts->selection_channel_range_max = max_ii(ts->selection_channel_range_max, strip->channel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ static int transform_seq_slide_cursor_get(TransInfo *t)
|
||||
SWAP(Strip *, strip1, strip2);
|
||||
}
|
||||
|
||||
if (strip1->machine != strip2->machine) {
|
||||
if (strip1->channel != strip2->channel) {
|
||||
return WM_CURSOR_NSEW_SCROLL;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@
|
||||
*
|
||||
* Note on terminology
|
||||
* - #Strip: video/effect/audio data you can select and manipulate in the sequencer.
|
||||
* - #Strip.machine: Strange name for the channel.
|
||||
* - #StripData: The data referenced by the #Strip
|
||||
* - Meta Strip (STRIP_TYPE_META): Support for nesting Sequences.
|
||||
* - Meta Strip (STRIP_TYPE_META): Support for nesting strips.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -206,8 +205,8 @@ typedef struct Strip {
|
||||
* frames that use the last frame after data ends.
|
||||
*/
|
||||
float startstill, endstill;
|
||||
/** Machine: the strip channel */
|
||||
int machine;
|
||||
/** The current channel index of the strip in the timeline. */
|
||||
int channel;
|
||||
/** Starting and ending points of the effect strip. Undefined for other strip types. */
|
||||
int startdisp, enddisp;
|
||||
float sat;
|
||||
@@ -252,6 +251,7 @@ typedef struct Strip {
|
||||
|
||||
/** List of strips for meta-strips. */
|
||||
ListBase seqbase;
|
||||
/** List of channels for meta-strips. */
|
||||
ListBase channels; /* SeqTimelineChannel */
|
||||
|
||||
/* List of strip connections (one-way, not bidirectional). */
|
||||
|
||||
@@ -193,6 +193,7 @@ DNA_STRUCT_RENAME_MEMBER(SceneEEVEE, motion_blur_shutter, motion_blur_shutter_de
|
||||
DNA_STRUCT_RENAME_MEMBER(SceneEEVEE, shadow_cube_size, shadow_cube_size_deprecated)
|
||||
DNA_STRUCT_RENAME_MEMBER(SpaceImage, pixel_snap_mode, pixel_round_mode)
|
||||
DNA_STRUCT_RENAME_MEMBER(SpaceSeq, overlay_type, overlay_frame_type)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, machine, channel)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, retiming_handle_num, retiming_keys_num)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, retiming_handles, retiming_keys)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, seq1, input1)
|
||||
|
||||
@@ -600,7 +600,7 @@ static void rna_Strip_channel_set(PointerRNA *ptr, int value)
|
||||
ListBase *seqbase = blender::seq::get_seqbase_by_strip(scene, strip);
|
||||
|
||||
/* check channel increment or decrement */
|
||||
const int channel_delta = (value >= strip->machine) ? 1 : -1;
|
||||
const int channel_delta = (value >= strip->channel) ? 1 : -1;
|
||||
blender::seq::strip_channel_set(strip, value);
|
||||
|
||||
if (blender::seq::transform_test_overlap(scene, seqbase, strip)) {
|
||||
@@ -2256,7 +2256,7 @@ static void rna_def_strip(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Strip_frame_change_update");
|
||||
|
||||
prop = RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "machine");
|
||||
RNA_def_property_int_sdna(prop, nullptr, "channel");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_range(prop, 1, blender::seq::MAX_CHANNELS);
|
||||
RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip");
|
||||
|
||||
@@ -23,8 +23,8 @@ void channels_free(ListBase *channels);
|
||||
|
||||
/**
|
||||
* Returns SeqTimelineChannel by index
|
||||
* Note: `Strip::machine` and `SeqTimelineChannel::index` are both counted from 0, but index of 0
|
||||
* is never used. Therefore, it is valid to call `SeqTimelineChannel(channels, strip->machine)` to
|
||||
* Note: `Strip::channel` and `SeqTimelineChannel::index` are both counted from 0, but index of 0
|
||||
* is never used. Therefore, it is valid to call `SeqTimelineChannel(channels, strip->channel)` to
|
||||
* get channel corresponding to strip position.
|
||||
*/
|
||||
SeqTimelineChannel *channel_get_by_index(const ListBase *channels, int channel_index);
|
||||
|
||||
@@ -67,7 +67,7 @@ ListBase *active_seqbase_get(const Editing *ed);
|
||||
* \param seqbase: ListBase with strips
|
||||
*/
|
||||
void active_seqbase_set(Editing *ed, ListBase *seqbase);
|
||||
Strip *strip_alloc(ListBase *lb, int timeline_frame, int machine, int type);
|
||||
Strip *strip_alloc(ListBase *lb, int timeline_frame, int channel, int type);
|
||||
void strip_free(Scene *scene, Strip *strip);
|
||||
/**
|
||||
* Get #MetaStack that corresponds to current level that is being viewed
|
||||
|
||||
@@ -74,7 +74,7 @@ void StripImageMap::invalidate(const Strip *strip)
|
||||
/* Invalidate this strip, and all strips that are above it. */
|
||||
for (auto it = this->map_.items().begin(); it != this->map_.items().end(); it++) {
|
||||
const Strip *key = (*it).key;
|
||||
if (key == strip || key->machine >= strip->machine) {
|
||||
if (key == strip || key->channel >= strip->channel) {
|
||||
IMB_freeImBuf((*it).value);
|
||||
this->map_.remove(it);
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ static ImBuf *query_thumbnail(ThumbnailCache &cache,
|
||||
StripType(strip->type),
|
||||
cur_time,
|
||||
timeline_frame,
|
||||
strip->machine,
|
||||
strip->channel,
|
||||
img_width,
|
||||
img_height);
|
||||
cache.requests_.add(request);
|
||||
|
||||
@@ -48,9 +48,9 @@ static ImBuf *do_adjustment_impl(const RenderData *context, Strip *strip, float
|
||||
time_left_handle_frame_get(context->scene, strip),
|
||||
time_right_handle_frame_get(context->scene, strip) - 1);
|
||||
|
||||
if (strip->machine > 1) {
|
||||
if (strip->channel > 1) {
|
||||
i = seq_render_give_ibuf_seqbase(
|
||||
context, timeline_frame, strip->machine - 1, channels, seqbasep);
|
||||
context, timeline_frame, strip->channel - 1, channels, seqbasep);
|
||||
}
|
||||
|
||||
/* Found nothing? so let's work the way up the meta-strip stack, so
|
||||
|
||||
@@ -39,7 +39,7 @@ static ImBuf *do_multicam(const RenderData *context,
|
||||
ImBuf *out;
|
||||
Editing *ed;
|
||||
|
||||
if (strip->multicam_source == 0 || strip->multicam_source >= strip->machine) {
|
||||
if (strip->multicam_source == 0 || strip->multicam_source >= strip->channel) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ static VectorSet<Strip *> query_strips_at_frame(const Scene *scene,
|
||||
|
||||
static void collection_filter_channel_up_to_incl(VectorSet<Strip *> &strips, const int channel)
|
||||
{
|
||||
strips.remove_if([&](Strip *strip) { return strip->machine > channel; });
|
||||
strips.remove_if([&](Strip *strip) { return strip->channel > channel; });
|
||||
}
|
||||
|
||||
/* Check if strip must be rendered. This depends on whole stack in some cases, not only strip
|
||||
@@ -139,7 +139,7 @@ static bool must_render_strip(const VectorSet<Strip *> &strips, Strip *strip)
|
||||
bool strip_have_effect_in_stack = false;
|
||||
for (Strip *strip_iter : strips) {
|
||||
/* Strips is below another strip with replace blending are not rendered. */
|
||||
if (strip_iter->blend_mode == SEQ_BLEND_REPLACE && strip->machine < strip_iter->machine) {
|
||||
if (strip_iter->blend_mode == SEQ_BLEND_REPLACE && strip->channel < strip_iter->channel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ static bool must_render_strip(const VectorSet<Strip *> &strips, Strip *strip)
|
||||
relation_is_effect_of_strip(strip_iter, strip))
|
||||
{
|
||||
/* Strips in same channel or higher than its effect are rendered. */
|
||||
if (strip->machine >= strip_iter->machine) {
|
||||
if (strip->channel >= strip_iter->channel) {
|
||||
return true;
|
||||
}
|
||||
/* Mark that this strip has effect in stack, that is above the strip. */
|
||||
|
||||
@@ -268,7 +268,7 @@ Vector<Strip *> seq_shown_strips_get(const Scene *scene,
|
||||
Vector<Strip *> strips_vec = strips.extract_vector();
|
||||
/* Sort strips by channel. */
|
||||
std::sort(strips_vec.begin(), strips_vec.end(), [](const Strip *a, const Strip *b) {
|
||||
return a->machine < b->machine;
|
||||
return a->channel < b->channel;
|
||||
});
|
||||
return strips_vec;
|
||||
}
|
||||
@@ -2068,7 +2068,7 @@ ImBuf *render_give_ibuf_direct(const RenderData *context, float timeline_frame,
|
||||
|
||||
bool render_is_muted(const ListBase *channels, const Strip *strip)
|
||||
{
|
||||
SeqTimelineChannel *channel = channel_get_by_index(channels, strip->machine);
|
||||
SeqTimelineChannel *channel = channel_get_by_index(channels, strip->channel);
|
||||
return strip->flag & SEQ_MUTE || channel_is_muted(channel);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ static void seq_free_strip(StripData *data)
|
||||
MEM_freeN(data);
|
||||
}
|
||||
|
||||
Strip *strip_alloc(ListBase *lb, int timeline_frame, int machine, int type)
|
||||
Strip *strip_alloc(ListBase *lb, int timeline_frame, int channel, int type)
|
||||
{
|
||||
Strip *strip;
|
||||
|
||||
@@ -139,7 +139,7 @@ Strip *strip_alloc(ListBase *lb, int timeline_frame, int machine, int type)
|
||||
|
||||
strip->flag = SELECT;
|
||||
strip->start = timeline_frame;
|
||||
strip_channel_set(strip, machine);
|
||||
strip_channel_set(strip, channel);
|
||||
strip->sat = 1.0;
|
||||
strip->mul = 1.0;
|
||||
strip->blend_opacity = 100.0;
|
||||
@@ -707,7 +707,7 @@ void seqbase_duplicate_recursive(const Scene *scene_src,
|
||||
|
||||
bool is_valid_strip_channel(const Strip *strip)
|
||||
{
|
||||
return strip->machine >= 1 && strip->machine <= MAX_CHANNELS;
|
||||
return strip->channel >= 1 && strip->channel <= MAX_CHANNELS;
|
||||
}
|
||||
|
||||
SequencerToolSettings *tool_settings_copy(SequencerToolSettings *tool_settings)
|
||||
|
||||
@@ -87,7 +87,7 @@ bool edit_strip_swap(Scene *scene, Strip *strip_a, Strip *strip_b, const char **
|
||||
std::swap(strip_a->start, strip_b->start);
|
||||
std::swap(strip_a->startofs, strip_b->startofs);
|
||||
std::swap(strip_a->endofs, strip_b->endofs);
|
||||
std::swap(strip_a->machine, strip_b->machine);
|
||||
std::swap(strip_a->channel, strip_b->channel);
|
||||
strip_time_effect_range_set(scene, strip_a);
|
||||
strip_time_effect_range_set(scene, strip_b);
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ void timeline_expand_boundbox(const Scene *scene, const ListBase *seqbase, rctf
|
||||
rect->xmin = std::min<float>(rect->xmin, time_left_handle_frame_get(scene, strip) - 1);
|
||||
rect->xmax = std::max<float>(rect->xmax, time_right_handle_frame_get(scene, strip) + 1);
|
||||
/* We do +1 here to account for the channel thickness. Channel n has range of <n, n+1>. */
|
||||
rect->ymax = std::max(rect->ymax, strip->machine + 1.0f);
|
||||
rect->ymax = std::max(rect->ymax, strip->channel + 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ bool transform_strip_can_be_translated(const Strip *strip)
|
||||
bool transform_test_overlap(const Scene *scene, Strip *strip1, Strip *strip2)
|
||||
{
|
||||
return (
|
||||
strip1 != strip2 && strip1->machine == strip2->machine &&
|
||||
strip1 != strip2 && strip1->channel == strip2->channel &&
|
||||
((time_right_handle_frame_get(scene, strip1) <= time_left_handle_frame_get(scene, strip2)) ||
|
||||
(time_left_handle_frame_get(scene, strip1) >=
|
||||
time_right_handle_frame_get(scene, strip2))) == 0);
|
||||
@@ -101,16 +101,16 @@ bool transform_seqbase_shuffle_ex(ListBase *seqbasep,
|
||||
Scene *evil_scene,
|
||||
int channel_delta)
|
||||
{
|
||||
const int orig_machine = test->machine;
|
||||
const int orig_channel = test->channel;
|
||||
BLI_assert(ELEM(channel_delta, -1, 1));
|
||||
|
||||
strip_channel_set(test, test->machine + channel_delta);
|
||||
strip_channel_set(test, test->channel + channel_delta);
|
||||
while (transform_test_overlap(evil_scene, seqbasep, test)) {
|
||||
if ((channel_delta > 0) ? (test->machine >= MAX_CHANNELS) : (test->machine < 1)) {
|
||||
if ((channel_delta > 0) ? (test->channel >= MAX_CHANNELS) : (test->channel < 1)) {
|
||||
break;
|
||||
}
|
||||
|
||||
strip_channel_set(test, test->machine + channel_delta);
|
||||
strip_channel_set(test, test->channel + channel_delta);
|
||||
}
|
||||
|
||||
if (!is_valid_strip_channel(test)) {
|
||||
@@ -120,12 +120,12 @@ bool transform_seqbase_shuffle_ex(ListBase *seqbasep,
|
||||
int new_frame = time_right_handle_frame_get(evil_scene, test);
|
||||
|
||||
LISTBASE_FOREACH (Strip *, strip, seqbasep) {
|
||||
if (strip->machine == orig_machine) {
|
||||
if (strip->channel == orig_channel) {
|
||||
new_frame = max_ii(new_frame, time_right_handle_frame_get(evil_scene, strip));
|
||||
}
|
||||
}
|
||||
|
||||
strip_channel_set(test, orig_machine);
|
||||
strip_channel_set(test, orig_channel);
|
||||
|
||||
new_frame = new_frame + (test->start - time_left_handle_frame_get(
|
||||
evil_scene, test)); /* adjust by the startdisp */
|
||||
@@ -147,7 +147,7 @@ static bool shuffle_strip_test_overlap(const Scene *scene,
|
||||
const int offset)
|
||||
{
|
||||
BLI_assert(strip1 != strip2);
|
||||
return (strip1->machine == strip2->machine &&
|
||||
return (strip1->channel == strip2->channel &&
|
||||
((time_right_handle_frame_get(scene, strip1) + offset <=
|
||||
time_left_handle_frame_get(scene, strip2)) ||
|
||||
(time_left_handle_frame_get(scene, strip1) + offset >=
|
||||
@@ -300,7 +300,7 @@ static void strip_transform_handle_expand_to_fit(Scene *scene,
|
||||
|
||||
/* Temporarily move right side strips beyond timeline boundary. */
|
||||
for (Strip *strip : right_side_strips) {
|
||||
strip->machine += MAX_CHANNELS * 2;
|
||||
strip->channel += MAX_CHANNELS * 2;
|
||||
}
|
||||
|
||||
/* Shuffle transformed standalone strips. This is because transformed strips can overlap with
|
||||
@@ -311,7 +311,7 @@ static void strip_transform_handle_expand_to_fit(Scene *scene,
|
||||
|
||||
/* Move temporarily moved strips back to their original place and tag for shuffling. */
|
||||
for (Strip *strip : right_side_strips) {
|
||||
strip->machine -= MAX_CHANNELS * 2;
|
||||
strip->channel -= MAX_CHANNELS * 2;
|
||||
}
|
||||
/* Shuffle again to displace strips on right side. Final effect shuffling is done in
|
||||
* SEQ_transform_handle_overlap. */
|
||||
@@ -451,7 +451,7 @@ static void strip_transform_handle_overwrite(Scene *scene,
|
||||
|
||||
for (Strip *target : targets) {
|
||||
for (Strip *transformed : transformed_strips) {
|
||||
if (transformed->machine != target->machine) {
|
||||
if (transformed->channel != target->channel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -557,12 +557,12 @@ void transform_offset_after_frame(Scene *scene,
|
||||
|
||||
void strip_channel_set(Strip *strip, int channel)
|
||||
{
|
||||
strip->machine = math::clamp(channel, 1, MAX_CHANNELS);
|
||||
strip->channel = math::clamp(channel, 1, MAX_CHANNELS);
|
||||
}
|
||||
|
||||
bool transform_is_locked(ListBase *channels, const Strip *strip)
|
||||
{
|
||||
const SeqTimelineChannel *channel = channel_get_by_index(channels, strip->machine);
|
||||
const SeqTimelineChannel *channel = channel_get_by_index(channels, strip->channel);
|
||||
return strip->flag & SEQ_LOCK ||
|
||||
(channel_is_locked(channel) && ((strip->flag & SEQ_IGNORE_CHANNEL_LOCK) == 0));
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ const Strip *strip_topmost_get(const Scene *scene, int frame)
|
||||
|
||||
ListBase *channels = channels_displayed_get(ed);
|
||||
const Strip *best_strip = nullptr;
|
||||
int best_machine = -1;
|
||||
int best_channel = -1;
|
||||
|
||||
LISTBASE_FOREACH (const Strip *, strip, ed->seqbasep) {
|
||||
if (render_is_muted(channels, strip) || !time_strip_intersects_frame(scene, strip, frame)) {
|
||||
@@ -354,9 +354,9 @@ const Strip *strip_topmost_get(const Scene *scene, int frame)
|
||||
STRIP_TYPE_COLOR,
|
||||
STRIP_TYPE_TEXT))
|
||||
{
|
||||
if (strip->machine > best_machine) {
|
||||
if (strip->channel > best_channel) {
|
||||
best_strip = strip;
|
||||
best_machine = strip->machine;
|
||||
best_channel = strip->channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user