[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19078] branches/blender2.5/blender/source /blender/editors: Graph Editor: Selecting F-Curve channels + keyframes now sets active F-Curve correctly.

Joshua Leung aligorith at gmail.com
Sun Feb 22 06:35:07 CET 2009


Revision: 19078
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19078
Author:   aligorith
Date:     2009-02-22 06:34:47 +0100 (Sun, 22 Feb 2009)

Log Message:
-----------
Graph Editor: Selecting F-Curve channels + keyframes now sets active F-Curve correctly.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
    branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c	2009-02-22 04:13:29 UTC (rev 19077)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c	2009-02-22 05:34:47 UTC (rev 19078)
@@ -1220,7 +1220,7 @@
 				}
 				
 				/* if group is selected now, make group the 'active' one in the visible list */
-				if ((agrp->flag & AGRP_SELECTED) && (selectmode != SELECT_INVERT))
+				if (agrp->flag & AGRP_SELECTED)
 					ANIM_set_active_channel(ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
 			}
 		}
@@ -1240,17 +1240,23 @@
 			}
 			else if ((x < (offset+17)) && (ac->spacetype==SPACE_IPO)) {
 				/* toggle visibility */
-				// XXX this is supposed to be button before name, though this sometimes fails
 				fcu->flag ^= FCURVE_VISIBLE;
 			}
 			else {
 				/* select/deselect */
-				fcu->flag ^= FCURVE_SELECTED;
+				if (selectmode == SELECT_INVERT) {
+					/* inverse selection status of this F-Curve only */
+					fcu->flag ^= FCURVE_SELECTED;
+				}
+				else {
+					/* select F-Curve by itself */
+					ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
+					fcu->flag |= FCURVE_SELECTED;
+				}
 				
+				/* if F-Curve is selected now, make F-Curve the 'active' one in the visible list */
 				if (fcu->flag & FCURVE_SELECTED)
-					fcu->flag |= FCURVE_ACTIVE;
-				else
-					fcu->flag &= ~FCURVE_ACTIVE;
+					ANIM_set_active_channel(ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
 			}
 		}
 			break;

Modified: branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c	2009-02-22 04:13:29 UTC (rev 19077)
+++ branches/blender2.5/blender/source/blender/editors/space_graph/graph_select.c	2009-02-22 05:34:47 UTC (rev 19078)
@@ -661,6 +661,7 @@
 	FCurve *fcu;
 	BezTriple *bezt;
 	short handle;
+	int filter;
 	
 	/* find the beztriple that we're selecting, and the handle that was clicked on */
 	handle= findnearest_fcurve_vert(ac, mval, &fcu, &bezt);
@@ -719,16 +720,16 @@
 	}
 	
 	/* select or deselect curve? */
-	if (selectmode == SELECT_INVERT) {
+	if (selectmode == SELECT_INVERT)
 		fcu->flag ^= FCURVE_SELECTED;
+	else if (selectmode == SELECT_ADD)
+		fcu->flag |= FCURVE_SELECTED;
 		
-		if (fcu->flag & FCURVE_SELECTED)
-			fcu->flag |= FCURVE_ACTIVE;
-		else
-			fcu->flag &= ~FCURVE_ACTIVE;
+	/* set active F-Curve (NOTE: sync the filter flags with findnearest_fcurve_vert) */
+	if (fcu->flag & FCURVE_SELECTED) {
+		filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_CURVESONLY);
+		ANIM_set_active_channel(ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
 	}
-	else if (selectmode == SELECT_ADD)
-		fcu->flag |= (FCURVE_ACTIVE|FCURVE_SELECTED);
 }
 
 /* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
@@ -881,7 +882,6 @@
 	else {
 		/* select keyframe under mouse */
 		mouse_graph_keys(&ac, mval, selectmode); // xxx curves only should become an arg
-		// XXX activate transform...
 	}
 	
 	/* set notifier tha things have changed */





More information about the Bf-blender-cvs mailing list