Blender  V3.3
Classes | Macros | Typedefs | Functions
SEQ_iterator.h File Reference
#include "BLI_ghash.h"

Go to the source code of this file.

Classes

struct  SeqCollection
 
struct  SeqIterator
 

Macros

#define _SEQ_ITERATOR_NAME_JOIN(x, y)   x##_##y
 
#define _SEQ_ITERATOR_NAME_EVALUATE(x, y)   _SEQ_ITERATOR_NAME_JOIN(x, y)
 
#define _SEQ_ITERATOR_NAME(prefix)   _SEQ_ITERATOR_NAME_EVALUATE(prefix, __LINE__)
 
#define SEQ_ITERATOR_FOREACH(var, collection)
 
#define SEQ_collection_free_void_p   ((GHashValFreeFP)SEQ_collection_free)
 

Typedefs

typedef struct SeqCollection SeqCollection
 
typedef struct SeqIterator SeqIterator
 
typedef bool(* SeqForEachFunc) (struct Sequence *seq, void *user_data)
 

Functions

bool SEQ_iterator_ensure (SeqCollection *collection, SeqIterator *iterator, struct Sequence **r_seq)
 
struct SequenceSEQ_iterator_yield (SeqIterator *iterator)
 
void SEQ_for_each_callback (struct ListBase *seqbase, SeqForEachFunc callback, void *user_data)
 
SeqCollectionSEQ_collection_create (const char *name)
 
SeqCollectionSEQ_collection_duplicate (SeqCollection *collection)
 
uint SEQ_collection_len (const SeqCollection *collection)
 
bool SEQ_collection_has_strip (const struct Sequence *seq, const SeqCollection *collection)
 
bool SEQ_collection_append_strip (struct Sequence *seq, SeqCollection *collection)
 
bool SEQ_collection_remove_strip (struct Sequence *seq, SeqCollection *collection)
 
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 (const struct Scene *scene, struct ListBase *seqbase, SeqCollection *collection, void seq_query_func(const struct Scene *scene, struct Sequence *seq_reference, struct ListBase *seqbase, SeqCollection *collection))
 
SeqCollectionSEQ_query_by_reference (struct Sequence *seq_reference, const struct Scene *scene, struct ListBase *seqbase, void seq_query_func(const struct Scene *scene, struct Sequence *seq_reference, struct ListBase *seqbase, SeqCollection *collection))
 
SeqCollectionSEQ_query_selected_strips (struct ListBase *seqbase)
 
SeqCollectionSEQ_query_unselected_strips (struct ListBase *seqbase)
 
SeqCollectionSEQ_query_all_strips (ListBase *seqbase)
 
SeqCollectionSEQ_query_all_strips_recursive (ListBase *seqbase)
 
SeqCollectionSEQ_query_rendered_strips (const struct Scene *scene, ListBase *channels, ListBase *seqbase, int timeline_frame, int displayed_channel)
 
void SEQ_query_strip_effect_chain (const struct Scene *scene, struct Sequence *seq_reference, struct ListBase *seqbase, SeqCollection *collection)
 
void SEQ_filter_selected_strips (SeqCollection *collection)
 

Macro Definition Documentation

◆ _SEQ_ITERATOR_NAME

#define _SEQ_ITERATOR_NAME (   prefix)    _SEQ_ITERATOR_NAME_EVALUATE(prefix, __LINE__)

Definition at line 33 of file SEQ_iterator.h.

◆ _SEQ_ITERATOR_NAME_EVALUATE

#define _SEQ_ITERATOR_NAME_EVALUATE (   x,
  y 
)    _SEQ_ITERATOR_NAME_JOIN(x, y)

Definition at line 32 of file SEQ_iterator.h.

◆ _SEQ_ITERATOR_NAME_JOIN

#define _SEQ_ITERATOR_NAME_JOIN (   x,
  y 
)    x##_##y

Definition at line 31 of file SEQ_iterator.h.

◆ SEQ_collection_free_void_p

#define SEQ_collection_free_void_p   ((GHashValFreeFP)SEQ_collection_free)

Quiet compiler warning for free function.

Definition at line 135 of file SEQ_iterator.h.

◆ SEQ_ITERATOR_FOREACH

