diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-10-09 03:38:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-10-09 03:38:50 +0400 |
commit | 7d82b7720993fcf0eda749bf52c83dd2ddcd3c20 (patch) | |
tree | 2a53ce23a5730c874d030331d4cb7fcbfcf2e471 /source/blender/src/editseq.c | |
parent | 74f744010b1adbc08a5f548f26066c82189f2655 (diff) |
Sequence editor,
rewrote the part that deals with moving the strips on the X axis - only user visible functionality is that you can move the seq bounds in one step now.
internally added macro's to make dealing with sequence's less touble.
Diffstat (limited to 'source/blender/src/editseq.c')
-rw-r--r-- | source/blender/src/editseq.c | 101 |
1 files changed, 61 insertions, 40 deletions
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index 67fd86e5e9c..f4ece844e52 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -137,12 +137,41 @@ void set_last_seq(Sequence *seq) _last_seq_init = 1; } -void clear_last_seq() +void clear_last_seq(Sequence *seq) { _last_seq = NULL; _last_seq_init = 0; } +/* used so we can do a quick check for single image seq + since they work a bit differently to normal image seq's (during transform) */ +static int check_single_image_seq(Sequence *seq) +{ + if (seq->type == SEQ_IMAGE && seq->len == 1 ) + return 1; + else + return 0; +} + +static void fix_single_image_seq(Sequence *seq) +{ + if (!check_single_image_seq(seq)) + return; + + /* locks image to the start */ + if (seq->startstill != 0) { + seq->endstill += seq->startstill; + seq->start -= seq->startstill; + seq->startstill = 0; + } + + + + +} + + + static void change_plugin_seq(char *str) /* called from fileselect */ { struct SeqEffectHandle sh; @@ -2515,57 +2544,43 @@ void transform_seq(int mode, int context) ix= floor(dvec[0]+0.5); iy= floor(dvec[1]+0.5); - ts= transmain; WHILE_SEQ(ed->seqbasep) { if(seq->flag & SELECT) { + int myofs; + //SEQ_DEBUG_INFO(seq); if(seq->flag & SEQ_LEFTSEL) { - if(ts->startstill) { - seq->startstill= ts->startstill-ix; - if(seq->startstill<0) seq->startstill= 0; + myofs = (ts->startofs - ts->startstill); + SEQ_SET_FINAL_LEFT(seq, ts->start + (myofs + ix)); + if (SEQ_GET_FINAL_LEFT(seq) >= SEQ_GET_FINAL_RIGHT(seq)) { + SEQ_SET_FINAL_LEFT(seq, SEQ_GET_FINAL_RIGHT(seq)-1); } - else if(ts->startofs) { - seq->startofs= ts->startofs+ix; - if(seq->startofs<0) seq->startofs= 0; - } - else { - if(ix>0) { - seq->startofs= ix; - seq->startstill= 0; - } - else if (seq->type != SEQ_RAM_SOUND && seq->type != SEQ_HD_SOUND) { - seq->startstill= -ix; - seq->startofs= 0; + //if (check_single_image_seq(seq)==0) { + if (SEQ_GET_FINAL_LEFT(seq) >= SEQ_GET_END(seq)) { + SEQ_SET_FINAL_LEFT(seq, SEQ_GET_END(seq)-1); } - } - if(seq->len <= seq->startofs+seq->endofs) { - seq->startofs= seq->len-seq->endofs-1; - } + //} } if(seq->flag & SEQ_RIGHTSEL) { - if(ts->endstill) { - seq->endstill= ts->endstill+ix; - if(seq->endstill<0) seq->endstill= 0; - } - else if(ts->endofs) { - seq->endofs= ts->endofs-ix; - if(seq->endofs<0) seq->endofs= 0; + myofs = (ts->endstill - ts->endofs); + SEQ_SET_FINAL_RIGHT(seq, ts->start + seq->len + (myofs + ix)); + if (SEQ_GET_FINAL_RIGHT(seq) <= SEQ_GET_FINAL_LEFT(seq)) { + SEQ_SET_FINAL_RIGHT(seq, SEQ_GET_FINAL_LEFT(seq)+1); } - else { - if(ix<0) { - seq->endofs= -ix; - seq->endstill= 0; + + //if (check_single_image_seq(seq)==0) { + if (SEQ_GET_FINAL_RIGHT(seq) <= SEQ_GET_START(seq)) { + SEQ_SET_FINAL_RIGHT(seq, SEQ_GET_START(seq)+1); } - else if (seq->type != SEQ_RAM_SOUND && seq->type != SEQ_HD_SOUND) { - seq->endstill= ix; - seq->endofs= 0; - } - } - if(seq->len <= seq->startofs+seq->endofs) { - seq->endofs= seq->len-seq->startofs-1; - } + //} } + + if (seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) { + seq->startstill= 0; + seq->endstill= 0; + } + if( (seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0 ) { if(sequence_is_free_transformable(seq)) seq->start= ts->start+ ix; @@ -2666,6 +2681,12 @@ void transform_seq(int mode, int context) /* images, effects and overlap */ WHILE_SEQ(ed->seqbasep) { + + /* fixes single image strips - makes sure their start is not out of bounds + ideally this would be done during transform since data is rendered at that time + however it ends up being a lot messier! - Campbell */ + //fix_single_image_seq(seq); + if(seq->type == SEQ_META) { calc_sequence(seq); seq->flag &= ~SEQ_OVERLAP; |