diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 989086a947b..a752dd9a70f 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -227,18 +227,6 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo } } -static void move_key(BezTriple *bezt, const float key_y_value) -{ - const float delta = key_y_value - bezt->vec[1][1]; - bezt->vec[1][1] = key_y_value; - /* When handle type is HD_ALIGN handles would get stuck unless we move them along with the key. - */ - if (ELEM(HD_ALIGN, bezt->h1, bezt->h2)) { - bezt->vec[0][1] += delta; - bezt->vec[2][1] += delta; - } -} - /** * Find the first segment of consecutive selected curve points, starting from \a start_index. * Keys that have BEZT_FLAG_IGNORE_TAG set are treated as unselected. @@ -332,7 +320,7 @@ void blend_to_neighbor_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const for (int i = segment->start_index; i < segment->start_index + segment->length; i++) { const float key_y_value = interpf( target_bezt->vec[1][1], fcu->bezt[i].vec[1][1], blend_factor); - move_key(&fcu->bezt[i], key_y_value); + BKE_fcurve_keyframe_move_value_with_handles(&fcu->bezt[i], key_y_value); } } @@ -394,7 +382,7 @@ void blend_to_default_fcurve(PointerRNA *id_ptr, FCurve *fcu, const float factor continue; } const float key_y_value = interpf(default_value, fcu->bezt[i].vec[1][1], factor); - move_key(&fcu->bezt[i], key_y_value); + BKE_fcurve_keyframe_move_value_with_handles(&fcu->bezt[i], key_y_value); } } /* ---------------- */ @@ -444,7 +432,7 @@ void smooth_fcurve_segment(FCurve *fcu, filter_result += samples[sample_index - j] * kernel_value; } const float key_y_value = interpf((float)filter_result, samples[sample_index], factor); - move_key(&fcu->bezt[i], key_y_value); + BKE_fcurve_keyframe_move_value_with_handles(&fcu->bezt[i], key_y_value); } } /* ---------------- */ @@ -484,7 +472,7 @@ void ease_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor } const float key_y_value = left_y + normalized_y * key_y_range; - move_key(&fcu->bezt[i], key_y_value); + BKE_fcurve_keyframe_move_value_with_handles(&fcu->bezt[i], key_y_value); } } @@ -498,7 +486,7 @@ void breakdown_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float f for (int i = segment->start_index; i < segment->start_index + segment->length; i++) { const float key_y_value = interpf(right_bezt->vec[1][1], left_bezt->vec[1][1], factor); - move_key(&fcu->bezt[i], key_y_value); + BKE_fcurve_keyframe_move_value_with_handles(&fcu->bezt[i], key_y_value); } }