diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-10-22 13:15:56 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-10-22 13:15:56 +0400 |
commit | ddf965b63acd86912d9d1d12633ccd1822198d48 (patch) | |
tree | a642f722b4c7ef13089de0d6640528147c804559 | |
parent | 5777c624a54c4d834ec755a92079b504f04035e8 (diff) |
Graph Editor: Jump to Keyframes Operator now also sets the cursor value
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 9 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 7373edb6841..7a167cb6c0c 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -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) { diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index a87cc54fad9..442b44bb482 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -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 */ |