Cleanup: rename iterators over sequences to be more clear about what they do.

No functional changes expected.
This commit is contained in:
Bastien Montagne 2020-08-21 18:55:27 +02:00
parent 74ded456b3
commit 70500121b4
22 changed files with 184 additions and 143 deletions

View File

@ -62,30 +62,34 @@ typedef struct SeqIterator {
int valid;
} SeqIterator;
void BKE_sequence_iterator_begin(struct Editing *ed, SeqIterator *iter, bool use_pointer);
void BKE_sequence_iterator_begin(struct Editing *ed,
SeqIterator *iter,
const bool use_current_sequences);
void BKE_sequence_iterator_next(SeqIterator *iter);
void BKE_sequence_iterator_end(SeqIterator *iter);
#define SEQP_BEGIN(_ed, _seq) \
{ \
SeqIterator iter_macro; \
for (BKE_sequence_iterator_begin(_ed, &iter_macro, true); iter_macro.valid; \
BKE_sequence_iterator_next(&iter_macro)) { \
_seq = iter_macro.seq;
#define SEQ_BEGIN(ed, _seq) \
#define SEQ_ALL_BEGIN(ed, _seq) \
{ \
SeqIterator iter_macro; \
for (BKE_sequence_iterator_begin(ed, &iter_macro, false); iter_macro.valid; \
BKE_sequence_iterator_next(&iter_macro)) { \
_seq = iter_macro.seq;
#define SEQ_END \
#define SEQ_ALL_END \
} \
BKE_sequence_iterator_end(&iter_macro); \
} \
((void)0)
#define SEQ_CURRENT_BEGIN(_ed, _seq) \
{ \
SeqIterator iter_macro; \
for (BKE_sequence_iterator_begin(_ed, &iter_macro, true); iter_macro.valid; \
BKE_sequence_iterator_next(&iter_macro)) { \
_seq = iter_macro.seq;
#define SEQ_CURRENT_END SEQ_ALL_END
typedef enum eSeqTaskId {
SEQ_TASK_MAIN_RENDER,
SEQ_TASK_PREFETCH_RENDER,

View File

@ -703,7 +703,7 @@ void BKE_bpath_traverse_id(
if (scene->ed) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (SEQ_HAS_PATH(seq)) {
StripElem *se = seq->strip->stripdata;
@ -732,7 +732,7 @@ void BKE_bpath_traverse_id(
}
}
}
SEQ_END;
SEQ_ALL_END;
}
break;
}

View File

@ -2197,7 +2197,7 @@ void do_versions_ipos_to_animato(Main *bmain)
AnimData *adt = BKE_animdata_add_id(id);
SEQ_BEGIN (ed, seq) {
SEQ_ALL_BEGIN (ed, seq) {
IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL;
short adrcode = SEQ_FAC1;
@ -2238,7 +2238,7 @@ void do_versions_ipos_to_animato(Main *bmain)
id_us_min(&seq->ipo->id);
seq->ipo = NULL;
}
SEQ_END;
SEQ_ALL_END;
}
}

View File

@ -469,7 +469,7 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData *data)
}
if (scene->ed) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
BKE_LIB_FOREACHID_PROCESS(data, seq->scene, IDWALK_CB_NEVER_SELF);
BKE_LIB_FOREACHID_PROCESS(data, seq->scene_camera, IDWALK_CB_NOP);
BKE_LIB_FOREACHID_PROCESS(data, seq->clip, IDWALK_CB_USER);
@ -486,7 +486,7 @@ static void scene_foreach_id(ID *id, LibraryForeachIDData *data)
BKE_LIB_FOREACHID_PROCESS(data, text_data->text_font, IDWALK_CB_USER);
}
}
SEQ_END;
SEQ_ALL_END;
}
/* This pointer can be NULL during old files reading, better be safe than sorry. */
@ -2570,13 +2570,13 @@ static void scene_sequencer_disable_sound_strips(Scene *scene)
return;
}
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (seq->scene_sound != NULL) {
BKE_sound_remove_scene_sound(scene, seq->scene_sound);
seq->scene_sound = NULL;
}
}
SEQ_END;
SEQ_ALL_END;
}
void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
@ -2587,7 +2587,7 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
}
BKE_sound_ensure_scene(scene);
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (seq->scene_sound == NULL) {
if (seq->sound != NULL) {
if (seq->scene_sound == NULL) {
@ -2625,7 +2625,7 @@ void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
seq->scene_sound, seq->pan, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
}
}
SEQ_END;
SEQ_ALL_END;
BKE_sequencer_update_muting(scene->ed);
BKE_sequencer_update_sound_bounds_all(scene);
}

