[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12239] trunk/blender/source/blender: Sequencer

Campbell Barton cbarton at metavr.com
Tue Oct 9 02:22:59 CEST 2007


Revision: 12239
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12239
Author:   campbellbarton
Date:     2007-10-09 02:22:59 +0200 (Tue, 09 Oct 2007)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editseq.h
    trunk/blender/source/blender/src/drawseq.c
    trunk/blender/source/blender/src/editseq.c

Modified: trunk/blender/source/blender/include/BIF_editseq.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editseq.h	2007-10-08 23:38:50 UTC (rev 12238)
+++ trunk/blender/source/blender/include/BIF_editseq.h	2007-10-09 00:22:59 UTC (rev 12239)
@@ -70,6 +70,7 @@
 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)

Modified: trunk/blender/source/blender/src/drawseq.c
===================================================================
--- trunk/blender/source/blender/src/drawseq.c	2007-10-08 23:38:50 UTC (rev 12238)
+++ trunk/blender/source/blender/src/drawseq.c	2007-10-09 00:22:59 UTC (rev 12239)
@@ -686,9 +686,12 @@
 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 @@
 	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);
 	

Modified: trunk/blender/source/blender/src/editseq.c
===================================================================
--- trunk/blender/source/blender/src/editseq.c	2007-10-08 23:38:50 UTC (rev 12238)
+++ trunk/blender/source/blender/src/editseq.c	2007-10-09 00:22:59 UTC (rev 12239)
@@ -145,7 +145,7 @@
 
 /* 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 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 @@
 	}
 	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 @@
 							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 @@
 								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 @@
 			/* 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);





More information about the Bf-blender-cvs mailing list