Cleanup: Sequencer: Replace seqbasep variable access with function

With the aim of removing `seqbasep` to remove the complicated logic for
repairing pointers within the `Strip` struct when loading files and undo
steps, this commit just moves access of the variable behind a function.
In the future the function will retrieve the list from a Strip pointer,
for now it just returns the existing pointer.

Overall motivation is that blend file pointer manipulation is incompatible
with the changes required for #127706.

Pull Request: https://projects.blender.org/blender/blender/pulls/144624
This commit is contained in:
Hans Goudey
2025-08-18 15:39:58 +02:00
committed by Thamsanqa Dreem
parent 7c90b19745
commit c2e31513b8
27 changed files with 148 additions and 106 deletions

View File

@@ -2387,7 +2387,7 @@ void do_versions_ipos_to_layered_actions(Main *bmain)
for (id = static_cast<ID *>(bmain->scenes.first); id; id = static_cast<ID *>(id->next)) { for (id = static_cast<ID *>(bmain->scenes.first); id; id = static_cast<ID *>(id->next)) {
Scene *scene = (Scene *)id; Scene *scene = (Scene *)id;
Editing *ed = scene->ed; Editing *ed = scene->ed;
if (ed && ed->seqbasep) { if (ed && ed->current_strips()) {
Seq_callback_data cb_data = {bmain, scene, BKE_animdata_ensure_id(id)}; Seq_callback_data cb_data = {bmain, scene, BKE_animdata_ensure_id(id)};
seq::for_each_callback(&ed->seqbase, strip_convert_callback, &cb_data); seq::for_each_callback(&ed->seqbase, strip_convert_callback, &cb_data);
} }

View File

@@ -198,7 +198,7 @@ static void animchan_sync_fcurve_scene(bAnimListElem *ale)
* strip, or even the sequencer itself. */ * strip, or even the sequencer itself. */
return; return;
} }
strip = blender::seq::get_strip_by_name(ed->seqbasep, strip_name, false); strip = blender::seq::get_strip_by_name(ed->current_strips(), strip_name, false);
if (strip == nullptr) { if (strip == nullptr) {
return; return;
} }

View File

@@ -1022,7 +1022,7 @@ static bool skip_fcurve_selected_data(bAnimContext *ac,
/* Get strip name, and check if this strip is selected. */ /* Get strip name, and check if this strip is selected. */
Editing *ed = blender::seq::editing_get(scene); Editing *ed = blender::seq::editing_get(scene);
if (ed) { if (ed) {
strip = blender::seq::get_strip_by_name(ed->seqbasep, strip_name, false); strip = blender::seq::get_strip_by_name(ed->current_strips(), strip_name, false);
} }
/* Can only add this F-Curve if it is selected. */ /* Can only add this F-Curve if it is selected. */

View File

@@ -688,7 +688,7 @@ static eContextResult screen_ctx_sequences(const bContext *C, bContextDataResult
Scene *scene = WM_window_get_active_scene(win); Scene *scene = WM_window_get_active_scene(win);
Editing *ed = blender::seq::editing_get(scene); Editing *ed = blender::seq::editing_get(scene);
if (ed) { if (ed) {
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); CTX_data_list_add(result, &scene->id, &RNA_Strip, strip);
} }
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -702,7 +702,7 @@ static eContextResult screen_ctx_selected_sequences(const bContext *C, bContextD
Scene *scene = WM_window_get_active_scene(win); Scene *scene = WM_window_get_active_scene(win);
Editing *ed = blender::seq::editing_get(scene); Editing *ed = blender::seq::editing_get(scene);
if (ed) { if (ed) {
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); CTX_data_list_add(result, &scene->id, &RNA_Strip, strip);
} }
@@ -723,7 +723,7 @@ static eContextResult screen_ctx_selected_editable_sequences(const bContext *C,
} }
ListBase *channels = blender::seq::channels_displayed_get(ed); ListBase *channels = blender::seq::channels_displayed_get(ed);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT && !blender::seq::transform_is_locked(channels, strip)) { if (strip->flag & SELECT && !blender::seq::transform_is_locked(channels, strip)) {
CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); CTX_data_list_add(result, &scene->id, &RNA_Strip, strip);
} }
@@ -1153,7 +1153,7 @@ static eContextResult screen_ctx_strips(const bContext *C, bContextDataResult *r
Scene *scene = WM_window_get_active_scene(win); Scene *scene = WM_window_get_active_scene(win);
Editing *ed = blender::seq::editing_get(scene); Editing *ed = blender::seq::editing_get(scene);
if (ed) { if (ed) {
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); CTX_data_list_add(result, &scene->id, &RNA_Strip, strip);
} }
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
@@ -1167,7 +1167,7 @@ static eContextResult screen_ctx_selected_strips(const bContext *C, bContextData
Scene *scene = WM_window_get_active_scene(win); Scene *scene = WM_window_get_active_scene(win);
Editing *ed = blender::seq::editing_get(scene); Editing *ed = blender::seq::editing_get(scene);
if (ed) { if (ed) {
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); CTX_data_list_add(result, &scene->id, &RNA_Strip, strip);
} }
@@ -1188,7 +1188,7 @@ static eContextResult screen_ctx_selected_editable_strips(const bContext *C,
} }
ListBase *channels = blender::seq::channels_displayed_get(ed); ListBase *channels = blender::seq::channels_displayed_get(ed);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT && !blender::seq::transform_is_locked(channels, strip)) { if (strip->flag & SELECT && !blender::seq::transform_is_locked(channels, strip)) {
CTX_data_list_add(result, &scene->id, &RNA_Strip, strip); CTX_data_list_add(result, &scene->id, &RNA_Strip, strip);
} }

View File

