diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-05-06 06:53:17 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-05-06 06:57:39 +0300 |
commit | 11b50b2b77664f820291acb029c394a36edb337d (patch) | |
tree | 7ff9342b4d8ef0343daf905b1e12ced04ad93a08 /source/blender/sequencer/intern/utils.c | |
parent | f74b7e6ce9b905f8fe32048391512a3d79111325 (diff) |
Cleanup: VSE: move functions from incorrect file
`SEQ_recursive_apply` and `SEQ_seqbase_recursive_apply` were incorrectly
refactored into `iterator.c` file, but they aren't part and don't use
sequencer iterator.
Functions are moved to `utils.c` file.
Diffstat (limited to 'source/blender/sequencer/intern/utils.c')
-rw-r--r-- | source/blender/sequencer/intern/utils.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index a15465eb3c0..6d5332b2b15 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -160,7 +160,7 @@ void SEQ_sequence_base_unique_name_recursive(ListBase *seqbasep, Sequence *seq) while (sui.match) { sui.match = 0; seqbase_unique_name(seqbasep, &sui); - SEQ_iterator_seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_fn, &sui); + SEQ_seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_fn, &sui); } BLI_strncpy(seq->name + 2, sui.name_dest, sizeof(seq->name) - 2); @@ -584,3 +584,31 @@ void SEQ_set_scale_to_fit(const Sequence *seq, break; } } + +int SEQ_seqbase_recursive_apply(ListBase *seqbase, + int (*apply_fn)(Sequence *seq, void *), + void *arg) +{ + Sequence *iseq; + for (iseq = seqbase->first; iseq; iseq = iseq->next) { + if (SEQ_recursive_apply(iseq, apply_fn, arg) == -1) { + return -1; /* bail out */ + } + } + return 1; +} + +int SEQ_recursive_apply(Sequence *seq, int (*apply_fn)(Sequence *, void *), void *arg) +{ + int ret = apply_fn(seq, arg); + + if (ret == -1) { + return -1; /* bail out */ + } + + if (ret && seq->seqbase.first) { + ret = SEQ_seqbase_recursive_apply(&seq->seqbase, apply_fn, arg); + } + + return ret; +} |