[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41874] trunk/blender/source/blender/ editors/space_graph/graph_select.c: Follow-up commit to r.41765

Joshua Leung aligorith at gmail.com
Tue Nov 15 13:02:46 CET 2011


Revision: 41874
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41874
Author:   aligorith
Date:     2011-11-15 12:02:44 +0000 (Tue, 15 Nov 2011)
Log Message:
-----------
Follow-up commit to r.41765

Reviewed behaviour of selection operators, and decided that ultimately, it's
better if select left/right/column didn't change the channel selections at all.
This is because with the highlighting of the active curve nowadays, it's a bit
distracting to suddenly lose track of it after performing these operations, when
you may have been trying to select all of the keyframes on that curve for
further tweaking.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_graph/graph_select.c

Modified: trunk/blender/source/blender/editors/space_graph/graph_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_select.c	2011-11-15 11:56:54 UTC (rev 41873)
+++ trunk/blender/source/blender/editors/space_graph/graph_select.c	2011-11-15 12:02:44 UTC (rev 41874)
@@ -81,8 +81,9 @@
  *		0 = deselect
  *		1 = select
  *		2 = invert
+ *	- do_channels: whether to affect selection status of channels
  */
-static void deselect_graph_keys (bAnimContext *ac, short test, short sel)
+static void deselect_graph_keys (bAnimContext *ac, short test, short sel, short do_channels)
 {
 	ListBase anim_data = {NULL, NULL};
 	bAnimListElem *ale;
@@ -121,19 +122,22 @@
 		/* Keyframes First */
 		ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, sel_cb, NULL);
 		
-		/* only change selection of channel when the visibility of keyframes doesn't depend on this */
-		if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
-			/* deactivate the F-Curve, and deselect if deselecting keyframes.
-			 * otherwise select the F-Curve too since we've selected all the keyframes
-			 */
-			if (sel == SELECT_SUBTRACT) 
-				fcu->flag &= ~FCURVE_SELECTED;
-			else
-				fcu->flag |= FCURVE_SELECTED;
+		/* affect channel selection status? */
+		if (do_channels) {
+			/* only change selection of channel when the visibility of keyframes doesn't depend on this */
+			if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
+				/* deactivate the F-Curve, and deselect if deselecting keyframes.
+				 * otherwise select the F-Curve too since we've selected all the keyframes
+				 */
+				if (sel == SELECT_SUBTRACT) 
+					fcu->flag &= ~FCURVE_SELECTED;
+				else
+					fcu->flag |= FCURVE_SELECTED;
+			}
+			
+			/* always deactivate all F-Curves if we perform batch ops for selection */
+			fcu->flag &= ~FCURVE_ACTIVE;
 		}
-		
-		/* always deactivate all F-Curves if we perform batch ops for selection */
-		fcu->flag &= ~FCURVE_ACTIVE;
 	}
 	
 	/* Cleanup */
@@ -152,9 +156,9 @@
 		
 	/* 'standard' behaviour - check if selected, then apply relevant selection */
 	if (RNA_boolean_get(op->ptr, "invert"))
-		deselect_graph_keys(&ac, 0, SELECT_INVERT);
+		deselect_graph_keys(&ac, 0, SELECT_INVERT, TRUE);
 	else
-		deselect_graph_keys(&ac, 1, SELECT_ADD);
+		deselect_graph_keys(&ac, 1, SELECT_ADD, TRUE);
 	
 	/* set notifier that things have changed */
 	WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
@@ -735,7 +739,7 @@
 		/* - deselect all other keyframes, so that just the newly selected remain
 		 * - channels aren't deselected, since we don't re-select any as a consequence
 		 */
-		deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+		deselect_graph_keys(ac, 0, SELECT_SUBTRACT, FALSE);
 	}
 	
 	/* set callbacks and editing data */
@@ -1106,8 +1110,8 @@
 		/* reset selection mode */
 		select_mode= SELECT_ADD;
 		
-		/* deselect all other keyframes */
-		deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
+		/* deselect all other keyframes (+ F-Curves too) */
+		deselect_graph_keys(ac, 0, SELECT_SUBTRACT, TRUE);
 		
 		/* deselect other channels too, but only only do this if 
 		 * selection of channel when the visibility of keyframes 
@@ -1217,7 +1221,6 @@
 	bAnimListElem *ale;
 	int filter;
 	
-	SpaceIpo *sipo= (SpaceIpo *)ac->sl;
 	KeyframeEditFunc select_cb, ok_cb;
 	KeyframeEditData ked;
 	tNearestVertInfo *nvi;
@@ -1237,20 +1240,15 @@
 	else if (nvi->fpt)
 		selx= nvi->fpt->vec[0];
 	
-	/* if select mode is replace, deselect all keyframes (and channels) first */
+	/* if select mode is replace, deselect all keyframes first */
 	if (select_mode==SELECT_REPLACE) {
 		/* reset selection mode to add to selection */
 		select_mode= SELECT_ADD;
 		
-		/* deselect all other keyframes */
-		deselect_graph_keys(ac, 0, SELECT_SUBTRACT);
-		
-		/* deselect other channels too, but only only do this if 
-		 * selection of channel when the visibility of keyframes 
-		 * doesn't depend on this 
+		/* - deselect all other keyframes, so that just the newly selected remain
+		 * - channels aren't deselected, since we don't re-select any as a consequence
 		 */
-		if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0)
-			ANIM_deselect_anim_channels(ac, ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+		deselect_graph_keys(ac, 0, SELECT_SUBTRACT, FALSE);
 	}
 	
 	/* initialise keyframe editing data */



More information about the Bf-blender-cvs mailing list