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 | |
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')
-rw-r--r-- | source/blender/sequencer/SEQ_iterator.h | 6 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_utils.h | 7 | ||||
-rw-r--r-- | source/blender/sequencer/intern/iterator.c | 28 | ||||
-rw-r--r-- | source/blender/sequencer/intern/utils.c | 30 |
4 files changed, 35 insertions, 36 deletions
diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h index 669c55e1f4c..b34f0558c56 100644 --- a/source/blender/sequencer/SEQ_iterator.h +++ b/source/blender/sequencer/SEQ_iterator.h @@ -54,12 +54,6 @@ typedef struct SeqIterator { void SEQ_iterator_begin(struct Editing *ed, SeqIterator *iter, const bool use_current_sequences); void SEQ_iterator_next(SeqIterator *iter); void SEQ_iterator_end(SeqIterator *iter); -int SEQ_iterator_seqbase_recursive_apply(struct ListBase *seqbase, - int (*apply_fn)(struct Sequence *seq, void *), - void *arg); -int SEQ_iterator_recursive_apply(struct Sequence *seq, - int (*apply_fn)(struct Sequence *, void *), - void *arg); #ifdef __cplusplus } diff --git a/source/blender/sequencer/SEQ_utils.h b/source/blender/sequencer/SEQ_utils.h index 45f53a64688..52fac5d7d0e 100644 --- a/source/blender/sequencer/SEQ_utils.h +++ b/source/blender/sequencer/SEQ_utils.h @@ -54,7 +54,12 @@ void SEQ_set_scale_to_fit(const struct Sequence *seq, const int preview_width, const int preview_height, const eSeqImageFitMethod fit_method); - +int SEQ_seqbase_recursive_apply(struct ListBase *seqbase, + int (*apply_fn)(struct Sequence *seq, void *), + void *arg); +int SEQ_recursive_apply(struct Sequence *seq, + int (*apply_fn)(struct Sequence *, void *), + void *arg); #ifdef __cplusplus } #endif diff --git a/source/blender/sequencer/intern/iterator.c b/source/blender/sequencer/intern/iterator.c index f99667dea04..356f5db45e8 100644 --- a/source/blender/sequencer/intern/iterator.c +++ b/source/blender/sequencer/intern/iterator.c @@ -138,31 +138,3 @@ void SEQ_iterator_end(SeqIterator *iter) iter->valid = 0; } - -int SEQ_iterator_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_iterator_recursive_apply(iseq, apply_fn, arg) == -1) { - return -1; /* bail out */ - } - } - return 1; -} - -int SEQ_iterator_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_iterator_seqbase_recursive_apply(&seq->seqbase, apply_fn, arg); - } - - return ret; -} 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; +} |