== Sequencer ==
authorPeter Schlaile <peter@schlaile.de>
Tue, 25 Dec 2007 20:31:07 +0000 (20:31 +0000)
committerPeter Schlaile <peter@schlaile.de>
Tue, 25 Dec 2007 20:31:07 +0000 (20:31 +0000)
* Make Lock flag work for metastrips
* Fixes: flags are cleared on exit of metastrips
* Fixes (hopefully): red picture on big endian

source/blender/imbuf/intern/anim.c
source/blender/include/BSE_sequence.h
source/blender/src/editseq.c
source/blender/src/sequence.c

index 8a67c1d035f45f3093337e32cf524a29a042de79..e72d535815e2f859d35f7571bc39fba214759e46 100644 (file)
@@ -721,6 +721,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
                                        dst[0] + (anim->y - 1)*dstStride[0],
                                        0, 0, 0 };
                                int i;
+                               unsigned char* r;
 
                                sws_scale(anim->img_convert_ctx,
                                          anim->pFrame->data,
@@ -731,8 +732,12 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
                                          dstStride2);
                                
                                /* workaround: sws_scale sets alpha = 0... */
+                               
+                               r = (unsigned char*) ibuf->rect;
+
                                for (i = 0; i < ibuf->x * ibuf->y; i++) {
-                                       ibuf->rect[i] |= 0xff000000;
+                                       r[3] = 0xff;
+                                       r+=4;
                                }
 
                                av_free_packet(&packet);
index fdf584b38f40daa64ef57296b3d8a01d0e498221..7bdf16e8e90f22161c563a8976bbabeba6a70af3 100644 (file)
@@ -50,6 +50,13 @@ void free_strip(struct Strip *strip);
 void new_tstripdata(struct Sequence *seq);
 void free_sequence(struct Sequence *seq);
 void build_seqar(struct ListBase *seqbase, struct Sequence  ***seqar, int *totseq);
+
+#define BUILD_SEQAR_COUNT_NOTHING  0
+#define BUILD_SEQAR_COUNT_CURRENT  1
+#define BUILD_SEQAR_COUNT_CHILDREN 2
+
+void build_seqar_cb(struct ListBase *seqbase, struct Sequence  ***seqar, 
+                   int *totseq, int (*test_func)(struct Sequence * seq));
 void free_editing(struct Editing *ed);
 void calc_sequence(struct Sequence *seq);
 void calc_sequence_disp(struct Sequence *seq);
index 8b3b2dd60825e522bcea05f5e610449d54a79d9d..b97dbac32eccf75de3ea94f867530422206cb583 100644 (file)
@@ -2269,8 +2269,8 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
                        seqn = dupli_seq(seq);
                        if (seqn) { /*should never fail */
                                seq->flag &= SEQ_DESEL;
-                               seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
-                               
+                               seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK);
+
                                BLI_addtail(new, seqn);
                                if(seq->type==SEQ_META)
                                        recurs_dupli_seq(&seq->seqbase,&seqn->seqbase);
@@ -2619,7 +2619,7 @@ void make_meta(void)
                }
                seq= seq->next;
        }
-       if(tot < 2) return;
+       if(tot < 1) return;
 
        if(okee("Make Meta Strip")==0) return;
 
@@ -2763,7 +2763,7 @@ void exit_meta(void)
 
        set_last_seq(ms->parseq);
 
-       ms->parseq->flag= SELECT;
+       ms->parseq->flag |= SELECT;
        recurs_sel_seq(ms->parseq);
 
        MEM_freeN(ms);
@@ -2859,6 +2859,21 @@ static void transform_grab_xlimits(Sequence *seq, int leftflag, int rightflag)
        }
 }
 