#define SEQ_ITERATOR_FOREACH (   var,
  collection 
)
Value:
for (SeqIterator _SEQ_ITERATOR_NAME(iter) = {{{NULL}}}; \
SEQ_iterator_ensure(collection, &_SEQ_ITERATOR_NAME(iter), &var) && var != NULL; \
struct Sequence * SEQ_iterator_yield(SeqIterator *iterator)
Definition: iterator.c:52
#define _SEQ_ITERATOR_NAME(prefix)
Definition: SEQ_iterator.h:33

Definition at line 35 of file SEQ_iterator.h.

Typedef Documentation

◆ SeqCollection

typedef struct SeqCollection SeqCollection

◆ SeqForEachFunc

typedef bool(* SeqForEachFunc) (struct Sequence *seq, void *user_data)

Callback format for the for_each function below.

Definition at line 78 of file SEQ_iterator.h.

◆ SeqIterator

typedef struct SeqIterator SeqIterator

Function Documentation

◆ SEQ_collection_append_strip()

bool SEQ_collection_append_strip ( struct Sequence seq,
SeqCollection collection 
)

◆ SEQ_collection_create()

SeqCollection* SEQ_collection_create ( const char *  name)

◆ SEQ_collection_duplicate()

SeqCollection* SEQ_collection_duplicate ( SeqCollection collection)

Duplicate collection

Parameters
collectioncollection to be duplicated
Returns
duplicate of collection

Definition at line 172 of file iterator.c.

References SEQ_collection_append_strip(), SEQ_collection_create(), and SEQ_ITERATOR_FOREACH.

Referenced by query_snap_targets(), and query_time_dependent_strips_strips().

◆ SEQ_collection_exclude()

void SEQ_collection_exclude ( SeqCollection collection,
SeqCollection exclude_elements 
)

Remove strips from collection that are also in exclude_elements. Source collection will be freed.

Parameters
collectioncollection from which strips are removed
exclude_elementscollection of strips to be removed

Definition at line 142 of file iterator.c.

References SEQ_collection_free(), SEQ_collection_remove_strip(), and SEQ_ITERATOR_FOREACH.

Referenced by query_snap_targets().

◆ SEQ_collection_expand()

void SEQ_collection_expand ( const struct Scene scene,
struct ListBase seqbase,
SeqCollection collection,
void   seq_query_funcconst struct Scene *scene, struct Sequence *seq_reference, struct ListBase *seqbase, SeqCollection *collection 
)

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.

Parameters
seqbaseListBase in which strips are queried
collectionSeqCollection to be expanded
seq_query_funcquery function callback

◆ SEQ_collection_free()

void SEQ_collection_free ( SeqCollection collection)

◆ SEQ_collection_has_strip()

bool SEQ_collection_has_strip ( const struct Sequence seq,
const SeqCollection collection 
)

Check if seq is in collection.

◆ SEQ_collection_len()

uint SEQ_collection_len ( const SeqCollection collection)

◆ SEQ_collection_merge()

void SEQ_collection_merge ( SeqCollection collection_dst,
SeqCollection collection_src 
)

Move strips from collection_src to collection_dst. Source collection will be freed.

Parameters
collection_dstdestination collection
collection_srcsource collection

Definition at line 133 of file iterator.c.

References SEQ_collection_append_strip(), SEQ_collection_free(), and SEQ_ITERATOR_FOREACH.

Referenced by SEQ_collection_expand().

◆ SEQ_collection_remove_strip()

bool SEQ_collection_remove_strip ( struct Sequence seq,
SeqCollection collection 
)

Remove strip from collection.

Parameters
seqstrip to be removed
collectioncollection from which strip will be removed
Returns
true if strip exists in set and it was removed from set, otherwise false

Definition at line 128 of file iterator.c.

References BLI_gset_remove(), NULL, and SeqCollection::set.

Referenced by collection_filter_channel_up_to_incl(), collection_filter_rendered_strips(), query_overwrite_targets(), query_scene_strips(), query_time_dependent_strips_strips(), SEQ_collection_exclude(), and SEQ_filter_selected_strips().

◆ SEQ_filter_selected_strips()

void SEQ_filter_selected_strips ( SeqCollection collection)

◆ SEQ_for_each_callback()

void SEQ_for_each_callback ( struct ListBase seqbase,
SeqForEachFunc  callback,
void user_data 
)

◆ SEQ_iterator_ensure()

bool SEQ_iterator_ensure ( SeqCollection collection,
SeqIterator iterator,
Sequence **  r_seq 
)

Utility function for SEQ_ITERATOR_FOREACH macro. Ensure, that iterator is initialized. During initialization return pointer to collection element and step gset iterator. When this function is called after iterator has been initialized, it will do nothing and return true.

Parameters
collectioncollection to iterate
iteratoriterator to be initialized
r_seqpointer to Sequence pointer
Returns
false when iterator can not be initialized, true otherwise

\Iterator API

Definition at line 32 of file iterator.c.

References BLI_gset_len(), BLI_gsetIterator_getKey(), BLI_gsetIterator_init(), BLI_gsetIterator_step(), SeqIterator::collection, SeqIterator::gsi, SeqIterator::iterator_initialized, and SeqCollection::set.

◆ SEQ_iterator_yield()

struct Sequence* SEQ_iterator_yield ( SeqIterator iterator)

Utility function for SEQ_ITERATOR_FOREACH macro. Yield collection element

Parameters
iteratoriterator to be initialized
Returns
collection element or NULL when iteration has ended

Definition at line 52 of file iterator.c.

References BLI_gsetIterator_done(), BLI_gsetIterator_getKey(), BLI_gsetIterator_step(), SeqIterator::gsi, and NULL.

◆ SEQ_query_all_strips()

SeqCollection* SEQ_query_all_strips ( ListBase seqbase)

Query all strips in seqbase. This does not include strips nested in meta strips.

Parameters
seqbaseListBase in which strips are queried
Returns
strip collection

Definition at line 206 of file iterator.c.

References LISTBASE_FOREACH, SEQ_collection_append_strip(), and SEQ_collection_create().

Referenced by all_strips_from_context(), seq_frame_apply_snap(), and seq_time_gap_info_get().

◆ SEQ_query_all_strips_recursive()

SeqCollection* SEQ_query_all_strips_recursive ( ListBase seqbase)

Query all strips in seqbase and nested meta strips.

Parameters
seqbaseListBase in which strips are queried
Returns
strip collection

Definition at line 194 of file iterator.c.

References LISTBASE_FOREACH, query_all_strips_recursive(), SEQ_collection_append_strip(), SEQ_collection_create(), and SEQ_TYPE_META.

Referenced by query_scene_strips(), and SEQ_get_meta_by_seqbase().

◆ SEQ_query_by_reference()

SeqCollection* SEQ_query_by_reference ( struct Sequence seq_reference,
const struct Scene scene,
struct ListBase seqbase,
void   seq_query_funcconst struct Scene *scene, struct Sequence *seq_reference, struct ListBase *seqbase, SeqCollection *collection 
)

Query strips from seqbase. seq_reference is used by query function as filter condition.

Parameters
seq_referencereference strip for query function
seqbaseListBase in which strips are queried
seq_query_funcquery function callback
Returns
strip collection

◆ SEQ_query_rendered_strips()

SeqCollection* SEQ_query_rendered_strips ( const struct Scene scene,
ListBase channels,
ListBase seqbase,
int  timeline_frame,
int  displayed_channel 
)

Query strips that are rendered at timeline_frame when displayed channel is viewed

Parameters
seqbaseListBase in which strips are queried
timeline_frameviewed frame
displayed_channelviewed channel. when set to 0, no channel filter is applied
Returns
strip collection

◆ SEQ_query_selected_strips()

SeqCollection* SEQ_query_selected_strips ( struct ListBase seqbase)

Query all selected strips in seqbase.

Parameters
seqbaseListBase in which strips are queried
Returns
strip collection

Definition at line 215 of file iterator.c.

References LISTBASE_FOREACH, SELECT, SEQ_collection_append_strip(), and SEQ_collection_create().

Referenced by query_time_dependent_strips_strips(), selected_strips_from_context(), and transform_snap_sequencer_data_alloc().

◆ SEQ_query_strip_effect_chain()

void SEQ_query_strip_effect_chain ( const struct Scene scene,
struct Sequence seq_reference,
struct ListBase seqbase,
SeqCollection collection 
)

Query all effect strips that are directly or indirectly connected to seq_reference. This includes all effects of seq_reference, strips used by another inputs and their effects, so that whole chain is fully independent of other strips.

Parameters
seq_referencereference strip
seqbaseListBase in which strips are queried
collectioncollection to be filled

◆ SEQ_query_unselected_strips()

SeqCollection* SEQ_query_unselected_strips ( struct ListBase seqbase)

Query all unselected strips in seqbase.

Parameters
seqbaseListBase in which strips are queried
Returns
strip collection

Definition at line 323 of file iterator.c.

References LISTBASE_FOREACH, SELECT, SEQ_collection_append_strip(), and SEQ_collection_create().

Referenced by query_overwrite_targets().