[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13697] trunk/blender/source/blender: == Action Editor - Keyframe Selection (Added tools) ==

Joshua Leung aligorith at gmail.com
Fri Feb 15 07:06:08 CET 2008


Revision: 13697
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13697
Author:   aligorith
Date:     2008-02-15 07:06:08 +0100 (Fri, 15 Feb 2008)

Log Message:
-----------
== Action Editor - Keyframe Selection (Added tools) ==

* Ctrl-I now swaps the selection status of keyframes/channels depending on where the mouse cursor is located. Ctrl-Shift-I does so for markers.

* (De)selecting channels now clears the 'active' flags too, so there will be no more 'selected' items lingering around even after pressing AKEY

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	2008-02-15 05:20:28 UTC (rev 13696)
+++ trunk/blender/source/blender/include/BIF_editaction.h	2008-02-15 06:06:08 UTC (rev 13697)
@@ -161,8 +161,8 @@
 /* Select */
 void borderselect_action(void);
 void deselect_action_keys(short test, short sel);
-void deselect_action_channels(short test);
-void deselect_actionchannels(struct bAction *act, short test);
+void deselect_action_channels(short mode);
+void deselect_actionchannels(struct bAction *act, short mode);
 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);

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c	2008-02-15 05:20:28 UTC (rev 13696)
+++ trunk/blender/source/blender/src/editaction.c	2008-02-15 06:06:08 UTC (rev 13697)
@@ -2427,8 +2427,10 @@
 
 /* ----------------------------------------- */
 
