[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12418] trunk/blender/source/blender/src/ editseq.c: sequencer strip selection didnt work well for verry thin strips.

Campbell Barton cbarton at metavr.com
Sun Oct 28 17:00:23 CET 2007


Revision: 12418
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12418
Author:   campbellbarton
Date:     2007-10-28 17:00:23 +0100 (Sun, 28 Oct 2007)

Log Message:
-----------
sequencer strip selection didnt work well for verry thin strips.
Improved the logic that deciedes when to select handles.

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

Modified: trunk/blender/source/blender/src/editseq.c
===================================================================
--- trunk/blender/source/blender/src/editseq.c	2007-10-28 12:43:24 UTC (rev 12417)
+++ trunk/blender/source/blender/src/editseq.c	2007-10-28 16:00:23 UTC (rev 12418)
@@ -398,7 +398,7 @@
 	short mval[2];
 	float pixelx;
 	float handsize;
-	float minhandle, maxhandle;
+	float displen;
 	View2D *v2d = G.v2d;
 	*hand= 0;
 
@@ -413,22 +413,31 @@
 	seq= ed->seqbasep->first;
 	
 	while(seq) {
-		/* clamp handles to defined size in pixel space */
-		handsize = seq->handsize;
-		minhandle = 7;
-		maxhandle = 28;
-		CLAMP(handsize, minhandle*pixelx, maxhandle*pixelx);
-		
 		if(seq->machine == (int)y) {
 			/* check for both normal strips, and strips that have been flipped horizontally */
 			if( ((seq->startdisp < seq->enddisp) && (seq->startdisp<=x && seq->enddisp>=x)) ||
 				((seq->startdisp > seq->enddisp) && (seq->startdisp>=x && seq->enddisp<=x)) )
 			{
 				if(sequence_is_free_transformable(seq)) {
-					if( handsize+seq->startdisp >=x )
-						*hand= 1;
-					else if( -handsize+seq->enddisp <=x )
-						*hand= 2;
+					
+					/* clamp handles to defined size in pixel space */
+					
+					handsize = seq->handsize;
+					displen = (float)abs(seq->startdisp - seq->enddisp);
+					
+					if (displen/pixelx > 10) { /* dont even try to grab the handles of small strips */
+						CLAMP( handsize,
+							7*pixelx,
+							/* Set the max value to handle to 1/3 of the total len when its less then 28.
+							* This is important because otherwise selecting handles happens even when you click in the middle */
+							(int) MIN2(28*3, ((float)displen) /3)*pixelx
+						);
+						
+						if( handsize+seq->startdisp >=x )
+							*hand= 1;
+						else if( -handsize+seq->enddisp <=x )
+							*hand= 2;
+					}
 				}
 				return seq;
 			}





More information about the Bf-blender-cvs mailing list