@@ -738,7 +738,7 @@ static void tree_element_strip_activate(bContext *C,
Strip *strip = &te_strip->get_strip(); Strip *strip = &te_strip->get_strip();
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
if (BLI_findindex(ed->seqbasep, strip) != -1) { if (BLI_findindex(ed->current_strips(), strip) != -1) {
if (set == OL_SETSEL_EXTEND) { if (set == OL_SETSEL_EXTEND) {
seq::select_active_set(scene, nullptr); seq::select_active_set(scene, nullptr);
} }
@@ -763,7 +763,7 @@ static void tree_element_strip_dup_activate(Scene *scene, TreeElement * /*te*/)
#if 0 #if 0
select_single_seq(strip, 1); select_single_seq(strip, 1);
#endif #endif
Strip *p = static_cast<Strip *>(ed->seqbasep->first); Strip *p = static_cast<Strip *>(ed->current_strips()->first);
while (p) { while (p) {
if ((!p->data) || (!p->data->stripdata) || (p->data->stripdata->filename[0] == '\0')) { if ((!p->data) || (!p->data->stripdata) || (p->data->stripdata->filename[0] == '\0')) {
p = p->next; p = p->next;

View File

@@ -2148,7 +2148,7 @@ static void sequence_fn(int event, TreeElement *te, TreeStoreElem * /*tselem*/,
Strip *strip = &te_strip->get_strip(); Strip *strip = &te_strip->get_strip();
Scene *scene = (Scene *)scene_ptr; Scene *scene = (Scene *)scene_ptr;
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
if (BLI_findindex(ed->seqbasep, strip) != -1) { if (BLI_findindex(ed->current_strips(), strip) != -1) {
if (event == OL_DOP_SELECT) { if (event == OL_DOP_SELECT) {
vse::select_strip_single(scene, strip, true); vse::select_strip_single(scene, strip, true);
} }

View File

@@ -37,7 +37,7 @@ ListBase TreeDisplaySequencer::build_tree(const TreeSourceData &source_data)
return tree; return tree;
} }
for (Strip *strip : List<Strip>(ed->seqbasep)) { for (Strip *strip : List<Strip>(ed->current_strips())) {
StripAddOp op = need_add_strip_dup(strip); StripAddOp op = need_add_strip_dup(strip);
if (op == StripAddOp::None) { if (op == StripAddOp::None) {
add_element(&tree, nullptr, strip, nullptr, TSE_STRIP, 0); add_element(&tree, nullptr, strip, nullptr, TSE_STRIP, 0);

View File

@@ -239,11 +239,11 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type)
int timeline_frame = scene->r.cfra; int timeline_frame = scene->r.cfra;
int proximity = INT_MAX; int proximity = INT_MAX;
if (!ed || !ed->seqbasep) { if (!ed || !ed->current_strips()) {
return 1; return 1;
} }
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
const int strip_end = seq::time_right_handle_frame_get(scene, strip); const int strip_end = seq::time_right_handle_frame_get(scene, strip);
if (ELEM(type, -1, strip->type) && (strip_end <= timeline_frame) && if (ELEM(type, -1, strip->type) && (strip_end <= timeline_frame) &&
(timeline_frame - strip_end < proximity)) (timeline_frame - strip_end < proximity))
@@ -539,7 +539,7 @@ static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Strip *s
} }
if (RNA_boolean_get(op->ptr, "overlap") == true || if (RNA_boolean_get(op->ptr, "overlap") == true ||
!seq::transform_test_overlap(scene, ed->seqbasep, strip) || !seq::transform_test_overlap(scene, ed->current_strips(), strip) ||
RNA_boolean_get(op->ptr, "move_strips")) RNA_boolean_get(op->ptr, "move_strips"))
{ {
/* No overlap should be handled or the strip is not overlapping, exit early. */ /* No overlap should be handled or the strip is not overlapping, exit early. */
@@ -554,11 +554,11 @@ static void seq_load_apply_generic_options(bContext *C, wmOperator *op, Strip *s
ScrArea *area = CTX_wm_area(C); ScrArea *area = CTX_wm_area(C);
const bool use_sync_markers = (((SpaceSeq *)area->spacedata.first)->flag & SEQ_MARKER_TRANS) != const bool use_sync_markers = (((SpaceSeq *)area->spacedata.first)->flag & SEQ_MARKER_TRANS) !=
0; 0;
seq::transform_handle_overlap(scene, ed->seqbasep, strip_col, use_sync_markers); seq::transform_handle_overlap(scene, ed->current_strips(), strip_col, use_sync_markers);
} }
else { else {
/* Shuffle strip channel to fix overlaps. */ /* Shuffle strip channel to fix overlaps. */
seq::transform_seqbase_shuffle(ed->seqbasep, strip, scene); seq::transform_seqbase_shuffle(ed->current_strips(), strip, scene);
} }
} }
@@ -579,7 +579,7 @@ static bool seq_load_apply_generic_options_only_test_overlap(bContext *C,
seq::select_active_set(scene, strip); seq::select_active_set(scene, strip);
} }
return seq::transform_test_overlap(scene, ed->seqbasep, strip); return seq::transform_test_overlap(scene, ed->current_strips(), strip);
} }
static bool seq_effect_add_properties_poll(const bContext * /*C*/, static bool seq_effect_add_properties_poll(const bContext * /*C*/,
@@ -629,7 +629,7 @@ static wmOperatorStatus sequencer_add_scene_strip_exec(bContext *C, wmOperator *
load_data_init_from_operator(&load_data, C, op); load_data_init_from_operator(&load_data, C, op);
load_data.scene = sce_seq; load_data.scene = sce_seq;
Strip *strip = seq::add_scene_strip(scene, ed->seqbasep, &load_data); Strip *strip = seq::add_scene_strip(scene, ed->current_strips(), &load_data);
seq_load_apply_generic_options(C, op, strip); seq_load_apply_generic_options(C, op, strip);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -647,7 +647,7 @@ static void sequencer_disable_one_time_properties(bContext *C, wmOperator *op)
{ {
Editing *ed = seq::editing_get(CTX_data_sequencer_scene(C)); Editing *ed = seq::editing_get(CTX_data_sequencer_scene(C));
/* Disable following properties if there are any existing strips, unless overridden by user. */ /* Disable following properties if there are any existing strips, unless overridden by user. */
if (ed && ed->seqbasep && ed->seqbasep->first) { if (ed && ed->current_strips() && ed->current_strips()->first) {
if (RNA_struct_find_property(op->ptr, "use_framerate")) { if (RNA_struct_find_property(op->ptr, "use_framerate")) {
RNA_boolean_set(op->ptr, "use_framerate", false); RNA_boolean_set(op->ptr, "use_framerate", false);
} }
@@ -740,7 +740,7 @@ static wmOperatorStatus sequencer_add_scene_strip_new_exec(bContext *C, wmOperat
} }
load_data.scene = scene_new; load_data.scene = scene_new;
Strip *strip = seq::add_scene_strip(scene, ed->seqbasep, &load_data); Strip *strip = seq::add_scene_strip(scene, ed->current_strips(), &load_data);
seq_load_apply_generic_options(C, op, strip); seq_load_apply_generic_options(C, op, strip);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -812,7 +812,7 @@ static wmOperatorStatus sequencer_add_movieclip_strip_exec(bContext *C, wmOperat
} }
load_data.clip = clip; load_data.clip = clip;
Strip *strip = seq::add_movieclip_strip(scene, ed->seqbasep, &load_data); Strip *strip = seq::add_movieclip_strip(scene, ed->current_strips(), &load_data);
seq_load_apply_generic_options(C, op, strip); seq_load_apply_generic_options(C, op, strip);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -888,7 +888,7 @@ static wmOperatorStatus sequencer_add_mask_strip_exec(bContext *C, wmOperator *o
load_data_init_from_operator(&load_data, C, op); load_data_init_from_operator(&load_data, C, op);
load_data.mask = mask; load_data.mask = mask;
Strip *strip = seq::add_mask_strip(scene, ed->seqbasep, &load_data); Strip *strip = seq::add_mask_strip(scene, ed->current_strips(), &load_data);
seq_load_apply_generic_options(C, op, strip); seq_load_apply_generic_options(C, op, strip);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -1045,14 +1045,14 @@ static void sequencer_add_movie_multiple_strips(bContext *C,
Strip *strip_movie = nullptr; Strip *strip_movie = nullptr;
Strip *strip_sound = nullptr; Strip *strip_sound = nullptr;
strip_movie = seq::add_movie_strip(bmain, scene, ed->seqbasep, load_data); strip_movie = seq::add_movie_strip(bmain, scene, ed->current_strips(), load_data);
if (strip_movie == nullptr) { if (strip_movie == nullptr) {
BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path);
} }
else { else {
if (RNA_boolean_get(op->ptr, "sound")) { if (RNA_boolean_get(op->ptr, "sound")) {
strip_sound = seq::add_sound_strip(bmain, scene, ed->seqbasep, load_data); strip_sound = seq::add_sound_strip(bmain, scene, ed->current_strips(), load_data);
sequencer_add_movie_sync_sound_strip(bmain, scene, strip_movie, strip_sound, load_data); sequencer_add_movie_sync_sound_strip(bmain, scene, strip_movie, strip_sound, load_data);
added_strips.append(strip_movie); added_strips.append(strip_movie);
@@ -1090,7 +1090,7 @@ static void sequencer_add_movie_multiple_strips(bContext *C,
ScrArea *area = CTX_wm_area(C); ScrArea *area = CTX_wm_area(C);
const bool use_sync_markers = (((SpaceSeq *)area->spacedata.first)->flag & const bool use_sync_markers = (((SpaceSeq *)area->spacedata.first)->flag &
SEQ_MARKER_TRANS) != 0; SEQ_MARKER_TRANS) != 0;
seq::transform_handle_overlap(scene, ed->seqbasep, added_strips, use_sync_markers); seq::transform_handle_overlap(scene, ed->current_strips(), added_strips, use_sync_markers);
} }
} }
} }
@@ -1108,14 +1108,14 @@ static bool sequencer_add_movie_single_strip(bContext *C,
Strip *strip_sound = nullptr; Strip *strip_sound = nullptr;
blender::Vector<Strip *> added_strips; blender::Vector<Strip *> added_strips;
strip_movie = seq::add_movie_strip(bmain, scene, ed->seqbasep, load_data); strip_movie = seq::add_movie_strip(bmain, scene, ed->current_strips(), load_data);
if (strip_movie == nullptr) { if (strip_movie == nullptr) {
BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path);
return false; return false;
} }
if (RNA_boolean_get(op->ptr, "sound")) { if (RNA_boolean_get(op->ptr, "sound")) {
strip_sound = seq::add_sound_strip(bmain, scene, ed->seqbasep, load_data); strip_sound = seq::add_sound_strip(bmain, scene, ed->current_strips(), load_data);
sequencer_add_movie_sync_sound_strip(bmain, scene, strip_movie, strip_sound, load_data); sequencer_add_movie_sync_sound_strip(bmain, scene, strip_movie, strip_sound, load_data);
added_strips.append(strip_movie); added_strips.append(strip_movie);
@@ -1146,7 +1146,7 @@ static bool sequencer_add_movie_single_strip(bContext *C,
ScrArea *area = CTX_wm_area(C); ScrArea *area = CTX_wm_area(C);
const bool use_sync_markers = (((SpaceSeq *)area->spacedata.first)->flag & const bool use_sync_markers = (((SpaceSeq *)area->spacedata.first)->flag &
SEQ_MARKER_TRANS) != 0; SEQ_MARKER_TRANS) != 0;
seq::transform_handle_overlap(scene, ed->seqbasep, added_strips, use_sync_markers); seq::transform_handle_overlap(scene, ed->current_strips(), added_strips, use_sync_markers);
} }
} }
else { else {
@@ -1381,7 +1381,7 @@ static void sequencer_add_sound_multiple_strips(bContext *C,
RNA_string_get(&itemptr, "name", file_only); RNA_string_get(&itemptr, "name", file_only);
BLI_path_join(load_data->path, sizeof(load_data->path), dir_only, file_only); BLI_path_join(load_data->path, sizeof(load_data->path), dir_only, file_only);
STRNCPY(load_data->name, file_only); STRNCPY(load_data->name, file_only);
Strip *strip = seq::add_sound_strip(bmain, scene, ed->seqbasep, load_data); Strip *strip = seq::add_sound_strip(bmain, scene, ed->current_strips(), load_data);
if (strip == nullptr) { if (strip == nullptr) {
BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path);
} }
@@ -1400,7 +1400,7 @@ static bool sequencer_add_sound_single_strip(bContext *C, wmOperator *op, seq::L
Scene *scene = CTX_data_sequencer_scene(C); Scene *scene = CTX_data_sequencer_scene(C);
Editing *ed = seq::editing_ensure(scene); Editing *ed = seq::editing_ensure(scene);
Strip *strip = seq::add_sound_strip(bmain, scene, ed->seqbasep, load_data); Strip *strip = seq::add_sound_strip(bmain, scene, ed->current_strips(), load_data);
if (strip == nullptr) { if (strip == nullptr) {
BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path); BKE_reportf(op->reports, RPT_ERROR, "File '%s' could not be loaded", load_data->path);
return false; return false;
@@ -1639,7 +1639,7 @@ static wmOperatorStatus sequencer_add_image_strip_exec(bContext *C, wmOperator *
char vt_old[64]; char vt_old[64];
STRNCPY_UTF8(vt_old, scene->view_settings.view_transform); STRNCPY_UTF8(vt_old, scene->view_settings.view_transform);
Strip *strip = seq::add_image_strip(CTX_data_main(C), scene, ed->seqbasep, &load_data); Strip *strip = seq::add_image_strip(CTX_data_main(C), scene, ed->current_strips(), &load_data);
if (!STREQ(vt_old, scene->view_settings.view_transform)) { if (!STREQ(vt_old, scene->view_settings.view_transform)) {
BKE_reportf(op->reports, BKE_reportf(op->reports,
@@ -1789,7 +1789,7 @@ static wmOperatorStatus sequencer_add_effect_strip_exec(bContext *C, wmOperator
} }
} }
Strip *strip = seq::add_effect_strip(scene, ed->seqbasep, &load_data); Strip *strip = seq::add_effect_strip(scene, ed->current_strips(), &load_data);
seq_load_apply_generic_options(C, op, strip); seq_load_apply_generic_options(C, op, strip);
if (strip->type == STRIP_TYPE_COLOR) { if (strip->type == STRIP_TYPE_COLOR) {
@@ -1984,7 +1984,7 @@ static wmOperatorStatus sequencer_add_scene_asset_invoke(bContext *C,
load_data_init_from_operator(&load_data, C, op); load_data_init_from_operator(&load_data, C, op);
load_data.scene = scene_asset; load_data.scene = scene_asset;
Strip *strip = seq::add_scene_strip(scene, ed->seqbasep, &load_data); Strip *strip = seq::add_scene_strip(scene, ed->current_strips(), &load_data);
seq_load_apply_generic_options(C, op, strip); seq_load_apply_generic_options(C, op, strip);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);

View File

@@ -172,7 +172,7 @@ static bool sequencer_write_copy_paste_file(Main *bmain_src,
scene_src, scene_src,
scene_dst, scene_dst,
&scene_dst->ed->seqbase, &scene_dst->ed->seqbase,
scene_src->ed->seqbasep, scene_src->ed->current_strips(),
seq::StripDuplicate::Selected, seq::StripDuplicate::Selected,
0); 0);
@@ -317,7 +317,7 @@ wmOperatorStatus sequencer_clipboard_copy_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_sequencer_scene(C); Scene *scene = CTX_data_sequencer_scene(C);
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
blender::VectorSet<Strip *> selected = seq::query_selected_strips(ed->seqbasep); blender::VectorSet<Strip *> selected = seq::query_selected_strips(ed->current_strips());
if (selected.is_empty()) { if (selected.is_empty()) {
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
@@ -325,7 +325,8 @@ wmOperatorStatus sequencer_clipboard_copy_exec(bContext *C, wmOperator *op)
blender::VectorSet<Strip *> effect_chain; blender::VectorSet<Strip *> effect_chain;
effect_chain.add_multiple(selected); effect_chain.add_multiple(selected);
seq::iterator_set_expand(scene, ed->seqbasep, effect_chain, seq::query_strip_effect_chain); seq::iterator_set_expand(
scene, ed->current_strips(), effect_chain, seq::query_strip_effect_chain);
blender::VectorSet<Strip *> expanded; blender::VectorSet<Strip *> expanded;
for (Strip *strip : effect_chain) { for (Strip *strip : effect_chain) {

View File

@@ -238,7 +238,8 @@ static float update_overlay_strip_position_data(bContext *C, const int mval[2])
Editing *ed = seq::editing_ensure(scene); Editing *ed = seq::editing_ensure(scene);
for (int i = 0; i < coords->channel_len && !coords->is_intersecting; i++) { for (int i = 0; i < coords->channel_len && !coords->is_intersecting; i++) {
coords->is_intersecting = seq::transform_test_overlap(scene, ed->seqbasep, &dummy_strip); coords->is_intersecting = seq::transform_test_overlap(
scene, ed->current_strips(), &dummy_strip);
seq::strip_channel_set(&dummy_strip, dummy_strip.channel + 1); seq::strip_channel_set(&dummy_strip, dummy_strip.channel + 1);
} }

View File

@@ -303,7 +303,7 @@ static wmOperatorStatus sequencer_gap_remove_exec(bContext *C, wmOperator *op)
const bool do_all = RNA_boolean_get(op->ptr, "all"); const bool do_all = RNA_boolean_get(op->ptr, "all");
const Editing *ed = seq::editing_get(scene); const Editing *ed = seq::editing_get(scene);
seq::edit_remove_gaps(scene, ed->seqbasep, scene->r.cfra, do_all); seq::edit_remove_gaps(scene, ed->current_strips(), scene->r.cfra, do_all);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@@ -342,7 +342,7 @@ static wmOperatorStatus sequencer_gap_insert_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_sequencer_scene(C); Scene *scene = CTX_data_sequencer_scene(C);
const int frames = RNA_int_get(op->ptr, "frames"); const int frames = RNA_int_get(op->ptr, "frames");
const Editing *ed = seq::editing_get(scene); const Editing *ed = seq::editing_get(scene);
seq::transform_offset_after_frame(scene, ed->seqbasep, frames, scene->r.cfra); seq::transform_offset_after_frame(scene, ed->current_strips(), frames, scene->r.cfra);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@@ -394,7 +394,7 @@ static wmOperatorStatus sequencer_snap_exec(bContext *C, wmOperator *op)
snap_frame = RNA_int_get(op->ptr, "frame"); snap_frame = RNA_int_get(op->ptr, "frame");
/* Check meta-strips. */ /* Check meta-strips. */
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT && !seq::transform_is_locked(channels, strip) && if (strip->flag & SELECT && !seq::transform_is_locked(channels, strip) &&
seq::transform_strip_can_be_translated(strip)) seq::transform_strip_can_be_translated(strip))
{ {
@@ -416,17 +416,17 @@ static wmOperatorStatus sequencer_snap_exec(bContext *C, wmOperator *op)
} }
/* Test for effects and overlap. */ /* Test for effects and overlap. */
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT && !seq::transform_is_locked(channels, strip)) { if (strip->flag & SELECT && !seq::transform_is_locked(channels, strip)) {
strip->runtime.flag &= ~STRIP_OVERLAP; strip->runtime.flag &= ~STRIP_OVERLAP;
if (seq::transform_test_overlap(scene, ed->seqbasep, strip)) { if (seq::transform_test_overlap(scene, ed->current_strips(), strip)) {
seq::transform_seqbase_shuffle(ed->seqbasep, strip, scene); seq::transform_seqbase_shuffle(ed->current_strips(), strip, scene);
} }
} }
} }
/* Recalculate bounds of effect strips, offsetting the keyframes if not snapping any handle. */ /* Recalculate bounds of effect strips, offsetting the keyframes if not snapping any handle. */
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->type & STRIP_TYPE_EFFECT) { if (strip->type & STRIP_TYPE_EFFECT) {
const bool either_handle_selected = (strip->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) != 0; const bool either_handle_selected = (strip->flag & (SEQ_LEFTSEL | SEQ_RIGHTSEL)) != 0;
@@ -610,7 +610,7 @@ static SlipData *slip_data_init(const Scene *scene)
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
SlipData *data = MEM_new<SlipData>("slipdata"); SlipData *data = MEM_new<SlipData>("slipdata");
VectorSet<Strip *> strips = seq::query_selected_strips(ed->seqbasep); VectorSet<Strip *> strips = seq::query_selected_strips(ed->current_strips());
ListBase *channels = seq::channels_displayed_get(seq::editing_get(scene)); ListBase *channels = seq::channels_displayed_get(seq::editing_get(scene));
strips.remove_if([&](Strip *strip) { strips.remove_if([&](Strip *strip) {
return (seq::transform_single_image_check(strip) || seq::transform_is_locked(channels, strip)); return (seq::transform_single_image_check(strip) || seq::transform_is_locked(channels, strip));
@@ -1010,7 +1010,7 @@ static wmOperatorStatus sequencer_unmute_exec(bContext *C, wmOperator *op)
ARegion *region = CTX_wm_region(C); ARegion *region = CTX_wm_region(C);
const bool is_preview = region && (region->regiontype == RGN_TYPE_PREVIEW) && const bool is_preview = region && (region->regiontype == RGN_TYPE_PREVIEW) &&
sequencer_view_preview_only_poll(C); sequencer_view_preview_only_poll(C);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (is_preview) { if (is_preview) {
if (seq::time_strip_intersects_frame(scene, strip, scene->r.cfra) && if (seq::time_strip_intersects_frame(scene, strip, scene->r.cfra) &&
strip->type != STRIP_TYPE_SOUND_RAM) strip->type != STRIP_TYPE_SOUND_RAM)
@@ -1071,7 +1071,7 @@ static wmOperatorStatus sequencer_lock_exec(bContext *C, wmOperator * /*op*/)
Scene *scene = CTX_data_sequencer_scene(C); Scene *scene = CTX_data_sequencer_scene(C);
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
strip->flag |= SEQ_LOCK; strip->flag |= SEQ_LOCK;
} }
@@ -1108,7 +1108,7 @@ static wmOperatorStatus sequencer_unlock_exec(bContext *C, wmOperator * /*op*/)
Scene *scene = CTX_data_sequencer_scene(C); Scene *scene = CTX_data_sequencer_scene(C);
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
strip->flag &= ~SEQ_LOCK; strip->flag &= ~SEQ_LOCK;
} }
@@ -1224,14 +1224,14 @@ static wmOperatorStatus sequencer_reload_exec(bContext *C, wmOperator *op)
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
const bool adjust_length = RNA_boolean_get(op->ptr, "adjust_length"); const bool adjust_length = RNA_boolean_get(op->ptr, "adjust_length");
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
seq::add_reload_new_file(bmain, scene, strip, !adjust_length); seq::add_reload_new_file(bmain, scene, strip, !adjust_length);
blender::seq::thumbnail_cache_invalidate_strip(scene, strip); blender::seq::thumbnail_cache_invalidate_strip(scene, strip);
if (adjust_length) { if (adjust_length) {
if (seq::transform_test_overlap(scene, ed->seqbasep, strip)) { if (seq::transform_test_overlap(scene, ed->current_strips(), strip)) {
seq::transform_seqbase_shuffle(ed->seqbasep, strip, scene); seq::transform_seqbase_shuffle(ed->current_strips(), strip, scene);
} }
} }
} }
@@ -1335,7 +1335,7 @@ VectorSet<Strip *> strip_effect_get_new_inputs(const Scene *scene,
} }
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
blender::VectorSet<Strip *> selected_strips = seq::query_selected_strips(ed->seqbasep); blender::VectorSet<Strip *> selected_strips = seq::query_selected_strips(ed->current_strips());
/* Ignore sound strips for now (avoids unnecessary errors when connected strips are /* Ignore sound strips for now (avoids unnecessary errors when connected strips are
* selected together, and the intent to operate on strips with video content is clear). */ * selected together, and the intent to operate on strips with video content is clear). */
selected_strips.remove_if([&](Strip *strip) { return strip->type == STRIP_TYPE_SOUND_RAM; }); selected_strips.remove_if([&](Strip *strip) { return strip->type == STRIP_TYPE_SOUND_RAM; });
@@ -1542,7 +1542,7 @@ static wmOperatorStatus sequencer_split_exec(bContext *C, wmOperator *op)
seq::prefetch_stop(scene); seq::prefetch_stop(scene);
LISTBASE_FOREACH_BACKWARD (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH_BACKWARD (Strip *, strip, ed->current_strips()) {
if (use_cursor_position && strip->channel != split_channel) { if (use_cursor_position && strip->channel != split_channel) {
continue; continue;
} }
@@ -1550,7 +1550,8 @@ static wmOperatorStatus sequencer_split_exec(bContext *C, wmOperator *op)
if (ignore_selection || strip->flag & SELECT) { if (ignore_selection || strip->flag & SELECT) {
const char *error_msg = nullptr; const char *error_msg = nullptr;
if (seq::edit_strip_split( if (seq::edit_strip_split(
bmain, scene, ed->seqbasep, strip, split_frame, method, &error_msg) != nullptr) bmain, scene, ed->current_strips(), strip, split_frame, method, &error_msg) !=
nullptr)
{ {
changed = true; changed = true;
} }
@@ -1749,7 +1750,7 @@ static wmOperatorStatus sequencer_add_duplicate_exec(bContext *C, wmOperator *op
/* Special case for duplicating strips in preview: Do not duplicate sound strips,muted /* Special case for duplicating strips in preview: Do not duplicate sound strips,muted
* strips and strips that do not intersect the current frame */ * strips and strips that do not intersect the current frame */
if (region->regiontype == RGN_TYPE_PREVIEW && sequencer_view_preview_only_poll(C)) { if (region->regiontype == RGN_TYPE_PREVIEW && sequencer_view_preview_only_poll(C)) {
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->type == STRIP_TYPE_SOUND_RAM || strip->flag & SEQ_MUTE || if (strip->type == STRIP_TYPE_SOUND_RAM || strip->flag & SEQ_MUTE ||
!(seq::time_strip_intersects_frame(scene, strip, scene->r.cfra))) !(seq::time_strip_intersects_frame(scene, strip, scene->r.cfra)))
{ {
@@ -1762,7 +1763,7 @@ static wmOperatorStatus sequencer_add_duplicate_exec(bContext *C, wmOperator *op
(seq::StripDuplicate::Selected | (seq::StripDuplicate::Selected |
seq::StripDuplicate::Data); seq::StripDuplicate::Data);
seq::seqbase_duplicate_recursive( seq::seqbase_duplicate_recursive(
bmain, scene, scene, &duplicated_strips, ed->seqbasep, dupe_flag, 0); bmain, scene, scene, &duplicated_strips, ed->current_strips(), dupe_flag, 0);
deselect_all_strips(scene); deselect_all_strips(scene);
if (duplicated_strips.first == nullptr) { if (duplicated_strips.first == nullptr) {
@@ -1782,7 +1783,7 @@ static wmOperatorStatus sequencer_add_duplicate_exec(bContext *C, wmOperator *op
/* Rely on the `duplicated_strips` list being added at the end. /* Rely on the `duplicated_strips` list being added at the end.
* Their UIDs has been re-generated by the #SEQ_sequence_base_dupli_recursive(). */ * Their UIDs has been re-generated by the #SEQ_sequence_base_dupli_recursive(). */
BLI_movelisttolist(ed->seqbasep, &duplicated_strips); BLI_movelisttolist(ed->current_strips(), &duplicated_strips);
/* Handle duplicated strips: set active, select, ensure unique name and duplicate animation /* Handle duplicated strips: set active, select, ensure unique name and duplicate animation
* data. */ * data. */
@@ -1801,8 +1802,8 @@ static wmOperatorStatus sequencer_add_duplicate_exec(bContext *C, wmOperator *op
* translated. */ * translated. */
if (region->regiontype == RGN_TYPE_PREVIEW && sequencer_view_preview_only_poll(C)) { if (region->regiontype == RGN_TYPE_PREVIEW && sequencer_view_preview_only_poll(C)) {
for (Strip *strip = strip_last->next; strip; strip = strip->next) { for (Strip *strip = strip_last->next; strip; strip = strip->next) {
if (seq::transform_test_overlap(scene, ed->seqbasep, strip)) { if (seq::transform_test_overlap(scene, ed->current_strips(), strip)) {
seq::transform_seqbase_shuffle(ed->seqbasep, strip, scene); seq::transform_seqbase_shuffle(ed->current_strips(), strip, scene);
} }
strip->runtime.flag &= ~STRIP_IGNORE_CHANNEL_LOCK; strip->runtime.flag &= ~STRIP_IGNORE_CHANNEL_LOCK;
} }
@@ -1948,7 +1949,7 @@ static wmOperatorStatus sequencer_offset_clear_exec(bContext *C, wmOperator * /*
ListBase *channels = seq::channels_displayed_get(seq::editing_get(scene)); ListBase *channels = seq::channels_displayed_get(seq::editing_get(scene));
/* For effects, try to find a replacement input. */ /* For effects, try to find a replacement input. */
for (strip = static_cast<Strip *>(ed->seqbasep->first); strip; for (strip = static_cast<Strip *>(ed->current_strips()->first); strip;
strip = static_cast<Strip *>(strip->next)) strip = static_cast<Strip *>(strip->next))
{ {
if (seq::transform_is_locked(channels, strip)) { if (seq::transform_is_locked(channels, strip)) {
@@ -1961,18 +1962,18 @@ static wmOperatorStatus sequencer_offset_clear_exec(bContext *C, wmOperator * /*
} }
/* Update lengths, etc. */ /* Update lengths, etc. */
strip = static_cast<Strip *>(ed->seqbasep->first); strip = static_cast<Strip *>(ed->current_strips()->first);
while (strip) { while (strip) {
seq::relations_invalidate_cache(scene, strip); seq::relations_invalidate_cache(scene, strip);
strip = strip->next; strip = strip->next;
} }
for (strip = static_cast<Strip *>(ed->seqbasep->first); strip; for (strip = static_cast<Strip *>(ed->current_strips()->first); strip;
strip = static_cast<Strip *>(strip->next)) strip = static_cast<Strip *>(strip->next))
{ {
if ((strip->type & STRIP_TYPE_EFFECT) == 0 && (strip->flag & SELECT)) { if ((strip->type & STRIP_TYPE_EFFECT) == 0 && (strip->flag & SELECT)) {
if (seq::transform_test_overlap(scene, ed->seqbasep, strip)) { if (seq::transform_test_overlap(scene, ed->current_strips(), strip)) {
seq::transform_seqbase_shuffle(ed->seqbasep, strip, scene); seq::transform_seqbase_shuffle(ed->current_strips(), strip, scene);
} }
} }
} }
@@ -2267,7 +2268,7 @@ static wmOperatorStatus sequencer_meta_separate_exec(bContext *C, wmOperator * /
/* Remove all selected from meta, and put in main list. /* Remove all selected from meta, and put in main list.
* Strip is moved within the same edit, no need to re-generate the UID. */ * Strip is moved within the same edit, no need to re-generate the UID. */
BLI_movelisttolist(ed->seqbasep, &active_strip->seqbase); BLI_movelisttolist(ed->current_strips(), &active_strip->seqbase);
BLI_listbase_clear(&active_strip->seqbase); BLI_listbase_clear(&active_strip->seqbase);
ListBase *active_seqbase = seq::active_seqbase_get(ed); ListBase *active_seqbase = seq::active_seqbase_get(ed);
@@ -2418,7 +2419,7 @@ static Strip *find_next_prev_strip(Scene *scene, Strip *test, int lr, int sel)
return nullptr; return nullptr;
} }
strip = static_cast<Strip *>(ed->seqbasep->first); strip = static_cast<Strip *>(ed->current_strips()->first);
while (strip) { while (strip) {
if ((strip != test) && (test->channel == strip->channel) && if ((strip != test) && (test->channel == strip->channel) &&
((sel == -1) || (sel == (strip->flag & SELECT)))) ((sel == -1) || (sel == (strip->flag & SELECT))))
@@ -3238,7 +3239,7 @@ static wmOperatorStatus sequencer_set_range_to_strips_exec(bContext *C, wmOperat
bool selected = false; bool selected = false;
const bool preview = RNA_boolean_get(op->ptr, "preview"); const bool preview = RNA_boolean_get(op->ptr, "preview");
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
selected = true; selected = true;
sfra = min_ii(sfra, seq::time_left_handle_frame_get(scene, strip)); sfra = min_ii(sfra, seq::time_left_handle_frame_get(scene, strip));
@@ -3325,7 +3326,7 @@ static wmOperatorStatus sequencer_strip_transform_clear_exec(bContext *C, wmOper
const bool only_when_keyed = blender::animrig::is_keying_flag(scene, const bool only_when_keyed = blender::animrig::is_keying_flag(scene,
AUTOKEY_FLAG_INSERTAVAILABLE); AUTOKEY_FLAG_INSERTAVAILABLE);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT && strip->type != STRIP_TYPE_SOUND_RAM) { if (strip->flag & SELECT && strip->type != STRIP_TYPE_SOUND_RAM) {
StripTransform *transform = strip->data->transform; StripTransform *transform = strip->data->transform;
PropertyRNA *prop; PropertyRNA *prop;
@@ -3437,7 +3438,7 @@ static wmOperatorStatus sequencer_strip_transform_fit_exec(bContext *C, wmOperat
const Editing *ed = seq::editing_get(scene); const Editing *ed = seq::editing_get(scene);
const eSeqImageFitMethod fit_method = eSeqImageFitMethod(RNA_enum_get(op->ptr, "fit_method")); const eSeqImageFitMethod fit_method = eSeqImageFitMethod(RNA_enum_get(op->ptr, "fit_method"));
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT && strip->type != STRIP_TYPE_SOUND_RAM) { if (strip->flag & SELECT && strip->type != STRIP_TYPE_SOUND_RAM) {
const int timeline_frame = scene->r.cfra; const int timeline_frame = scene->r.cfra;
StripElem *strip_elem = seq::render_give_stripelem(scene, strip, timeline_frame); StripElem *strip_elem = seq::render_give_stripelem(scene, strip, timeline_frame);
@@ -3487,7 +3488,7 @@ static wmOperatorStatus sequencer_strip_color_tag_set_exec(bContext *C, wmOperat
const Editing *ed = seq::editing_get(scene); const Editing *ed = seq::editing_get(scene);
const short color_tag = RNA_enum_get(op->ptr, "color"); const short color_tag = RNA_enum_get(op->ptr, "color");
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
strip->color_tag = color_tag; strip->color_tag = color_tag;
} }

View File

@@ -97,13 +97,13 @@ static wmOperatorStatus sequencer_retiming_data_show_exec(bContext *C, wmOperato
} }
if (sequencer_retiming_mode_is_active(C)) { if (sequencer_retiming_mode_is_active(C)) {
sequencer_retiming_data_hide_all(ed->seqbasep); sequencer_retiming_data_hide_all(ed->current_strips());
} }
else if (seq::retiming_data_is_editable(strip_act)) { else if (seq::retiming_data_is_editable(strip_act)) {
sequencer_retiming_data_hide_selection(ed->seqbasep); sequencer_retiming_data_hide_selection(ed->current_strips());
} }
else { else {
sequencer_retiming_data_show_selection(ed->seqbasep); sequencer_retiming_data_show_selection(ed->current_strips());
} }
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@@ -153,7 +153,7 @@ static wmOperatorStatus sequencer_retiming_reset_exec(bContext *C, wmOperator *
Scene *scene = CTX_data_sequencer_scene(C); Scene *scene = CTX_data_sequencer_scene(C);
const Editing *ed = seq::editing_get(scene); const Editing *ed = seq::editing_get(scene);
for (Strip *strip : seq::query_selected_strips(ed->seqbasep)) { for (Strip *strip : seq::query_selected_strips(ed->current_strips())) {
seq::retiming_reset(scene, strip); seq::retiming_reset(scene, strip);
} }

View File

@@ -318,7 +318,7 @@ Strip *find_neighboring_strip(const Scene *scene, const Strip *test, const int l
if (sel > 0) { if (sel > 0) {
sel = SELECT; sel = SELECT;
} }
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if ((strip != test) && (test->channel == strip->channel) && if ((strip != test) && (test->channel == strip->channel) &&
((sel == -1) || (sel && (strip->flag & SELECT)) || ((sel == -1) || (sel && (strip->flag & SELECT)) ||
(sel == 0 && (strip->flag & SELECT) == 0))) (sel == 0 && (strip->flag & SELECT) == 0)))
@@ -625,7 +625,7 @@ static void sequencer_select_linked_handle(const bContext *C,
if ((strip->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) { if ((strip->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
strip->flag |= SELECT; strip->flag |= SELECT;
select_active_side(scene, select_active_side(scene,
ed->seqbasep, ed->current_strips(),
seq::SIDE_LEFT, seq::SIDE_LEFT,
strip->channel, strip->channel,
seq::time_left_handle_frame_get(scene, strip)); seq::time_left_handle_frame_get(scene, strip));
@@ -642,7 +642,7 @@ static void sequencer_select_linked_handle(const bContext *C,
if ((strip->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) { if ((strip->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
strip->flag |= SELECT; strip->flag |= SELECT;
select_active_side(scene, select_active_side(scene,
ed->seqbasep, ed->current_strips(),
seq::SIDE_RIGHT, seq::SIDE_RIGHT,
strip->channel, strip->channel,
seq::time_left_handle_frame_get(scene, strip)); seq::time_left_handle_frame_get(scene, strip));
@@ -660,7 +660,7 @@ static void sequencer_select_linked_handle(const bContext *C,
else { else {
select_active_side(scene, select_active_side(scene,
ed->seqbasep, ed->current_strips(),
sel_side, sel_side,
strip->channel, strip->channel,
seq::time_left_handle_frame_get(scene, strip)); seq::time_left_handle_frame_get(scene, strip));
@@ -1075,7 +1075,7 @@ static blender::Vector<Strip *> padded_strips_under_mouse_get(const Scene *scene
} }
blender::Vector<Strip *> strips; blender::Vector<Strip *> strips;
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->channel != int(mouse_co[1])) { if (strip->channel != int(mouse_co[1])) {
continue; continue;
} }
@@ -1857,7 +1857,7 @@ static wmOperatorStatus sequencer_select_handles_exec(bContext *C, wmOperator *o
Scene *scene = CTX_data_sequencer_scene(C); Scene *scene = CTX_data_sequencer_scene(C);
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
int sel_side = RNA_enum_get(op->ptr, "side"); int sel_side = RNA_enum_get(op->ptr, "side");
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT) { if (strip->flag & SELECT) {
Strip *l_neighbor = find_neighboring_strip(scene, strip, seq::SIDE_LEFT, -1); Strip *l_neighbor = find_neighboring_strip(scene, strip, seq::SIDE_LEFT, -1);
Strip *r_neighbor = find_neighboring_strip(scene, strip, seq::SIDE_RIGHT, -1); Strip *r_neighbor = find_neighboring_strip(scene, strip, seq::SIDE_RIGHT, -1);
@@ -1904,7 +1904,7 @@ static wmOperatorStatus sequencer_select_handles_exec(bContext *C, wmOperator *o
} }
} }
/* Select strips. */ /* Select strips. */
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if ((strip->flag & SEQ_LEFTSEL) || (strip->flag & SEQ_RIGHTSEL)) { if ((strip->flag & SEQ_LEFTSEL) || (strip->flag & SEQ_RIGHTSEL)) {
if (!(strip->flag & SELECT)) { if (!(strip->flag & SELECT)) {
strip->flag |= SELECT; strip->flag |= SELECT;
@@ -2036,7 +2036,7 @@ static wmOperatorStatus sequencer_select_side_exec(bContext *C, wmOperator *op)
copy_vn_i(frame_ranges, ARRAY_SIZE(frame_ranges), frame_init); copy_vn_i(frame_ranges, ARRAY_SIZE(frame_ranges), frame_init);
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (UNLIKELY(strip->channel >= seq::MAX_CHANNELS)) { if (UNLIKELY(strip->channel >= seq::MAX_CHANNELS)) {
continue; continue;
} }
@@ -2056,7 +2056,7 @@ static wmOperatorStatus sequencer_select_side_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
} }
select_active_side_range(scene, ed->seqbasep, sel_side, frame_ranges, frame_init); select_active_side_range(scene, ed->current_strips(), sel_side, frame_ranges, frame_init);
ED_outliner_select_sync_from_sequence_tag(C); ED_outliner_select_sync_from_sequence_tag(C);
@@ -2185,7 +2185,7 @@ static wmOperatorStatus sequencer_box_select_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
rctf rq; rctf rq;
strip_rectf(scene, strip, &rq); strip_rectf(scene, strip, &rq);
if (BLI_rctf_isect(&rq, &rectf, nullptr)) { if (BLI_rctf_isect(&rq, &rectf, nullptr)) {

View File

@@ -89,7 +89,7 @@ Vector<Strip *> sequencer_visible_strips_get(const Scene *scene, const View2D *v
const Editing *ed = seq::editing_get(scene); const Editing *ed = seq::editing_get(scene);
Vector<Strip *> strips; Vector<Strip *> strips;
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (min_ii(seq::time_left_handle_frame_get(scene, strip), seq::time_start_frame_get(strip)) > if (min_ii(seq::time_left_handle_frame_get(scene, strip), seq::time_start_frame_get(strip)) >
v2d->cur.xmax) v2d->cur.xmax)
{ {

View File

@@ -487,7 +487,7 @@ static void sequencer_main_clamp_view(const bContext *C, ARegion *region)
seq::timeline_init_boundbox(scene, &strip_boundbox); seq::timeline_init_boundbox(scene, &strip_boundbox);
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
if (ed != nullptr) { if (ed != nullptr) {
seq::timeline_expand_boundbox(scene, ed->seqbasep, &strip_boundbox); seq::timeline_expand_boundbox(scene, ed->current_strips(), &strip_boundbox);
} }
/* We need to calculate how much the current view is padded and add this padding to our /* We need to calculate how much the current view is padded and add this padding to our
* strip bounding box. Without this, the scrub-bar or other overlays would occlude the * strip bounding box. Without this, the scrub-bar or other overlays would occlude the

View File

@@ -586,7 +586,7 @@ static void createTransSeqData(bContext * /*C*/, TransInfo *t)
tc->custom.type.free_cb = freeSeqData; tc->custom.type.free_cb = freeSeqData;
t->frame_side = transform_convert_frame_side_dir_get(t, float(scene->r.cfra)); t->frame_side = transform_convert_frame_side_dir_get(t, float(scene->r.cfra));
count = SeqTransCount(t, ed->seqbasep); count = SeqTransCount(t, ed->current_strips());
/* Allocate memory for data. */ /* Allocate memory for data. */
tc->data_len = count; tc->data_len = count;
@@ -615,7 +615,7 @@ static void createTransSeqData(bContext * /*C*/, TransInfo *t)
ts->initial_v2d_cur = t->region->v2d.cur; ts->initial_v2d_cur = t->region->v2d.cur;
/* Loop 2: build transdata array. */ /* Loop 2: build transdata array. */
SeqToTransData_build(t, ed->seqbasep, td, td2d, tdsq); SeqToTransData_build(t, ed->current_strips(), td, td2d, tdsq);
create_trans_seq_clamp_data(t, scene); create_trans_seq_clamp_data(t, scene);

View File

@@ -78,7 +78,8 @@ static VectorSet<Strip *> query_snap_sources_preview(const Scene *scene)
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
ListBase *channels = seq::channels_displayed_get(ed); ListBase *channels = seq::channels_displayed_get(ed);
snap_sources = seq::query_rendered_strips(scene, channels, ed->seqbasep, scene->r.cfra, 0); snap_sources = seq::query_rendered_strips(
scene, channels, ed->current_strips(), scene->r.cfra, 0);
snap_sources.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; }); snap_sources.remove_if([&](Strip *strip) { return (strip->flag & SELECT) == 0; });
return snap_sources; return snap_sources;
@@ -252,7 +253,8 @@ static VectorSet<Strip *> query_snap_targets_preview(const TransInfo *t)
Editing *ed = seq::editing_get(scene); Editing *ed = seq::editing_get(scene);
ListBase *channels = seq::channels_displayed_get(ed); ListBase *channels = seq::channels_displayed_get(ed);
snap_targets = seq::query_rendered_strips(scene, channels, ed->seqbasep, scene->r.cfra, 0); snap_targets = seq::query_rendered_strips(
scene, channels, ed->current_strips(), scene->r.cfra, 0);
/* Selected strips are only valid targets when snapping the cursor or origin. */ /* Selected strips are only valid targets when snapping the cursor or origin. */
if ((t->data_type == &TransConvertType_SequencerImage) && (t->flag & T_ORIGIN) == 0) { if ((t->data_type == &TransConvertType_SequencerImage) && (t->flag & T_ORIGIN) == 0) {

View File

@@ -331,8 +331,15 @@ typedef struct EditingRuntime {
} EditingRuntime; } EditingRuntime;
typedef struct Editing { typedef struct Editing {
/** Pointer to the current list of strips being edited (can be within a meta-strip). */ /**
* Pointer to the current list of strips being edited (can be within a meta-strip).
* \note Use #current_strips() to access, rather than using this variable directly.
*/
ListBase *seqbasep; ListBase *seqbasep;
/**
* Pointer to the current list of channels being displayed (can be within a meta-strip).
* \note Use #current_channels() to access, rather than using this variable directly.
*/
ListBase *displayed_channels; ListBase *displayed_channels;
void *_pad0; void *_pad0;
/** Pointer to the top-most strips. */ /** Pointer to the top-most strips. */
@@ -355,6 +362,16 @@ typedef struct Editing {
PrefetchJob *prefetch_job; PrefetchJob *prefetch_job;
EditingRuntime runtime; EditingRuntime runtime;
#ifdef __cplusplus
/** Access currently displayed strips, from root sequence or a meta-strip. */
ListBase *current_strips();
ListBase *current_strips() const;
/** Access currently displayed channels, from root sequence or a meta-strip. */
ListBase *current_channels();
ListBase *current_channels() const;
#endif
} Editing; } Editing;
/** \} */ /** \} */

View File

@@ -27,7 +27,7 @@ namespace blender::seq {
ListBase *channels_displayed_get(const Editing *ed) ListBase *channels_displayed_get(const Editing *ed)
{ {
return ed->displayed_channels; return ed->current_channels();
} }
void channels_displayed_set(Editing *ed, ListBase *channels) void channels_displayed_set(Editing *ed, ListBase *channels)

View File

@@ -585,7 +585,7 @@ static PrefetchJob *seq_prefetch_start_ex(const RenderData *context, float cfra)
pfjob->bmain_eval = BKE_main_new(); pfjob->bmain_eval = BKE_main_new();
pfjob->scene = context->scene; pfjob->scene = context->scene;
pfjob->seqbasep = context->scene->ed->seqbasep; pfjob->seqbasep = context->scene->ed->current_strips();
seq_prefetch_init_depsgraph(pfjob); seq_prefetch_init_depsgraph(pfjob);
} }
pfjob->bmain = context->bmain; pfjob->bmain = context->bmain;
@@ -616,7 +616,7 @@ void seq_prefetch_start(const RenderData *context, float timeline_frame)
{ {
Scene *scene = context->scene; Scene *scene = context->scene;
Editing *ed = scene->ed; Editing *ed = scene->ed;
bool has_strips = bool(ed->seqbasep->first); bool has_strips = bool(ed->current_strips()->first);
if (!context->is_prefetch_render && !context->is_proxy_render) { if (!context->is_prefetch_render && !context->is_proxy_render) {
bool playing = context->is_playing; bool playing = context->is_playing;

View File

@@ -1990,8 +1990,8 @@ ImBuf *render_give_ibuf(const RenderData *context, float timeline_frame, int cha
chanshown = 0; chanshown = 0;
} }
else { else {
seqbasep = ed->seqbasep; seqbasep = ed->current_strips();
channels = ed->displayed_channels; channels = ed->current_channels();
} }
intra_frame_cache_set_cur_frame( intra_frame_cache_set_cur_frame(

View File

@@ -426,7 +426,7 @@ ListBase *active_seqbase_get(const Editing *ed)
return nullptr; return nullptr;
} }
return ed->seqbasep; return ed->current_strips();
} }
void active_seqbase_set(Editing *ed, ListBase *seqbase) void active_seqbase_set(Editing *ed, ListBase *seqbase)
@@ -1158,3 +1158,23 @@ void eval_strips(Depsgraph *depsgraph, Scene *scene, ListBase *seqbase)
} }
} // namespace blender::seq } // namespace blender::seq
ListBase *Editing::current_strips()
{
return this->seqbasep;
}
ListBase *Editing::current_strips() const
{
/* NOTE: Const correctness is non-existent with ListBase anyway. */
return this->seqbasep;
}
ListBase *Editing::current_channels()
{
return this->displayed_channels;
}
ListBase *Editing::current_channels() const
{
/* NOTE: Const correctness is non-existent with ListBase anyway. */
return this->displayed_channels;
}

View File

@@ -1081,7 +1081,7 @@ bool retiming_selection_clear(const Editing *ed)
{ {
bool was_empty = true; bool was_empty = true;
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
for (SeqRetimingKey &key : retiming_keys_get(strip)) { for (SeqRetimingKey &key : retiming_keys_get(strip)) {
was_empty &= (key.flag & SEQ_KEY_SELECTED) == 0; was_empty &= (key.flag & SEQ_KEY_SELECTED) == 0;
key.flag &= ~SEQ_KEY_SELECTED; key.flag &= ~SEQ_KEY_SELECTED;
@@ -1114,7 +1114,7 @@ blender::Map<SeqRetimingKey *, Strip *> retiming_selection_get(const Editing *ed
if (!ed) { if (!ed) {
return selection; return selection;
} }
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
for (SeqRetimingKey &key : retiming_keys_get(strip)) { for (SeqRetimingKey &key : retiming_keys_get(strip)) {
if ((key.flag & SEQ_KEY_SELECTED) != 0) { if ((key.flag & SEQ_KEY_SELECTED) != 0) {
selection.add(&key, strip); selection.add(&key, strip);
@@ -1126,7 +1126,7 @@ blender::Map<SeqRetimingKey *, Strip *> retiming_selection_get(const Editing *ed
bool retiming_selection_contains(const Editing *ed, const SeqRetimingKey *key) bool retiming_selection_contains(const Editing *ed, const SeqRetimingKey *key)
{ {
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
for (const SeqRetimingKey &key_iter : retiming_keys_get(strip)) { for (const SeqRetimingKey &key_iter : retiming_keys_get(strip)) {
if ((key_iter.flag & SEQ_KEY_SELECTED) != 0 && &key_iter == key) { if ((key_iter.flag & SEQ_KEY_SELECTED) != 0 && &key_iter == key) {
return true; return true;

View File

@@ -52,7 +52,7 @@ bool select_active_get_pair(Scene *scene, Strip **r_strip_act, Strip **r_strip_o
*r_strip_other = nullptr; *r_strip_other = nullptr;
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
if (strip->flag & SELECT && (strip != (*r_strip_act))) { if (strip->flag & SELECT && (strip != (*r_strip_act))) {
if (*r_strip_other) { if (*r_strip_other) {
return false; return false;

View File

@@ -258,7 +258,7 @@ int time_find_next_prev_edit(Scene *scene,
return timeline_frame; return timeline_frame;
} }
LISTBASE_FOREACH (Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (Strip *, strip, ed->current_strips()) {
int i; int i;
if (do_skip_mute && render_is_muted(channels, strip)) { if (do_skip_mute && render_is_muted(channels, strip)) {

View File

@@ -344,7 +344,7 @@ const Strip *strip_topmost_get(const Scene *scene, int frame)
const Strip *best_strip = nullptr; const Strip *best_strip = nullptr;
int best_channel = -1; int best_channel = -1;
LISTBASE_FOREACH (const Strip *, strip, ed->seqbasep) { LISTBASE_FOREACH (const Strip *, strip, ed->current_strips()) {
if (render_is_muted(channels, strip) || !time_strip_intersects_frame(scene, strip, frame)) { if (render_is_muted(channels, strip) || !time_strip_intersects_frame(scene, strip, frame)) {
continue; continue;
} }

View File

@@ -26,7 +26,7 @@ class SequencerLoadMetastaskTest(unittest.TestCase):
self.assertEqual(len(meta_stack[0].sequences), 1) self.assertEqual(len(meta_stack[0].sequences), 1)
self.assertEqual(meta_stack[0].sequences[0].name, "Color") self.assertEqual(meta_stack[0].sequences[0].name, "Color")
# accesses ed->seqbasep through screen_ctx_selected_editable_sequences # accesses ed->current_strips() through screen_ctx_selected_editable_sequences
bpy.context.copy() bpy.context.copy()