diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index c5d8358272d..b7b981ecbb0 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -28,6 +28,7 @@ #include "DNA_sequence_types.h" #include "DNA_vfont_types.h" +#include "BLI_iterator.h" #include "BLI_math.h" #include "BLT_translation.h" @@ -203,46 +204,36 @@ static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *i { Scene *scene = (Scene *)ptr->owner_id; Editing *ed = SEQ_editing_get(scene, false); + SeqCollection *all_strips = SEQ_query_all_strips_recursive(&ed->seqbase); - meta_tmp_ref(NULL, ed->seqbase.first); + BLI_Iterator *bli_iter = MEM_callocN(sizeof(BLI_Iterator), __func__); + bli_iter->data = MEM_callocN(sizeof(SeqIterator), __func__); + iter->internal.custom = bli_iter; - rna_iterator_listbase_begin(iter, &ed->seqbase, NULL); + SEQ_iterator_ensure(all_strips, bli_iter->data, (Sequence **)&bli_iter->current); + iter->valid = bli_iter->current != NULL; } -static void rna_SequenceEditor_update_cache(Main *UNUSED(bmain), - Scene *scene, - PointerRNA *UNUSED(ptr)) +static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter) { - Editing *ed = scene->ed; - - SEQ_relations_free_imbuf(scene, &ed->seqbase, false); - SEQ_cache_cleanup(scene); + BLI_Iterator *bli_iter = iter->internal.custom; + bli_iter->current = SEQ_iterator_yield(bli_iter->data); + iter->valid = bli_iter->current != NULL; } -static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter) +static PointerRNA rna_SequenceEditor_sequences_all_get(CollectionPropertyIterator *iter) { - ListBaseIterator *internal = &iter->internal.listbase; - Sequence *seq = (Sequence *)internal->link; - - if (seq->seqbase.first) { - internal->link = (Link *)seq->seqbase.first; - } - else if (seq->next) { - internal->link = (Link *)seq->next; - } - else { - internal->link = NULL; - - do { - seq = seq->tmp; /* XXX: seq's don't reference their parents! */ - if (seq && seq->next) { - internal->link = (Link *)seq->next; - break; - } - } while (seq); - } + Sequence *seq = ((BLI_Iterator *)iter->internal.custom)->current; + return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, seq); +} - iter->valid = (internal->link != NULL); +static void rna_SequenceEditor_sequences_all_end(CollectionPropertyIterator *iter) +{ + BLI_Iterator *bli_iter = iter->internal.custom; + SeqIterator *seq_iter = bli_iter->data; + SEQ_collection_free(seq_iter->collection); + MEM_freeN(seq_iter); + MEM_freeN(bli_iter); } static int rna_SequenceEditor_sequences_all_lookup_string(PointerRNA *ptr, @@ -260,6 +251,16 @@ static int rna_SequenceEditor_sequences_all_lookup_string(PointerRNA *ptr, return false; } +static void rna_SequenceEditor_update_cache(Main *UNUSED(bmain), + Scene *scene, + PointerRNA *UNUSED(ptr)) +{ + Editing *ed = scene->ed; + + SEQ_relations_free_imbuf(scene, &ed->seqbase, false); + SEQ_cache_cleanup(scene); +} + /* internal use */ static int rna_SequenceEditor_elements_length(PointerRNA *ptr) { @@ -2009,8 +2010,8 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin", "rna_SequenceEditor_sequences_all_next", - NULL, - NULL, + "rna_SequenceEditor_sequences_all_end", + "rna_SequenceEditor_sequences_all_get", NULL, NULL, "rna_SequenceEditor_sequences_all_lookup_string", |