diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-10-09 04:22:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-10-09 04:22:59 +0400 |
commit | 80af4ce69d0e050aef3654977638a6613654a60b (patch) | |
tree | f3f45b99c9238326cd4615bc115abc9404964234 | |
parent | 7d82b7720993fcf0eda749bf52c83dd2ddcd3c20 (diff) |
Sequencer
changed teh way single images operate,
* they dont act like a sequence of 1 image - so you can drag and resize without the trouble of having teh center image.
* they draw without the single frame in them. and no 'gutter?' strip drawing.
* the start frame is always set to be where the handles start.
This is done in the transform and draw areas of the sequencer. added 2 functions,
fix_single_image_seq - moves the seq start without any visible change - so it will load in older blend's
check_single_image_seq - quick way to check for single image.
-rw-r--r-- | source/blender/include/BIF_editseq.h | 1 | ||||
-rw-r--r-- | source/blender/src/drawseq.c | 18 | ||||
-rw-r--r-- | source/blender/src/editseq.c | 35 |
3 files changed, 32 insertions, 22 deletions
diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h index acabc5f3ab9..59781686a07 100644 --- a/source/blender/include/BIF_editseq.h +++ b/source/blender/include/BIF_editseq.h @@ -70,6 +70,7 @@ void select_surround_from_last(); void select_dir_from_last(int lr); void select_neighbor_from_last(int lr); struct Sequence* alloc_sequence(ListBase *lb, int cfra, int machine); /*used from python*/ +int check_single_image_seq(struct Sequence *seq); #define SEQ_DEBUG_INFO(seq) printf("seq into '%s' -- len:%i start:%i startstill:%i endstill:%i startofs:%i endofs:%i\n",\ seq->name, seq->len, seq->start, seq->startstill, seq->endstill, seq->startofs, seq->endofs) diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c index a6d5cc90842..fbbaf54fa29 100644 --- a/source/blender/src/drawseq.c +++ b/source/blender/src/drawseq.c @@ -686,9 +686,12 @@ so wave file sample drawing precission is zoom adjusted static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq) { float x1, x2, y1, y2; - char col[3]; + char col[3], is_single_image; Sequence *last_seq = get_last_seq(); + /* we need to know if this is a single image or not for drawing */ + is_single_image = (char)check_single_image_seq(seq); + /* body */ if(seq->startstill) x1= seq->start; else x1= seq->startdisp; @@ -702,11 +705,18 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq) get_seq_color3ubv(seq, col); /* draw the main strip body */ - draw_shadedstrip(seq, col, x1, y1, x2, y2); + if (is_single_image) /* single image */ + draw_shadedstrip(seq, col, SEQ_GET_FINAL_LEFT(seq), y1, SEQ_GET_FINAL_RIGHT(seq), y2); + else /* normal operation */ + draw_shadedstrip(seq, col, x1, y1, x2, y2); /* draw additional info and controls */ - if (seq->type == SEQ_RAM_SOUND) drawseqwave(seq, x1, y1, x2, y2, sa->winx); - draw_seq_extensions(seq, sseq); + if (seq->type == SEQ_RAM_SOUND) + drawseqwave(seq, x1, y1, x2, y2, sa->winx); + + if (!is_single_image) + draw_seq_extensions(seq, sseq); + draw_seq_handle(seq, sseq, SEQ_LEFTHANDLE); draw_seq_handle(seq, sseq, SEQ_RIGHTHANDLE); diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index f4ece844e52..7a6d0aa2766 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -145,7 +145,7 @@ void clear_last_seq(Sequence *seq) /* 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) +int check_single_image_seq(Sequence *seq) { if (seq->type == SEQ_IMAGE && seq->len == 1 ) return 1; @@ -155,23 +155,22 @@ static int check_single_image_seq(Sequence *seq) static void fix_single_image_seq(Sequence *seq) { + int left, start, offset; 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; + /* make sure the image is always at the start since there is only one, + adjusting its start should be ok */ + left = SEQ_GET_FINAL_LEFT(seq); + start = seq->start; + if (start != left) { + offset = left - start; + SEQ_SET_FINAL_LEFT( seq, SEQ_GET_FINAL_LEFT(seq) - offset ); + SEQ_SET_FINAL_RIGHT( seq, SEQ_GET_FINAL_RIGHT(seq) - offset ); + seq->start += offset; } - - - - } - - static void change_plugin_seq(char *str) /* called from fileselect */ { struct SeqEffectHandle sh; @@ -1584,7 +1583,7 @@ void add_sequence(int type) } else { event= pupmenu("Add Sequence Strip%t" - "|Images%x1" + "|Image Sequence%x1" "|Movie%x102" #ifdef WITH_FFMPEG "|Movie + Audio (HD)%x105" @@ -2556,11 +2555,11 @@ void transform_seq(int mode, int context) if (SEQ_GET_FINAL_LEFT(seq) >= SEQ_GET_FINAL_RIGHT(seq)) { SEQ_SET_FINAL_LEFT(seq, SEQ_GET_FINAL_RIGHT(seq)-1); } - //if (check_single_image_seq(seq)==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->flag & SEQ_RIGHTSEL) { myofs = (ts->endstill - ts->endofs); @@ -2569,11 +2568,11 @@ void transform_seq(int mode, int context) SEQ_SET_FINAL_RIGHT(seq, SEQ_GET_FINAL_LEFT(seq)+1); } - //if (check_single_image_seq(seq)==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); } - //} + } } if (seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) { @@ -2685,7 +2684,7 @@ void transform_seq(int mode, int context) /* 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); + fix_single_image_seq(seq); if(seq->type == SEQ_META) { calc_sequence(seq); |