Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2021-08-20 17:30:34 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-08-25 18:30:39 +0300
commitf49d438ced7c5874dbf43976d9901a462176f541 (patch)
treefae7b745eaf1e793b53119f3ec27c34621727c58 /source/blender/sequencer/SEQ_iterator.h
parent796035ad930383c26302ab6a57e8e6c90394603b (diff)
Cleanup and remove SEQ_ALL_BEGIN macro
We now use a for_each function with callback to iterate through all sequences in the scene. This has the benefit that we now only loop over the sequences in the scene once. Before we would loop over them twice and allocate memory to store temporary data. The allocation of temporary data lead to unintentional memory leaks if the code used returns to exit out of the iteration loop. The new for_each callback method doesn't allocate any temporary data and only iterates though all sequences once. Reviewed By: Richard Antalik, Bastien Montagne Differential Revision: http://developer.blender.org/D12278
Diffstat (limited to 'source/blender/sequencer/SEQ_iterator.h')
-rw-r--r--source/blender/sequencer/SEQ_iterator.h25
1 files changed, 7 insertions, 18 deletions
diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h
index 3ade7309f89..055db07f646 100644
--- a/source/blender/sequencer/SEQ_iterator.h
+++ b/source/blender/sequencer/SEQ_iterator.h
@@ -39,23 +39,7 @@ struct Sequence;
SEQ_iterator_ensure(collection, &iter, &var) && var != NULL; \
var = SEQ_iterator_yield(&iter))
-#define SEQ_ALL_BEGIN(ed, var) \
- { \
- if (ed != NULL) { \
- SeqCollection *all_strips = SEQ_query_all_strips_recursive(&ed->seqbase); \
- GSetIterator gsi; \
- GSET_ITER (gsi, all_strips->set) { \
- var = (Sequence *)(BLI_gsetIterator_getKey(&gsi));
-
-#define SEQ_ALL_END \
- } \
- SEQ_collection_free(all_strips); \
- } \
- } \
- ((void)0)
-
typedef struct SeqCollection {
- struct SeqCollection *next, *prev;
struct GSet *set;
} SeqCollection;
@@ -70,6 +54,11 @@ bool SEQ_iterator_ensure(SeqCollection *collection,
struct Sequence **r_seq);
struct Sequence *SEQ_iterator_yield(SeqIterator *iterator);
+/* Callback format for the for_each function below. */
+typedef bool (*SeqForEachFunc)(struct Sequence *seq, void *user_data);
+
+void SEQ_for_each_callback(struct ListBase *seqbase, SeqForEachFunc callback, void *user_data);
+
SeqCollection *SEQ_collection_create(const char *name);
SeqCollection *SEQ_collection_duplicate(SeqCollection *collection);
uint SEQ_collection_len(const SeqCollection *collection);
@@ -90,8 +79,8 @@ SeqCollection *SEQ_query_by_reference(struct Sequence *seq_reference,
struct ListBase *seqbase,
SeqCollection *collection));
SeqCollection *SEQ_query_selected_strips(struct ListBase *seqbase);
-SeqCollection *SEQ_query_all_strips(ListBase *seqbase);
-SeqCollection *SEQ_query_all_strips_recursive(ListBase *seqbase);
+SeqCollection *SEQ_query_all_strips(struct ListBase *seqbase);
+SeqCollection *SEQ_query_all_strips_recursive(struct ListBase *seqbase);
void SEQ_query_strip_effect_chain(struct Sequence *seq_reference,
struct ListBase *seqbase,
SeqCollection *collection);