View File

@ -507,11 +507,12 @@ void BKE_sequencer_editing_free(Scene *scene, const bool do_id_user)
BKE_sequencer_prefetch_free(scene);
BKE_sequencer_cache_destruct(scene);
SEQ_BEGIN (ed, seq) {
SEQ_ALL_BEGIN(ed, seq)
{
/* handle cache freeing above */
BKE_sequence_free_ex(scene, seq, false, do_id_user, false);
}
SEQ_END;
SEQ_ALL_END;
BLI_freelistN(&ed->metastack);
MEM_freeN(ed);
@ -662,7 +663,7 @@ void BKE_sequencer_new_render_data(Main *bmain,
/* ************************* iterator ************************** */
/* *************** (replaces old WHILE_SEQ) ********************* */
/* **************** use now SEQ_BEGIN () SEQ_END ***************** */
/* **************** use now SEQ_ALL_BEGIN () SEQ_ALL_END ***************** */
/* sequence strip iterator:
* - builds a full array, recursively into meta strips
@ -697,7 +698,10 @@ static void seq_build_array(ListBase *seqbase, Sequence ***array, int depth)
}
}
static void seq_array(Editing *ed, Sequence ***seqarray, int *tot, bool use_pointer)
static void seq_array(Editing *ed,
Sequence ***seqarray,
int *tot,
const bool use_current_sequences)
{
Sequence **array;
@ -708,7 +712,7 @@ static void seq_array(Editing *ed, Sequence ***seqarray, int *tot, bool use_poin
return;
}
if (use_pointer) {
if (use_current_sequences) {
seq_count(ed->seqbasep, tot);
}
else {
@ -720,7 +724,7 @@ static void seq_array(Editing *ed, Sequence ***seqarray, int *tot, bool use_poin
}
*seqarray = array = MEM_mallocN(sizeof(Sequence *) * (*tot), "SeqArray");
if (use_pointer) {
if (use_current_sequences) {
seq_build_array(ed->seqbasep, &array, 0);
}
else {
@ -728,10 +732,10 @@ static void seq_array(Editing *ed, Sequence ***seqarray, int *tot, bool use_poin
}
}
void BKE_sequence_iterator_begin(Editing *ed, SeqIterator *iter, bool use_pointer)
void BKE_sequence_iterator_begin(Editing *ed, SeqIterator *iter, const bool use_current_sequences)
{
memset(iter, 0, sizeof(*iter));
seq_array(ed, &iter->array, &iter->tot, use_pointer);
seq_array(ed, &iter->array, &iter->tot, use_current_sequences);
if (iter->tot) {
iter->cur = 0;
@ -6168,7 +6172,8 @@ void BKE_sequencer_check_uuids_unique_and_report(const Scene *scene)
BLI_session_uuid_ghash_hash, BLI_session_uuid_ghash_compare, "sequencer used uuids");
const Sequence *sequence;
SEQ_BEGIN (scene->ed, sequence) {
SEQ_ALL_BEGIN(scene->ed, sequence)
{
const SessionUUID *session_uuid = &sequence->runtime.session_uuid;
if (!BLI_session_uuid_is_generated(session_uuid)) {
printf("Sequence %s does not have UUID generated.\n", sequence->name);
@ -6182,7 +6187,7 @@ void BKE_sequencer_check_uuids_unique_and_report(const Scene *scene)
BLI_gset_insert(used_uuids, (void *)session_uuid);
}
SEQ_END;
SEQ_ALL_END;
BLI_gset_free(used_uuids, NULL);
}

View File

@ -5624,7 +5624,7 @@ static void lib_link_scene(BlendLibReader *reader, Scene *sce)
}
Sequence *seq;
SEQ_BEGIN (sce->ed, seq) {
SEQ_ALL_BEGIN (sce->ed, seq) {
IDP_BlendLibRead(reader, seq->prop);
if (seq->ipo) {
@ -5666,7 +5666,7 @@ static void lib_link_scene(BlendLibReader *reader, Scene *sce)
lib_link_sequence_modifiers(reader, sce, &seq->modifiers);
}
SEQ_END;
SEQ_ALL_END;
LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) {
if (marker->camera) {
@ -5899,7 +5899,7 @@ static void direct_link_scene(BlendDataReader *reader, Scene *sce)
link_recurs_seq(reader, &ed->seqbase);
Sequence *seq;
SEQ_BEGIN (ed, seq) {
SEQ_ALL_BEGIN (ed, seq) {
/* Do as early as possible, so that other parts of reading can rely on valid session UUID. */
BKE_sequence_session_uuid_generate(seq);
@ -5962,7 +5962,7 @@ static void direct_link_scene(BlendDataReader *reader, Scene *sce)
direct_link_sequence_modifiers(reader, &seq->modifiers);
}
SEQ_END;
SEQ_ALL_END;
/* link metastack, slight abuse of structs here,
* have to restore pointer to internal part in struct */
@ -10158,7 +10158,7 @@ static void expand_scene(BlendExpander *expander, Scene *sce)
if (sce->ed) {
Sequence *seq;
SEQ_BEGIN (sce->ed, seq) {
SEQ_ALL_BEGIN (sce->ed, seq) {
IDP_BlendExpand(expander, seq->prop);
if (seq->scene) {
@ -10182,7 +10182,7 @@ static void expand_scene(BlendExpander *expander, Scene *sce)
BLO_expand(expander, data->text_font);
}
}
SEQ_END;
SEQ_ALL_END;
}
if (sce->rigidbody_world) {

View File

@ -666,7 +666,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->ed && scene->ed->seqbasep) {
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (seq->type == SEQ_TYPE_SOUND_HD) {
char str[FILE_MAX];
BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
@ -682,7 +682,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
#undef SEQ_USE_PROXY_CUSTOM_DIR
#undef SEQ_USE_PROXY_CUSTOM_FILE
}
SEQ_END;
SEQ_ALL_END;
}
}
@ -1409,10 +1409,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
}
SEQ_BEGIN (sce->ed, seq) {
SEQ_ALL_BEGIN (sce->ed, seq) {
seq->volume = 1.0f;
}
SEQ_END;
SEQ_ALL_END;
}
/* particle brush strength factor was changed from int to float */
@ -1681,12 +1681,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (seq->sat == 0.0f) {
seq->sat = 1.0f;
}
}
SEQ_END;
SEQ_ALL_END;
}
/* GSOC 2010 Sculpt - New settings for Brush */
@ -2166,10 +2166,10 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
scene->r.ffcodecdata.audio_channels = 2;
scene->audio.volume = 1.0f;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
seq->pitch = 1.0f;
}
SEQ_END;
SEQ_ALL_END;
}
}