-/* deselects action channels in given action */
-void deselect_actionchannels (bAction *act, short test)
+/* De-selects or inverts the selection of Channels in a given Action 
+ *	mode: 0 = default behaviour (select all), 1 = test if (de)select all, 2 = invert all 
+ */
+void deselect_actionchannels (bAction *act, short mode)
 {
 	ListBase act_data = {NULL, NULL};
 	bActListElem *ale;
@@ -2439,7 +2441,7 @@
 	actdata_filter(&act_data, filter, act, ACTCONT_ACTION);
 	
 	/* See if we should be selecting or deselecting */
-	if (test) {
+	if (mode == 1) {
 		for (ale= act_data.first; ale; ale= ale->next) {
 			if (sel == 0) 
 				break;
@@ -2474,28 +2476,38 @@
 			{
 				bActionGroup *agrp= (bActionGroup *)ale->data;
 				
-				if (sel)
+				if (mode == 2)
+					agrp->flag ^= AGRP_SELECTED;
+				else if (sel)
 					agrp->flag |= AGRP_SELECTED;
 				else
 					agrp->flag &= ~AGRP_SELECTED;
+					
+				agrp->flag &= ~AGRP_ACTIVE;
 			}
 				break;
 			case ACTTYPE_ACHAN:
 			{
 				bActionChannel *achan= (bActionChannel *)ale->data;
 				
-				if (sel)
+				if (mode == 2)
+					achan->flag ^= AGRP_SELECTED;
+				else if (sel)
 					achan->flag |= ACHAN_SELECTED;
 				else
 					achan->flag &= ~ACHAN_SELECTED;
+					
 				select_poseelement_by_name(achan->name, sel);
+				achan->flag &= ~ACHAN_HILIGHTED;
 			}
 				break;
 			case ACTTYPE_CONCHAN:
 			{
 				bConstraintChannel *conchan= (bConstraintChannel *)ale->data;
 				
-				if (sel)
+				if (mode == 2)
+					conchan->flag ^= CONSTRAINT_CHANNEL_SELECT;
+				else if (sel)
 					conchan->flag |= CONSTRAINT_CHANNEL_SELECT;
 				else
 					conchan->flag &= ~CONSTRAINT_CHANNEL_SELECT;
@@ -2505,10 +2517,14 @@
 			{
 				IpoCurve *icu= (IpoCurve *)ale->data;
 				
-				if (sel)
+				if (mode == 2)
+					icu->flag ^= IPO_SELECT;
+				else if (sel)
 					icu->flag |= IPO_SELECT;
 				else
 					icu->flag &= ~IPO_SELECT;
+					
+				icu->flag &= ~IPO_ACTIVE;
 			}
 				break;
 		}
@@ -2519,7 +2535,7 @@
 }
 
 /* deselects channels in the action editor */
-void deselect_action_channels (short test)
+void deselect_action_channels (short mode)
 {
 	void *data;
 	short datatype;
@@ -2530,7 +2546,7 @@
 	
 	/* based on type */
 	if (datatype == ACTCONT_ACTION)
-		deselect_actionchannels(data, test);
+		deselect_actionchannels(data, mode);
 	// should shapekey channels be allowed to do this? 
 }
 
@@ -3980,16 +3996,17 @@
 		
 		switch(event) {
 		case UI_BUT_EVENT:
-			do_actionbuts(val); 	// window itself
+			do_actionbuts(val); 	/* window itself */
 			break;
 		
 		case HOMEKEY:
-			do_action_buttons(B_ACTHOME);	// header
+			do_action_buttons(B_ACTHOME);	/* header */
 			break;
 		
 		case AKEY:
-			if (mval[0]<NAMEWIDTH) {
+			if (mval[0] < NAMEWIDTH) {
 				deselect_action_channels(1);
+				BIF_undo_push("(De)Select Action Channels");
 				allqueue(REDRAWVIEW3D, 0);
 				allqueue(REDRAWACTION, 0);
 				allqueue(REDRAWNLA, 0);
@@ -3998,6 +4015,7 @@
 			else if (mval[0] > ACTWIDTH) {
 				if (G.qual == LR_CTRLKEY) {
 					deselect_markers(1, 0);
+					BIF_undo_push("(De)Select Markers");
 					allqueue(REDRAWTIME, 0);
 					allqueue(REDRAWIPO, 0);
 					allqueue(REDRAWACTION, 0);
@@ -4006,6 +4024,7 @@
 				}
 				else {
 					deselect_action_keys(1, 1);
+					BIF_undo_push("(De)Select Keys");
 					allqueue(REDRAWACTION, 0);
 					allqueue(REDRAWNLA, 0);
 					allqueue(REDRAWIPO, 0);
@@ -4018,7 +4037,7 @@
 				borderselect_markers();
 			}
 			else {
-				if (mval[0]>ACTWIDTH)
+				if (mval[0] >= ACTWIDTH)
 					borderselect_action();
 			}
 			break;
@@ -4093,6 +4112,31 @@
 					sethandles_action_keys(HD_ALIGN);
 			}
 			break;
+			
+		case IKEY: 	
+			if (G.qual & LR_CTRLKEY) {
+				if (mval[0] < ACTWIDTH) {
+					deselect_action_channels(2);
+					BIF_undo_push("Inverse Action Channels");
+					allqueue(REDRAWVIEW3D, 0);
+					allqueue(REDRAWACTION, 0);
+					allqueue(REDRAWNLA, 0);
+					allqueue(REDRAWIPO, 0);
+				}
+				else if (G.qual & LR_SHIFTKEY) {
+					deselect_markers(0, 2);
+					BIF_undo_push("Inverse Markers");
+					allqueue(REDRAWMARKER, 0);
+				}
+				else {
+					deselect_action_keys(0, 2);
+					BIF_undo_push("Inverse Keys");
+					allqueue(REDRAWACTION, 0);
+					allqueue(REDRAWNLA, 0);
+					allqueue(REDRAWIPO, 0);
+				}
+			}
+			break;
 		
 		case KKEY:
 			if (G.qual == LR_ALTKEY)

Modified: trunk/blender/source/blender/src/header_action.c
===================================================================
--- trunk/blender/source/blender/src/header_action.c	2008-02-15 05:20:28 UTC (rev 13696)
+++ trunk/blender/source/blender/src/header_action.c	2008-02-15 06:06:08 UTC (rev 13697)
@@ -111,6 +111,7 @@
 	ACTMENU_SEL_ALL_MARKERS,
 	ACTMENU_SEL_INVERSE_KEYS,
 	ACTMENU_SEL_INVERSE_MARKERS,
+	ACTMENU_SEL_INVERSE_CHANNELS,
 	ACTMENU_SEL_LEFTKEYS,
 	ACTMENU_SEL_RIGHTKEYS
 };
@@ -565,33 +566,47 @@
 
 		case ACTMENU_SEL_ALL_KEYS: /* Select/Deselect All Keys */
 			deselect_action_keys(1, 1);
-			allqueue (REDRAWACTION, 0);
+			BIF_undo_push("(De)Select Keys");
+			allqueue(REDRAWACTION, 0);
 			allqueue(REDRAWNLA, 0);
-			allqueue (REDRAWIPO, 0);
+			allqueue(REDRAWIPO, 0);
 			break;
 
 		case ACTMENU_SEL_ALL_CHAN: /* Select/Deselect All Channels */
 			deselect_action_channels(1);
-			allqueue (REDRAWVIEW3D, 0);
-			allqueue (REDRAWACTION, 0);
+			BIF_undo_push("(De)Select Action Channels");
+			allqueue(REDRAWVIEW3D, 0);
+			allqueue(REDRAWACTION, 0);
 			allqueue(REDRAWNLA, 0);
-			allqueue (REDRAWIPO, 0);
+			allqueue(REDRAWIPO, 0);
 			break;
 			
 		case ACTMENU_SEL_ALL_MARKERS: /* select/deselect all markers */
 			deselect_markers(1, 0);
+			BIF_undo_push("(De)Select Markers");
 			allqueue(REDRAWMARKER, 0);
 			break;
 			
 		case ACTMENU_SEL_INVERSE_KEYS: /* invert selection status of keys */
 			deselect_action_keys(0, 2);
-			allqueue (REDRAWACTION, 0);
+			BIF_undo_push("Inverse Keys");
+			allqueue(REDRAWACTION, 0);
 			allqueue(REDRAWNLA, 0);
-			allqueue (REDRAWIPO, 0);
+			allqueue(REDRAWIPO, 0);
 			break;
 			
+		case ACTMENU_SEL_INVERSE_CHANNELS: /* invert selection status of channels */
+			deselect_action_channels(2);
+			BIF_undo_push("Inverse Action Channels");
+			allqueue(REDRAWVIEW3D, 0);
+			allqueue(REDRAWACTION, 0);
+			allqueue(REDRAWNLA, 0);
+			allqueue(REDRAWIPO, 0);
+			break;
+			
 		case ACTMENU_SEL_INVERSE_MARKERS: /* invert selection of markers */
 			deselect_markers(0, 2);
+			BIF_undo_push("Inverse Action Channels");
 			allqueue(REDRAWMARKER, 0);
 			break;
 			
@@ -635,7 +650,7 @@
 					 menuwidth, 19, NULL, 0.0, 0.0, 0, 
 					 ACTMENU_SEL_ALL_MARKERS, "");
 	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-					 "Select/Deselect All Channels", 0, yco-=20, 
+					 "Select/Deselect All Channels|A", 0, yco-=20, 
 					 menuwidth, 19, NULL, 0.0, 0.0, 0, 
 					 ACTMENU_SEL_ALL_CHAN, "");
 					 
@@ -643,13 +658,17 @@
 			 menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 
 	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-					 "Inverse Keys", 0, yco-=20, 
+					 "Inverse Keys|Ctrl I", 0, yco-=20, 
 					 menuwidth, 19, NULL, 0.0, 0.0, 0, 
 					 ACTMENU_SEL_INVERSE_KEYS, "");
 	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
-					 "Inverse Markers", 0, yco-=20, 
+					 "Inverse Markers|Ctrl Shift I", 0, yco-=20, 
 					 menuwidth, 19, NULL, 0.0, 0.0, 0, 
 					 ACTMENU_SEL_INVERSE_MARKERS, "");
+	uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, 
+					 "Inverse All Channels|Ctrl I", 0, yco-=20, 
+					 menuwidth, 19, NULL, 0.0, 0.0, 0, 
+					 ACTMENU_SEL_INVERSE_CHANNELS, "");
 		
 	uiDefBut(block, SEPR, 0, "", 0, yco-=6, 
 			 menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");





More information about the Bf-blender-cvs mailing list