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

Campbell Barton cbarton at metavr.com
Thu Oct 18 09:06:02 CEST 2007


Revision: 12277
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12277
Author:   campbellbarton
Date:     2007-10-18 09:06:01 +0200 (Thu, 18 Oct 2007)

Log Message:
-----------
Sequencer 
- snap to strips before and after the active strip,
- Made max handle draw size 40px, instead of 28 (somtimes its hard to 
select handles)

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

Modified: trunk/blender/source/blender/src/drawseq.c
===================================================================
--- trunk/blender/source/blender/src/drawseq.c	2007-10-17 23:24:09 UTC (rev 12276)
+++ trunk/blender/source/blender/src/drawseq.c	2007-10-18 07:06:01 UTC (rev 12277)
@@ -393,7 +393,7 @@
 	/* clamp handles to defined size in pixel space */
 	handsize = seq->handsize;
 	minhandle = 7;
-	maxhandle = 28;
+	maxhandle = 40;
 	CLAMP(handsize, minhandle*pixelx, maxhandle*pixelx);
 	
 	/* set up co-ordinates/dimensions for either left or right handle */

Modified: trunk/blender/source/blender/src/editseq.c
===================================================================
--- trunk/blender/source/blender/src/editseq.c	2007-10-17 23:24:09 UTC (rev 12276)
+++ trunk/blender/source/blender/src/editseq.c	2007-10-18 07:06:01 UTC (rev 12277)
@@ -2684,7 +2684,10 @@
 	char snapskip = 0, snap, snap_old;
 	int snapdist_max = seq_get_snaplimit();
 	/* at the moment there are only 4 possible snap points,
-	last_seq start,end and selected bounds start/end */
+	-	last_seq (start,end)
+	-	selected bounds (start/end)
+	-	last_seq (next/prev)
+	-	current frame */
 	int snap_points[4], snap_point_num = 0;
 	int j; /* loop on snap_points */
 	
@@ -2731,7 +2734,7 @@
 		}
 	}
 	END_SEQ
-			
+	
 	getmouseco_areawin(mval);
 	
 	/* choose the side based on which side of the playhead the mouse is on */
@@ -2822,6 +2825,7 @@
 						snap_points[snap_point_num++] = seq_tx_get_final_left(last_seq);
 					if(seq_tx_check_right(last_seq))
 						snap_points[snap_point_num++] = seq_tx_get_final_right(last_seq);
+					
 				}
 				if (tot > 1) { /* selection bounds */
 					int bounds_left = MAXFRAME*2;
@@ -2844,6 +2848,20 @@
 						snap_points[snap_point_num++] = bounds_right;
 				}
 				
+				
+				/* Define so we can snap to other points without hassle */
+				
+#define TESTSNAP(test_frame)\
+				for(j=0; j<snap_point_num; j++) {\
+					/* see if this beats the current best snap point */\
+					dist = abs(snap_points[j] - test_frame);\
+					if (dist < snap_dist) {\
+						snap_ofs = test_frame - snap_points[j];\
+						snap_dist = dist;\
+					}\
+				}
+				
+				
 				/* Detect the best marker to snap to! */
 				for(a=0, marker= G.scene->markers.first; marker; a++, marker= marker->next) {
 					
@@ -2855,18 +2873,30 @@
 					if ((sseq->flag & SEQ_MARKER_TRANS)==0 || (marker->flag & SELECT)==0) {
 						
 						/* loop over the sticky points - max 4 */
-						for(j=0; j<snap_point_num; j++) {
-							/* see if this beats the current best snap point */
-							dist = abs(snap_points[j] - marker->frame);
-							if (dist < snap_dist) {
-								snap_ofs = marker->frame - snap_points[j];
-								snap_dist = dist;
-							}
-						}
+						TESTSNAP(marker->frame);
 						if (snap_dist == 0) break; /* alredy snapped? - stop looking */
 					}
 				}
 				
+				if (snap_dist) {
+					TESTSNAP(cfra);
+				}
+				
+				/* check seq's next to the active also - nice for quick snapping */
+				if (snap_dist) {
+					seq = find_neighboring_sequence(last_seq, 1); /* left */
+					if(seq && !seq_tx_check_right(seq))
+						TESTSNAP(seq_tx_get_final_right(seq));
+				}
+				
+				if (snap_dist) {
+					seq = find_neighboring_sequence(last_seq, 2); /* right */
+					if(seq && !seq_tx_check_left(seq))
+						TESTSNAP(seq_tx_get_final_left(seq));
+				}
+
+#undef TESTSNAP
+				
 				if (abs(ix_old-ix) >= snapdist_max) {
 					/* mouse has moved out of snap range */
 					snapskip = 0;





More information about the Bf-blender-cvs mailing list