View File

@ -1489,7 +1489,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (scene->ed) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
Strip *strip = seq->strip;
if (strip && strip->color_balance) {
@ -1512,7 +1512,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
strip->color_balance = NULL;
}
}
SEQ_END;
SEQ_ALL_END;
}
}
}
@ -1804,7 +1804,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
enum { SEQ_MAKE_PREMUL = (1 << 6) };
if (seq->flag & SEQ_MAKE_PREMUL) {
seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
@ -1813,7 +1813,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
BKE_sequence_alpha_mode_from_extension(seq);
}
}
SEQ_END;
SEQ_ALL_END;
if (scene->r.bake_samples == 0) {
scene->r.bake_samples = 256;
@ -2447,13 +2447,13 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (seq->type == SEQ_TYPE_WIPE) {
WipeVars *wv = seq->effectdata;
wv->angle = DEG2RADF(wv->angle);
}
}
SEQ_END;
SEQ_ALL_END;
}
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {

View File

@ -913,7 +913,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
srv = scene->r.views.last;
BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
seq->stereo3d_format = MEM_callocN(sizeof(Stereo3dFormat), "Stereo Display 3d Format");
#define SEQ_USE_PROXY_CUSTOM_DIR (1 << 19)
@ -929,7 +929,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
#undef SEQ_USE_PROXY_CUSTOM_DIR
#undef SEQ_USE_PROXY_CUSTOM_FILE
}
SEQ_END;
SEQ_ALL_END;
}
for (screen = bmain->screens.first; screen; screen = screen->id.next) {
@ -1214,7 +1214,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (seq->type != SEQ_TYPE_TEXT) {
continue;
}
@ -1230,7 +1230,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
data->shadow_color[3] = 1.0f;
}
}
SEQ_END;
SEQ_ALL_END;
}
/* Adding "Properties" region to DopeSheet */

