diff options
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r-- | source/blender/sequencer/SEQ_iterator.h | 2 | ||||
-rw-r--r-- | source/blender/sequencer/intern/iterator.c | 32 |
2 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h index e4c9f20f736..cb2091511a9 100644 --- a/source/blender/sequencer/SEQ_iterator.h +++ b/source/blender/sequencer/SEQ_iterator.h @@ -71,11 +71,13 @@ bool SEQ_iterator_ensure(SeqCollection *collection, struct Sequence *SEQ_iterator_yield(SeqIterator *iterator); SeqCollection *SEQ_collection_create(const char *name); +SeqCollection *SEQ_collection_duplicate(SeqCollection *collection); uint SEQ_collection_len(const SeqCollection *collection); bool SEQ_collection_append_strip(struct Sequence *seq, SeqCollection *data); bool SEQ_collection_remove_strip(struct Sequence *seq, SeqCollection *data); void SEQ_collection_free(SeqCollection *collection); void SEQ_collection_merge(SeqCollection *collection_dst, SeqCollection *collection_src); +void SEQ_collection_exclude(SeqCollection *collection, SeqCollection *exclude_elements); void SEQ_collection_expand(struct ListBase *seqbase, SeqCollection *collection, void query_func(struct Sequence *seq_reference, diff --git a/source/blender/sequencer/intern/iterator.c b/source/blender/sequencer/intern/iterator.c index 20a2ee3b183..09f033e70fb 100644 --- a/source/blender/sequencer/intern/iterator.c +++ b/source/blender/sequencer/intern/iterator.c @@ -184,6 +184,22 @@ void SEQ_collection_merge(SeqCollection *collection_dst, SeqCollection *collecti } /** + * Remove strips from collection that are also in `exclude_elements`. Source collection will be + * freed. + * + * \param collection: collection from which strips are removed + * \param exclude_elements: collection of strips to be removed + */ +void SEQ_collection_exclude(SeqCollection *collection, SeqCollection *exclude_elements) +{ + Sequence *seq; + SEQ_ITERATOR_FOREACH (seq, exclude_elements) { + SEQ_collection_remove_strip(seq, collection); + } + SEQ_collection_free(exclude_elements); +} + +/** * Expand collection by running SEQ_query() for each strip, which will be used as reference. * Results of these queries will be merged into provided collection. * @@ -213,6 +229,22 @@ void SEQ_collection_expand(ListBase *seqbase, } } +/** + * Duplicate collection + * + * \param collection: collection to be duplicated + * \return duplicate of collection + */ +SeqCollection *SEQ_collection_duplicate(SeqCollection *collection) +{ + SeqCollection *duplicate = SEQ_collection_create(__func__); + Sequence *seq; + SEQ_ITERATOR_FOREACH (seq, collection) { + SEQ_collection_append_strip(seq, duplicate); + } + return duplicate; +} + /** \} */ /** |