Animation: shear right slider #106522

Closed
AresDeveaux wants to merge 6 commits from AresDeveaux/blender:shear_right_slider into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 3 additions and 8 deletions
Showing only changes of commit 87f886b195 - Show all commits

View File

@ -494,15 +494,10 @@ void ease_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor
void shear_right_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float factor)
{
const BezTriple *left_key = fcurve_segment_start_get(fcu, segment->start_index);
const float left_x = left_key->vec[1][0];
const float left_y = left_key->vec[1][1];
const BezTriple *right_key = fcurve_segment_end_get(fcu, segment->start_index + segment->length);
const float right_x = right_key->vec[1][0];
const float right_y = right_key->vec[1][1];
const float key_x_range = right_x - left_x;
const float key_y_range = right_y - left_y;
const float key_x_range = right_key->vec[1][0] - left_key->vec[1][0];
const float key_y_range = right_key->vec[1][1] - left_key->vec[1][1];
/* Happens if there is only 1 key on the FCurve. Needs to be skipped because it
* would be a divide by 0. */
@ -515,7 +510,7 @@ void shear_right_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const float
for (int i = segment->start_index; i < segment->start_index + segment->length; i++) {
/* For easy calculation of the curve, the values are normalized. */
const float normalized_x = (right_x - fcu->bezt[i].vec[1][0]) / key_x_range;
const float normalized_x = (right_key->vec[1][0] - fcu->bezt[i].vec[1][0]) / key_x_range;
const float lineal = key_y_range * normalized_x;