View File

@ -3463,7 +3463,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (scene->ed) {
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
seq->flag &= ~(SEQ_FLAG_UNUSED_6 | SEQ_FLAG_UNUSED_18 | SEQ_FLAG_UNUSED_19 |
SEQ_FLAG_UNUSED_21);
if (seq->type == SEQ_TYPE_SPEED) {
@ -3471,7 +3471,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
s->flags &= ~(SEQ_SPEED_UNUSED_1);
}
}
SEQ_END;
SEQ_ALL_END;
}
}

View File

@ -1251,12 +1251,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
while (sce) {
ed = sce->ed;
if (ed) {
SEQ_BEGIN (sce->ed, seq) {
SEQ_ALL_BEGIN(sce->ed, seq)
{
if (seq->type == SEQ_TYPE_IMAGE || seq->type == SEQ_TYPE_MOVIE) {
seq->alpha_mode = SEQ_ALPHA_STRAIGHT;
}
}
SEQ_END;
SEQ_ALL_END;
}
sce = sce->id.next;
@ -2442,12 +2443,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
Sequence *seq;
for (sce = bmain->scenes.first; sce; sce = sce->id.next) {
SEQ_BEGIN (sce->ed, seq) {
SEQ_ALL_BEGIN(sce->ed, seq)
{
if (seq->blend_mode == 0) {
seq->blend_opacity = 100.0f;
}
}
SEQ_END;
SEQ_ALL_END;
}
}
@ -2595,12 +2597,13 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
while (sce) {
ed = sce->ed;
if (ed) {
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (seq->strip && seq->strip->proxy) {
seq->strip->proxy->quality = 90;
}
}
SEQ_END;
SEQ_CURRENT_END;
}
sce = sce->id.next;

View File

@ -2343,15 +2343,15 @@ static void write_scene(BlendWriter *writer, Scene *sce, const void *id_address)
/* reset write flags too */
SEQ_BEGIN (ed, seq) {
SEQ_ALL_BEGIN (ed, seq) {
if (seq->strip) {
seq->strip->done = false;
}
BLO_write_struct(writer, Sequence, seq);
}
SEQ_END;
SEQ_ALL_END;
SEQ_BEGIN (ed, seq) {
SEQ_ALL_BEGIN (ed, seq) {
if (seq->strip && seq->strip->done == 0) {
/* write strip with 'done' at 0 because readfile */
@ -2416,7 +2416,7 @@ static void write_scene(BlendWriter *writer, Scene *sce, const void *id_address)
write_sequence_modifiers(writer, &seq->modifiers);
}
SEQ_END;
SEQ_ALL_END;
/* new; meta stack too, even when its nasty restore code */
LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) {

View File

@ -1828,7 +1828,7 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene)
function_bind(BKE_scene_eval_sequencer_sequences, _1, scene_cow));
/* Make sure data for sequences is in the graph. */
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
build_idproperties(seq->prop);
if (seq->sound != nullptr) {
build_sound(seq->sound);
@ -1845,7 +1845,7 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene)
}
/* TODO(sergey): Movie clip, scene, camera, mask. */
}
SEQ_END;
SEQ_ALL_END;
}
void DepsgraphNodeBuilder::build_scene_audio(Scene *scene)

View File

@ -2688,7 +2688,7 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
ComponentKey sequencer_key(&scene->id, NodeType::SEQUENCER);
Sequence *seq;
bool has_audio_strips = false;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
build_idproperties(seq->prop);
if (seq->sound != nullptr) {
build_sound(seq->sound);
@ -2714,7 +2714,7 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
}
/* TODO(sergey): Movie clip, camera, mask. */
}
SEQ_END;
SEQ_ALL_END;
if (has_audio_strips) {
add_relation(sequencer_key, scene_audio_key, "Sequencer -> Audio");
}

View File

