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

This commit is contained in:
2009-10-22 09:15:56 +00:00
parent 5777c624a5
commit ddf965b63a
2 changed files with 12 additions and 3 deletions

View File

@@ -521,9 +521,14 @@ short bezt_calc_average(BeztEditData *bed, BezTriple *bezt)
{
/* 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 @@ static short mirror_bezier_value(BeztEditData *bed, BezTriple *bezt)
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)
{

View File

@@ -1419,10 +1419,14 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *op)
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 */