+static int can_transform_seq_test_func(Sequence * seq)
+{
+       if((seq->flag & SELECT) && !(seq->flag & SEQ_LOCK)) {
+               return BUILD_SEQAR_COUNT_CURRENT | BUILD_SEQAR_COUNT_CHILDREN;
+       }
+       if ((seq->flag & SEQ_LOCK) && !(seq->type & SEQ_EFFECT)) {
+               if (seq->type != SEQ_META) {
+                       return BUILD_SEQAR_COUNT_NOTHING;
+               } else {
+                       return BUILD_SEQAR_COUNT_CURRENT;
+               }
+       }
+       return BUILD_SEQAR_COUNT_CURRENT | BUILD_SEQAR_COUNT_CHILDREN;
+}
+
 void transform_seq(int mode, int context)
 {
        SpaceSeq *sseq= curarea->spacedata.first;
@@ -2903,7 +2918,8 @@ void transform_seq(int mode, int context)
        if(ed==0) return;
 
        /* Build the sequence array once, be sure to free it */
-       build_seqar( ed->seqbasep,  &seqar, &totseq_index );
+       build_seqar_cb( ed->seqbasep,  &seqar, &totseq_index, 
+                       can_transform_seq_test_func );
        
        if (seqar) {
                for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
@@ -2922,7 +2938,7 @@ void transform_seq(int mode, int context)
                if(seqar) MEM_freeN(seqar);
                return;
        }
-       
+
        G.moving= 1;
        
        last_seq = get_last_seq();
@@ -3116,7 +3132,7 @@ void transform_seq(int mode, int context)
                        if (mode=='g' && !snapskip) {
                                /* Grab */
                                for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
-                                       if(seq->flag & SELECT) {
+                                       if(seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
                                                int myofs;
                                                // SEQ_DEBUG_INFO(seq);
                                                
@@ -3168,7 +3184,7 @@ void transform_seq(int mode, int context)
                                
                                /* Extend, Similar to grab but operate on one side of the cursor */
                                for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
-                                       if(seq->flag & SELECT) {
+                                       if(seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
                                                /* only move the contents of the metastrip otherwise the transformation is applied twice */
                                                if (sequence_is_free_transformable(seq) && seq->type != SEQ_META) {
                                                        
@@ -3280,7 +3296,7 @@ void transform_seq(int mode, int context)
 
                        /* test for effect and overlap */
                        for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
-                               if(seq->flag & SELECT) {
+                               if(seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
                                        seq->flag &= ~SEQ_OVERLAP;
                                        if( test_overlap_seq(seq) ) {
                                                seq->flag |= SEQ_OVERLAP;
@@ -3329,7 +3345,7 @@ void transform_seq(int mode, int context)
 
                ts= transmain;
                for(seq_index=0, seq=seqar[0]; seq_index < totseq_index; seq=seqar[++seq_index]) {
-                       if(seq->flag & SELECT) {
+                       if(seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
                                seq->start= ts->start;
                                seq->machine= ts->machine;
                                seq->startstill= ts->startstill;
index 9a94f16712c69c54e21d1cd9247a3dd4d60a3812..5faffb38107c89617050cc8bc6907b85bd3fc18f 100644 (file)
@@ -211,6 +211,66 @@ void build_seqar(ListBase *seqbase, Sequence  ***seqar, int *totseq)
        *seqar= tseqar;
 }
 
+static void do_seq_count_cb(ListBase *seqbase, int *totseq,
+                           int (*test_func)(Sequence * seq))
+{
+       Sequence *seq;
+
+       seq= seqbase->first;
+       while(seq) {
+               int test = test_func(seq);
+               if (test & BUILD_SEQAR_COUNT_CURRENT) {
+                       (*totseq)++;
+               }
+               if(seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
+                       do_seq_count_cb(&seq->seqbase, totseq, test_func);
+               }
+               seq= seq->next;
+       }
+}
+
+static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
+                             int (*test_func)(Sequence * seq))
+{
+       Sequence *seq;
+
+       seq= seqbase->first;
+       while(seq) {
+               int test = test_func(seq);
+               seq->depth= depth;
+
+               if(seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
+                       do_build_seqar_cb(&seq->seqbase, seqar, depth+1, 
+                                         test_func);
+               }
+               if (test & BUILD_SEQAR_COUNT_CURRENT) {
+                       **seqar= seq;
+                       (*seqar)++;
+               }
+               seq= seq->next;
+       }
+}
+
+void build_seqar_cb(ListBase *seqbase, Sequence  ***seqar, int *totseq,
+                   int (*test_func)(Sequence * seq))
+{
+       Sequence **tseqar;
+
+       *totseq= 0;
+       do_seq_count_cb(seqbase, totseq, test_func);
+
+       if(*totseq==0) {
+               *seqar= 0;
+               return;
+       }
+       *seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar");
+       tseqar= *seqar;
+
+       do_build_seqar_cb(seqbase, seqar, 0, test_func);
+       *seqar= tseqar;
+}
+
+
 void free_editing(Editing *ed)
 {
        MetaStack *ms;