[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12790] trunk/blender/source/blender: Little workflow goody for animators.

Roland Hess rolandh at reed-witting.com
Wed Dec 5 01:03:40 CET 2007


Revision: 12790
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12790
Author:   harkyman
Date:     2007-12-05 01:03:39 +0100 (Wed, 05 Dec 2007)

Log Message:
-----------
Little workflow goody for animators. Adds Alt-RMB select to Action Editor. Alt-RMB in the key area selects all keys on that side of the current frame line. Shift-Alt-RMB builds selection. Commands are also in the headers.

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editaction.h
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/header_action.c

Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h	2007-12-04 23:50:51 UTC (rev 12789)
+++ trunk/blender/source/blender/include/BIF_editaction.h	2007-12-05 00:03:39 UTC (rev 12790)
@@ -138,6 +138,7 @@
 void deselect_actionchannels(struct bAction *act, short test);
 int select_channel(struct bAction *act, struct bActionChannel *achan, int selectmode);
 void select_actionchannel_by_name(struct bAction *act, char *name, int select);
+void selectkeys_leftright (short leftright, short select_mode);
 
 /* ShapeKey stuff */
 struct Key *get_action_mesh_key(void);

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2007-12-04 23:50:51 UTC (rev 12789)
+++ trunk/blender/source/blender/src/editaction.c	2007-12-05 00:03:39 UTC (rev 12790)
@@ -1968,6 +1968,59 @@
 	BLI_freelistN(&act_data);
 }
 
+void selectkeys_leftright (short leftright, short select_mode)
+{
+	ListBase act_data = {NULL, NULL};
+	bActListElem *ale;
+	int filter;
+	void *data;
+	short datatype;
+	float min, max;
+	
+	if (select_mode==SELECT_REPLACE) {
+		select_mode=SELECT_ADD;
+		deselect_action_keys(0, 0);
+	}
+	
+	/* determine what type of data we are operating on */
+	data = get_action_context(&datatype);
+	if (data == NULL) return;
+	
+	if (leftright==1) {
+		min = -MAXFRAMEF;
+		max = (float)CFRA+0.1f;
+	} 
+	else {
+		min = (float)CFRA-0.1f;
+		max = MAXFRAMEF;
+	}
+	
+	/* filter data */
+	filter= (ACTFILTER_VISIBLE | ACTFILTER_IPOKEYS);
+	actdata_filter(&act_data, filter, data, datatype);
+		
+	/* select keys to the right */
+	for (ale= act_data.first; ale; ale= ale->next) {
+		if(NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
+			actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
+			borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
+			actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
+		}
+		else {
+			borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
+		}
+	}
+	
+	/* Cleanup */
+	BLI_freelistN(&act_data);
+	
+	allqueue(REDRAWNLA, 0);
+	allqueue(REDRAWACTION, 0);
+	allqueue(REDRAWIPO, 0);
+
+}
+
+
 /* ----------------------------------------- */
 
 /* This function makes a list of the selected keyframes
@@ -2883,6 +2936,12 @@
 				/* Clicking in the main area of the action window
 				 * selects keys and markers
 				 */
+				else if (G.qual & LR_ALTKEY) {
+					areamouseco_to_ipoco(G.v2d, mval, &dx, &dy);
+					
+					/* sends a 1 for left and 0 for right */
+					selectkeys_leftright((dx < (float)CFRA), select_mode);
+				}
 				else
 					mouse_action(select_mode);
 			}

Modified: trunk/blender/source/blender/src/header_action.c
===================================================================
--- trunk/blender/source/blender/src/header_action.c	2007-12-04 23:50:51 UTC (rev 12789)
+++ trunk/blender/source/blender/src/header_action.c	2007-12-05 00:03:39 UTC (rev 12790)
@@ -102,7 +102,9 @@
 	ACTMENU_SEL_ALL_CHAN,
 	ACTMENU_SEL_ALL_MARKERS,
 	ACTMENU_SEL_INVERSE_KEYS,
-	ACTMENU_SEL_INVERSE_MARKERS
+	ACTMENU_SEL_INVERSE_MARKERS,
+	ACTMENU_SEL_LEFTKEYS,
+	ACTMENU_SEL_RIGHTKEYS
 };
 
 enum {
@@ -513,6 +515,14 @@
 			deselect_markers(0, 2);
 			allqueue(REDRAWMARKER, 0);
 			break;
+			
+		case ACTMENU_SEL_LEFTKEYS:
+			selectkeys_leftright(1, SELECT_REPLACE);
+			break;
+			
+		case ACTMENU_SEL_RIGHTKEYS:
+			selectkeys_leftright(0, SELECT_REPLACE);
+			break;
 	}
 }
 
@@ -565,6 +575,19 @@
 	uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
 			 menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 			 
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
+					 "Back In Time|Alt RMB", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 0, 
+					 ACTMENU_SEL_LEFTKEYS, "");
+								 
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
+					 "Ahead In Time|Alt RMB", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 0, 
+					 ACTMENU_SEL_RIGHTKEYS, "");		 
+			 
+	uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
+			 menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+			 
 	uiDefIconTextBlockBut(block, action_selectmenu_columnmenu, 
 						  NULL, ICON_RIGHTARROW_THIN, "Column Select Keys", 0, yco-=20, 120, 20, "");
 	





More information about the Bf-blender-cvs mailing list