[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11670] trunk/blender/source/blender/src/ editaction.c: == Action Editor - Borderselect ==

Joshua Leung aligorith at gmail.com
Sun Aug 19 06:41:22 CEST 2007


Revision: 11670
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11670
Author:   aligorith
Date:     2007-08-19 06:41:22 +0200 (Sun, 19 Aug 2007)

Log Message:
-----------
== Action Editor - Borderselect ==

This commit restores a few useful borderselect tools:
* When borderselect is activated while the mouse cursor is in the horizontal scrollbar, all the keyframes in that occur in the range of frames encompassed by the border get selected.
* When borderselect is activated while the mouse cursor is in the vertical scrollbar, all the keyframes, that occur in the channels that are within the border get selected.

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

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2007-08-19 03:48:56 UTC (rev 11669)
+++ trunk/blender/source/blender/src/editaction.c	2007-08-19 04:41:22 UTC (rev 11670)
@@ -2310,6 +2310,11 @@
 	BLI_freelistN(&elems);
 }
 
+/* some quick defines for borderselect modes */
+#define ACTEDIT_BORDERSEL_ALL 0
+#define ACTEDIT_BORDERSEL_FRA 1
+#define ACTEDIT_BORDERSEL_CHA 2
+
 /* borderselect: for keyframes only */
 void borderselect_action (void)
 {
@@ -2321,15 +2326,24 @@
 	
 	rcti rect;
 	rctf rectf;
-	int val, selectmode;
+	int val, selectmode, mode;
 	int (*select_function)(BezTriple *);
-	short	mval[2];
-	float	ymin, ymax;
+	short mval[2];
+	float ymin, ymax;
 	
 	/* determine what type of data we are operating on */
 	data = get_action_context(&datatype);
 	if (data == NULL) return;
 	
+	/* what should be selected (based on the starting location of cursor) */
+	getmouseco_areawin(mval);
+	if (IN_2D_VERT_SCROLL(mval)) 
+		mode = ACTEDIT_BORDERSEL_CHA;
+	else if (IN_2D_HORIZ_SCROLL(mval))
+		mode = ACTEDIT_BORDERSEL_FRA;
+	else
+		mode = ACTEDIT_BORDERSEL_ALL;
+	
 	/* draw and handle the borderselect stuff (ui) and get the select rect */
 	if ( (val = get_border(&rect, 3)) ) {
 		if (val == LEFTMOUSE) {
@@ -2363,14 +2377,38 @@
 		/* loop over data, doing border select */
 		for (ale= act_data.first; ale; ale= ale->next) {
 			ymin=ymax-(CHANNELHEIGHT+CHANNELSKIP);
-			if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
+			
+			/* what gets selected depends on the mode (based on initial position of cursor) */
+			switch (mode) {
+			case ACTEDIT_BORDERSEL_FRA: /* all in frame(s) */
 				if (ale->key_data) {
 					if (ale->datatype == ALE_IPO)
 						borderselect_ipo_key(ale->key_data, rectf.xmin, rectf.xmax, selectmode);
 					else if (ale->datatype == ALE_ICU)
 						borderselect_icu_key(ale->key_data, rectf.xmin, rectf.xmax, select_function);
 				}
+				break;
+			case ACTEDIT_BORDERSEL_CHA: /* all in channel(s) */
+				if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
+					if (ale->key_data) {
+						if (ale->datatype == ALE_IPO)
+							select_ipo_bezier_keys(ale->key_data, selectmode);
+						else if (ale->datatype == ALE_ICU)
+							select_icu_bezier_keys(ale->key_data, selectmode);
+					}
+				}
+				break;
+			default: /* any keyframe inside region defined by region */
+				if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))) {
+					if (ale->key_data) {
+						if (ale->datatype == ALE_IPO)
+							borderselect_ipo_key(ale->key_data, rectf.xmin, rectf.xmax, selectmode);
+						else if (ale->datatype == ALE_ICU)
+							borderselect_icu_key(ale->key_data, rectf.xmin, rectf.xmax, select_function);
+					}
+				}
 			}
+			
 			ymax=ymin;
 		}
 		
@@ -2392,11 +2430,13 @@
 {
 	void *data;
 	short datatype;
+	
 	bAction	*act= NULL;
 	bActionChannel *achan= NULL;
 	bConstraintChannel *conchan= NULL;
 	IpoCurve *icu= NULL;
 	TimeMarker *marker;
+	
 	void *act_channel;
 	short sel, act_type;
 	float selx;





More information about the Bf-blender-cvs mailing list