@ -41,7 +41,7 @@ SequencerBackup::SequencerBackup(const Depsgraph *depsgraph) : depsgraph(depsgra
void SequencerBackup::init_from_scene(Scene *scene)
{
Sequence *sequence;
SEQ_BEGIN (scene->ed, sequence) {
SEQ_ALL_BEGIN (scene->ed, sequence) {
SequenceBackup sequence_backup(depsgraph);
sequence_backup.init_from_sequence(sequence);
if (!sequence_backup.isEmpty()) {
@ -50,13 +50,13 @@ void SequencerBackup::init_from_scene(Scene *scene)
sequences_backup.add(session_uuid, sequence_backup);
}
}
SEQ_END;
SEQ_ALL_END;
}
void SequencerBackup::restore_to_scene(Scene *scene)
{
Sequence *sequence;
SEQ_BEGIN (scene->ed, sequence) {
SEQ_ALL_BEGIN (scene->ed, sequence) {
const SessionUUID &session_uuid = sequence->runtime.session_uuid;
BLI_assert(BLI_session_uuid_is_generated(&session_uuid));
SequenceBackup *sequence_backup = sequences_backup.lookup_ptr(session_uuid);
@ -64,7 +64,7 @@ void SequencerBackup::restore_to_scene(Scene *scene)
sequence_backup->restore_to_sequence(sequence);
}
}
SEQ_END;
SEQ_ALL_END;
/* Cleanup audio while the scene is still known. */
for (SequenceBackup &sequence_backup : sequences_backup.values()) {
if (sequence_backup.scene_sound != nullptr) {

View File

@ -257,10 +257,10 @@ static void sound_update_animation_flags(Scene *scene)
}
scene->id.tag |= LIB_TAG_DOIT;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
BKE_sequencer_recursive_apply(seq, sound_update_animation_flags_fn, scene);
}
SEQ_END;
SEQ_ALL_END;
fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
if (fcu || driven) {

View File

@ -89,11 +89,12 @@
#define SEQ_SCROLLER_TEXT_OFFSET 8
#define MUTE_ALPHA 120
/* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
/* Note, Don't use SEQ_ALL_BEGIN/SEQ_ALL_END while drawing!
* it messes up transform. */
#undef SEQ_BEGIN
#undef SEQP_BEGIN
#undef SEQ_END
#undef SEQ_ALL_BEGIN
#undef SEQ_ALL_END
#undef SEQ_CURRENT_BEGIN
#undef SEQ_CURRENT_END
static Sequence *special_seq_update = NULL;
@ -357,7 +358,7 @@ static void draw_seq_waveform(View2D *v2d,
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
{
/* Don't use SEQ_BEGIN/SEQ_END here,
/* Don't use SEQ_ALL_BEGIN/SEQ_ALL_END here,
* because it changes seq->depth, which is needed for transform. */
Sequence *seq;
uchar col[4];

View File

@ -216,7 +216,8 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports)
file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list");
bool selected = false; /* Check for no selected strips */
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META) ||
(seq->flag & SELECT) == 0) {
continue;
@ -239,7 +240,7 @@ static void seq_proxy_build_job(const bContext *C, ReportList *reports)
BKE_reportf(reports, RPT_WARNING, "Overwrite is not checked for %s, skipping", seq->name);
}
}
SEQ_END;
SEQ_CURRENT_END;
if (!selected) {
BKE_reportf(reports, RPT_WARNING, "Select movie or image strips");
@ -482,10 +483,11 @@ void ED_sequencer_deselect_all(Scene *scene)
return;
}
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
seq->flag &= ~SEQ_ALLSEL;
}
SEQ_END;
SEQ_CURRENT_END;
}
void recurs_sel_seq(Sequence *seqm)
@ -1030,7 +1032,7 @@ static void set_filter_seq(Scene *scene)
return;
}
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN (ed, seq) {
if (seq->flag & SELECT) {
if (seq->type == SEQ_TYPE_MOVIE) {
seq->flag |= SEQ_FILTERY;
@ -1039,7 +1041,7 @@ static void set_filter_seq(Scene *scene)
}
}
}
SEQ_END;
SEQ_CURRENT_END;
}
#endif
@ -1065,7 +1067,8 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
return;
}
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (seq->flag & SELECT) {
if (STREQLEN(seq->strip->dir, from, strlen(from))) {
printf("found %s\n", seq->strip->dir);
@ -1080,7 +1083,7 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
}
}
}
SEQ_END;
SEQ_CURRENT_END;
}
/** \} */
@ -1308,7 +1311,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
}
/* Test for effects and overlap.
* Don't use SEQP_BEGIN since that would be recursive. */
* Don't use SEQ_CURRENT_BEGIN since that would be recursive. */
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK)) {
seq->flag &= ~SEQ_OVERLAP;
@ -2294,25 +2297,28 @@ static int sequencer_split_exec(bContext *C, wmOperator *op)
Sequence *seq;
if (ignore_selection) {
if (use_cursor_position) {
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (seq->enddisp == split_frame && seq->machine == split_channel) {
seq_selected = seq->flag & SEQ_ALLSEL;
}
}
SEQ_END;
SEQ_CURRENT_END;
if (!seq_selected) {
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (seq->startdisp == split_frame && seq->machine == split_channel) {
seq->flag &= ~SEQ_ALLSEL;
}
}
SEQ_END;
SEQ_CURRENT_END;
}
}
}
else {
if (split_side != SEQ_SIDE_BOTH) {
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (split_side == SEQ_SIDE_LEFT) {
if (seq->startdisp >= split_frame) {
seq->flag &= ~SEQ_ALLSEL;
@ -2324,15 +2330,16 @@ static int sequencer_split_exec(bContext *C, wmOperator *op)
}
}
}
SEQ_END;
SEQ_CURRENT_END;
}
}
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (seq->seq1 || seq->seq2 || seq->seq3) {
BKE_sequence_calc(scene, seq);
}
}
SEQ_END;
SEQ_CURRENT_END;
BKE_sequencer_sort(scene);
}
@ -2521,12 +2528,13 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
BKE_sequencer_prefetch_stop(scene);
SEQP_BEGIN (scene->ed, seq) {
SEQ_CURRENT_BEGIN(scene->ed, seq)
{
if (seq->flag & SELECT) {
BKE_sequencer_flag_for_removal(scene, ed->seqbasep, seq);
}
}
SEQ_END;
SEQ_CURRENT_END;
BKE_sequencer_remove_flagged_sequences(scene, ed->seqbasep);
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
@ -2952,7 +2960,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
recurs_del_seq_flag(scene, ed->seqbasep, SEQ_FLAG_DELETE, 0);
/* Test for effects and overlap
* don't use SEQP_BEGIN since that would be recursive. */
* don't use SEQ_CURRENT_BEGIN since that would be recursive. */
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
seq->flag &= ~SEQ_OVERLAP;
@ -3476,7 +3484,8 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list");
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if ((seq->flag & SELECT)) {
ListBase queue = {NULL, NULL};
LinkData *link;
@ -3493,7 +3502,7 @@ static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
BKE_sequencer_free_imbuf(scene, &ed->seqbase, false);
}
}
SEQ_END;
SEQ_CURRENT_END;
BLI_gset_free(file_list, MEM_freeN);
@ -3544,7 +3553,8 @@ static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op)
turnon = false;
}
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if ((seq->flag & SELECT)) {
if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META)) {
BKE_sequencer_proxy_set(seq, turnon);
@ -3589,7 +3599,7 @@ static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op)
}
}
}
SEQ_END;
SEQ_CURRENT_END;
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
@ -3966,12 +3976,13 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
SEQ_BEGIN (ed, seq) {
SEQ_ALL_BEGIN(ed, seq)
{
if (seq->type == SEQ_TYPE_TEXT) {
BLI_addtail(&text_seq, MEM_dupallocN(seq));
}
}
SEQ_END;
SEQ_ALL_END;
if (BLI_listbase_is_empty(&text_seq)) {
BKE_report(op->reports, RPT_ERROR, "No subtitles (text strips) to export");

View File

@ -232,7 +232,8 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
SEQP_BEGIN (ed, seq_iter) {
SEQ_CURRENT_BEGIN(ed, seq_iter)
{
if (seq_iter->flag & SELECT) {
if (seq_iter == seq) {
continue;
@ -254,7 +255,7 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op)
BKE_sequence_modifier_list_copy(seq_iter, seq);
}
}
SEQ_END;
SEQ_CURRENT_END;
BKE_sequence_invalidate_cache_preprocessed(scene, seq);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);

View File

@ -415,14 +415,15 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
const float x = UI_view2d_region_to_view_x(v2d, mval[0]);
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (((x < CFRA) && (seq->enddisp <= CFRA)) || ((x >= CFRA) && (seq->startdisp >= CFRA))) {
/* Select left or right. */
seq->flag |= SELECT;
recurs_sel_seq(seq);
}
}
SEQ_END;
SEQ_CURRENT_END;
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
@ -975,7 +976,8 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op)
ED_sequencer_deselect_all(scene);
}
const int cfra = CFRA;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
bool test = false;
switch (side) {
case -1:
@ -994,7 +996,7 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op)
recurs_sel_seq(seq);
}
}
SEQ_END;
SEQ_CURRENT_END;
ED_outliner_select_sync_from_sequence_tag(C);
@ -1282,13 +1284,14 @@ static bool select_grouped_type(Editing *ed, Sequence *actseq, const int channel
Sequence *seq;
bool changed = false;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == actseq->type) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
return changed;
}
@ -1299,13 +1302,14 @@ static bool select_grouped_type_basic(Editing *ed, Sequence *actseq, const int c
bool changed = false;
const bool is_sound = SEQ_IS_SOUND(actseq);
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq))) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
return changed;
}
@ -1316,14 +1320,15 @@ static bool select_grouped_type_effect(Editing *ed, Sequence *actseq, const int
bool changed = false;
const bool is_effect = SEQ_IS_EFFECT(actseq);
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) &&
(is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq))) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
return changed;
}
@ -1339,45 +1344,49 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq, const int channel
}
if (SEQ_HAS_PATH(actseq) && dir) {
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && SEQ_HAS_PATH(seq) && seq->strip &&
STREQ(seq->strip->dir, dir)) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
}
else if (actseq->type == SEQ_TYPE_SCENE) {
Scene *sce = actseq->scene;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_SCENE && seq->scene == sce) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
}
else if (actseq->type == SEQ_TYPE_MOVIECLIP) {
MovieClip *clip = actseq->clip;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_MOVIECLIP &&
seq->clip == clip) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
}
else if (actseq->type == SEQ_TYPE_MASK) {
struct Mask *mask = actseq->mask;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_MASK && seq->mask == mask) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
}
return changed;
@ -1394,15 +1403,17 @@ static bool select_grouped_effect(Editing *ed, Sequence *actseq, const int chann
effects[i] = false;
}
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && (seq->type & SEQ_TYPE_EFFECT) &&
ELEM(actseq, seq->seq1, seq->seq2, seq->seq3)) {
effects[seq->type] = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (SEQ_CHANNEL_CHECK(seq, channel) && effects[seq->type]) {
if (seq->seq1) {
seq->seq1->flag |= SELECT;
@ -1416,7 +1427,7 @@ static bool select_grouped_effect(Editing *ed, Sequence *actseq, const int chann
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
return changed;
}
@ -1426,13 +1437,14 @@ static bool select_grouped_time_overlap(Editing *ed, Sequence *actseq)
Sequence *seq;
bool changed = false;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
if (seq->startdisp < actseq->enddisp && seq->enddisp > actseq->startdisp) {
seq->flag |= SELECT;
changed = true;
}
}
SEQ_END;
SEQ_CURRENT_END;
return changed;
}
@ -1447,10 +1459,11 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int
int machine = actseq->machine;
SeqIterator iter;
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
seq->tmp = NULL;
}
SEQ_END;
SEQ_CURRENT_END;
actseq->tmp = POINTER_FROM_INT(true);
@ -1523,11 +1536,12 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
bool changed = false;
if (!extend) {
SEQP_BEGIN (ed, seq) {
SEQ_CURRENT_BEGIN(ed, seq)
{
seq->flag &= ~SELECT;
changed = true;
}
SEQ_END;
SEQ_CURRENT_END;
}
switch (type) {

View File

@ -1267,12 +1267,12 @@ void IMB_colormanagement_check_file_config(Main *bmain)
/* check sequencer strip input color space settings */
Sequence *seq;
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN (scene->ed, seq) {
if (seq->strip) {
colormanage_check_colorspace_settings(&seq->strip->colorspace_settings, "sequencer strip");
}
}
SEQ_END;
SEQ_ALL_END;
}
/* ** check input color space settings ** */

View File

@ -623,13 +623,14 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
bool seq_found = false;
if (&scene->sequencer_colorspace_settings != colorspace_settings) {
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN(scene->ed, seq)
{
if (seq->strip && &seq->strip->colorspace_settings == colorspace_settings) {
seq_found = true;
break;
}
}
SEQ_END;
SEQ_ALL_END;
}
if (seq_found) {
@ -643,10 +644,11 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
BKE_sequence_invalidate_cache_preprocessed(scene, seq);
}
else {
SEQ_BEGIN (scene->ed, seq) {
SEQ_ALL_BEGIN(scene->ed, seq)
{
BKE_sequence_free_anim(seq);
}
SEQ_END;
SEQ_ALL_END;
}
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);