From 6e812d5901bac112de3168ec530c42681216f6ec Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Tue, 25 Dec 2007 20:31:07 +0000 Subject: == Sequencer == * 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 | 7 +++- source/blender/include/BSE_sequence.h | 7 ++++ source/blender/src/editseq.c | 36 +++++++++++++++------ source/blender/src/sequence.c | 60 +++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 11 deletions(-) diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c index 8a67c1d035f..e72d535815e 100644 --- a/source/blender/imbuf/intern/anim.c +++ b/source/blender/imbuf/intern/anim.c @@ -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); diff --git a/source/blender/include/BSE_sequence.h b/source/blender/include/BSE_sequence.h index fdf584b38f4..7bdf16e8e90 100644 --- a/source/blender/include/BSE_sequence.h +++ b/source/blender/include/BSE_sequence.h @@ -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); diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index 8b3b2dd6082..b97dbac32ec 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -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; diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index 9a94f16712c..5faffb38107 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -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; -- cgit v1.2.3