[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24050] trunk/blender/source/blender/ editors: Graph Editor: Jump to Keyframes Operator now also sets the cursor value

Joshua Leung aligorith at gmail.com
Thu Oct 22 11:15:56 CEST 2009


Revision: 24050
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24050
Author:   aligorith
Date:     2009-10-22 11:15:56 +0200 (Thu, 22 Oct 2009)

Log Message:
-----------
Graph Editor: Jump to Keyframes Operator now also sets the cursor value

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/keyframes_edit.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c

Modified: trunk/blender/source/blender/editors/animation/keyframes_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_edit.c	2009-10-22 09:07:19 UTC (rev 24049)
+++ trunk/blender/source/blender/editors/animation/keyframes_edit.c	2009-10-22 09:15:56 UTC (rev 24050)
@@ -521,9 +521,14 @@
 {
 	/* only if selected */
 	if (bezt->f2 & SELECT) {
-		/* store average time in float (only do rounding at last step */
+		/* store average time in float 1 (only do rounding at last step) */
 		bed->f1 += bezt->vec[1][0];
 		
+		/* store average value in float 2 (only do rounding at last step) 
+		 *	- this isn't always needed, but some operators may also require this
+		 */
+		bed->f2 += bezt->vec[1][1];
+		
 		/* increment number of items */
 		bed->i1++;
 	}
@@ -682,7 +687,7 @@
 	return 0;
 }
 
-/* Note: for markers case, need to set global vars (eww...) */
+/* Note: for markers and 'value', the values to use must be supplied as the first float value */
 // calchandles_fcurve
 BeztEditFunc ANIM_editkeyframes_mirror(short type)
 {

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_edit.c	2009-10-22 09:07:19 UTC (rev 24049)
+++ trunk/blender/source/blender/editors/space_graph/graph_edit.c	2009-10-22 09:15:56 UTC (rev 24050)
@@ -1419,10 +1419,14 @@
 	
 	BLI_freelistN(&anim_data);
 	
-	/* set the new current frame value, based on the average time */
+	/* set the new current frame and cursor values, based on the average time and value */
 	if (bed.i1) {
+		SpaceIpo *sipo= ac.sa->spacedata.first;
 		Scene *scene= ac.scene;
+		
+		/* take the average values, rounding to the nearest int for the current frame */
 		CFRA= (int)floor((bed.f1 / bed.i1) + 0.5f);
+		sipo->cursorVal= bed.f2 / (float)bed.i1;
 	}
 	
 	/* set notifier that things have changed */





More information about the Bf-blender-cvs mailing list