have sequence strip rna not depend on the current editing sequencer context (TODO...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 16 Dec 2009 16:35:31 +0000 (16:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 16 Dec 2009 16:35:31 +0000 (16:35 +0000)
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/sequencer.c
source/blender/makesrna/intern/rna_sequencer.c

index 95fe8fb5eb98b8f89baba863f2fb798485c9792f..a50b03861d7691a7d15e8c645535f5fa1428d65c 100644 (file)
@@ -60,17 +60,17 @@ void seq_next(SeqIterator *iter);
 void seq_end(SeqIterator *iter);
 void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int use_pointer);
 
-#define SEQP_BEGIN(ed, seq) \
+#define SEQP_BEGIN(ed, _seq) \
 { \
        SeqIterator iter;\
                for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) { \
-                       seq= iter.seq;
+                       _seq= iter.seq;
                        
-#define SEQ_BEGIN(ed, seq) \
+#define SEQ_BEGIN(ed, _seq) \
        { \
                SeqIterator iter;\
                for(seq_begin(ed, &iter, 0); iter.valid; seq_next(&iter)) { \
-                       seq= iter.seq;
+                       _seq= iter.seq;
 
 #define SEQ_END \
                } \
@@ -181,6 +181,7 @@ int seq_tx_test(struct Sequence * seq);
 int seq_single_check(struct Sequence *seq);
 void seq_single_fix(struct Sequence *seq);
 int seq_test_overlap(struct ListBase * seqbasep, struct Sequence *test);
+struct ListBase *seq_seqbase(struct ListBase *seqbase, struct Sequence *seq);
 void seq_offset_animdata(struct Scene *scene, struct Sequence *seq, int ofs);
 int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test);
 int shuffle_seq_time(ListBase * seqbasep);
index 4d6033e4f4a34ff7c4d36f9a46dc1d7f3b51af6a..a7b9cf7f74c8e3bba14a257fde65d4df17fb8e7e 100644 (file)
@@ -3532,6 +3532,23 @@ void seq_update_muting(Editing *ed)
        }
 }
 
+/* in cases where we done know the sequence's listbase */
+ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
+{
+       Sequence *iseq;
+       ListBase *lb= NULL;
+
+       for(iseq= seqbase->first; iseq; iseq= iseq->next) {
+               if(seq==iseq) {
+                       return seqbase;
+               }
+               else if(iseq->seqbase.first && (lb= seq_seqbase(&iseq->seqbase, seq))) {
+                       return lb;
+               }
+       }
+
+       return NULL;
+}
 
 /* XXX - hackish function needed for transforming strips! TODO - have some better solution */
 void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
index b8cd2c56483721935b52e6bd1cbbe525481fa1e3..c1ca156c9bfb19e3e6aa05ea91865c66f28c561c 100644 (file)
@@ -92,11 +92,11 @@ static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *it
 static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq)
 {
        Editing *ed= seq_give_editing(scene, FALSE);
-
+       ListBase *seqbase= seq_seqbase(&ed->seqbase, seq);
        calc_sequence_disp(seq);
 
-       if( seq_test_overlap(ed->seqbasep, seq) ) {
-               shuffle_seq(ed->seqbasep, seq);
+       if(seq_test_overlap(seqbase, seq)) {
+               shuffle_seq(seqbase, seq);
        }
        sort_seq(scene);
 }
@@ -150,11 +150,12 @@ static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
        Sequence *seq= (Sequence*)ptr->data;
        Scene *scene= (Scene*)ptr->id.data;
        Editing *ed= seq_give_editing(scene, FALSE);
-       
+       ListBase *seqbase= seq_seqbase(&ed->seqbase, seq);
+
        seq->machine= value;
        
-       if( seq_test_overlap(ed->seqbasep, seq) ) {
-               shuffle_seq(ed->seqbasep, seq);
+       if( seq_test_overlap(seqbase, seq) ) {
+               shuffle_seq(seqbase, seq);
        }
        sort_seq(scene);
 }
@@ -234,9 +235,22 @@ static int rna_Sequence_name_length(PointerRNA *ptr)
 static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
 {
        Scene *scene= (Scene*)ptr->id.data;
+       Editing *ed= seq_give_editing(scene, FALSE);
        Sequence *seq= (Sequence*)ptr->data;
+       Sequence *iseq;
        BLI_strncpy(seq->name+2, value, sizeof(seq->name)-2);
+
        seqUniqueName(&scene->ed->seqbase, seq);
+
+       // TODO, unique name for all meta's
+       /*
+       SEQ_BEGIN(ed, iseq) {
+               if(iseq->seqbase.first)
+                       seqUniqueName(&iseq->seqbase, seq);
+
+       }
+       SEQ_END
+       */
 }
 
 static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)