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.
2 changed files with 4 additions and 7 deletions
Showing only changes of commit c038ce005f - Show all commits

View File

@ -498,14 +498,9 @@ void blend_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const floa
const BezTriple segment_first_key = fcu->bezt[segment->start_index];

Since ``y_delta * fabs(factor)` doesnt' change over the course of this loop, take it out of the loop:

const float weighted_delta = y_delta * fabs(factor);
Since ``y_delta * fabs(factor)` doesnt' change over the course of this loop, take it out of the loop: ```c const float weighted_delta = y_delta * fabs(factor); ```
const BezTriple segment_last_key = fcu->bezt[segment->start_index + segment->length - 1];
/* For this tool the calculations are made easier if each side of the slider goes from 0 to
* positive 1. */
const float bidirectional_factor = fabs(factor * 2 - 1);
float y_delta;
if (factor > 0.5) {
if (factor > 0) {
y_delta = right_key->vec[1][1] - segment_last_key.vec[1][1];
}
else {
@ -513,7 +508,7 @@ void blend_offset_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const floa
}
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 * bidirectional_factor;
const float key_y_value = fcu->bezt[i].vec[1][1] + y_delta * fabs(factor);
move_key(&fcu->bezt[i], key_y_value);
}
}

View File

@ -1134,6 +1134,8 @@ static int blend_offset_invoke(bContext *C, wmOperator *op, const wmEvent *event
gso->modal_update = blend_offset_modal_update;
gso->factor_prop = RNA_struct_find_property(op->ptr, "factor");
blend_offset_draw_status_header(C, gso);
ED_slider_is_bidirectional_set(gso->slider, true);
ED_slider_factor_set(gso->slider, 0.0f);
return invoke_result;
}