Animation: blend offset slider #106518

Closed
AresDeveaux wants to merge 12 commits from AresDeveaux/blender:blend_offset_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 10 additions and 8 deletions
Showing only changes of commit 6cdaa21557 - Show all commits

View File

@ -504,7 +504,8 @@ void blend_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const floa
const BezTriple *segment_first_key = fcurve_segment_start_get(fcu, segment->start_index + 1);
const float segment_first_key_y = segment_first_key->vec[1][1];
const BezTriple *segment_last_key = fcurve_segment_end_get(fcu, segment->start_index + segment->length - 1);
const BezTriple *segment_last_key = fcurve_segment_end_get(

watch out for typos poritive -> positive

watch out for typos poritive -> positive
fcu, segment->start_index + segment->length - 1);
const float segment_last_key_y = segment_last_key->vec[1][1];
const float key_x_range = right_x - left_x;
@ -518,17 +519,18 @@ void blend_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const floa
/* The calculation needs diferent values for each side of the slider. */
const bool slider_right_side = factor > 0.5;
/* For this tool the calculations are made easier if each side of the slider goes from 0 to porisive 1. */
/* For this tool the calculations are made easier if each side of the slider goes from 0 to
* porisive 1. */
const float ping_pong_factor = fabs(factor * 2 - 1);
float y_delta;
if (slider_right_side) {
y_delta = right_y - segment_last_key_y;
}
else {
y_delta = left_y - segment_first_key_y;
}
y_delta = right_y - segment_last_key_y;
}
else {
y_delta = left_y - segment_first_key_y;
}
for (int i = segment->start_index; i < segment->start_index + segment->length; i++) {
const float key_y_value = fcu->bezt[i].vec[1][1] + y_delta * ping_pong_factor;