diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-03-25 15:35:53 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-03-25 15:35:53 +0300 |
commit | 819bdb36c27af1d5e55a8cb5b6e6762a0c41c8d2 (patch) | |
tree | 4fbb8ae1ab7110d50077ff266125daa71b1a6203 | |
parent | 535bce8cf1fd581ff450069a57612b3ed4ccfec2 (diff) |
Bugfix #21738: Flatten keys doesn't work
Flatten handles option was an ugly mix of snap to nearest integer values and set the handles to have the same values as the key. Removed the nearest integer snapping from this, since it doesn't seem that useful in retrospect. It could be restored later if there's any demand for it.
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 13c236b0cce..ee3018ce150 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -604,6 +604,7 @@ void bezt_remap_times(BeztEditData *bed, BezTriple *bezt) /* ******************************************* */ /* Transform */ +/* snaps the keyframe to the nearest frame */ static short snap_bezier_nearest(BeztEditData *bed, BezTriple *bezt) { if (bezt->f2 & SELECT) @@ -611,6 +612,7 @@ static short snap_bezier_nearest(BeztEditData *bed, BezTriple *bezt) return 0; } +/* snaps the keyframe to the neares second */ static short snap_bezier_nearestsec(BeztEditData *bed, BezTriple *bezt) { const Scene *scene= bed->scene; @@ -621,6 +623,7 @@ static short snap_bezier_nearestsec(BeztEditData *bed, BezTriple *bezt) return 0; } +/* snaps the keyframe to the current frame */ static short snap_bezier_cframe(BeztEditData *bed, BezTriple *bezt) { const Scene *scene= bed->scene; @@ -629,6 +632,7 @@ static short snap_bezier_cframe(BeztEditData *bed, BezTriple *bezt) return 0; } +/* snaps the keyframe time to the nearest marker's frame */ static short snap_bezier_nearmarker(BeztEditData *bed, BezTriple *bezt) { if (bezt->f2 & SELECT) @@ -636,20 +640,21 @@ static short snap_bezier_nearmarker(BeztEditData *bed, BezTriple *bezt) return 0; } +/* make the handles have the same value as the key */ static short snap_bezier_horizontal(BeztEditData *bed, BezTriple *bezt) { if (bezt->f2 & SELECT) { - // XXX currently this snaps both handles to the nearest horizontal value, but perhaps user just wants to level out handles instead? - bezt->vec[0][1]= bezt->vec[2][1]= (float)floor(bezt->vec[1][1] + 0.5f); + bezt->vec[0][1]= bezt->vec[2][1]= bezt->vec[1][1]; + if ((bezt->h1==HD_AUTO) || (bezt->h1==HD_VECT)) bezt->h1= HD_ALIGN; if ((bezt->h2==HD_AUTO) || (bezt->h2==HD_VECT)) bezt->h2= HD_ALIGN; } return 0; } +/* value to snap to is stored in the custom data -> first float value slot */ static short snap_bezier_value(BeztEditData *bed, BezTriple *bezt) { - /* value to snap to is stored in the custom data -> first float value slot */ if (bezt->f2 & SELECT) bezt->vec[1][1]= bed->f1; return 0; |