Animation: Match Slope slider #110567
@ -496,36 +496,28 @@ void blend_to_infinity_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const
|
||||
const BezTriple *left_key = fcurve_segment_start_get(fcu, segment->start_index);
|
||||
const BezTriple *right_key = fcurve_segment_end_get(fcu, segment->start_index + segment->length);
|
||||
|
||||
/* The factor goes from 0 to 1, but for this tool it needs to go from 0 to 1 on each side of the
|
||||
* slider. */
|
||||
const float bidirectional_factor = fabs(factor * 2 - 1);
|
||||
|
||||
BezTriple beyond_key;
|
||||
const BezTriple *reference_key;
|
||||
|
||||
/* This delta values are used to get the relationship between the bookend keys and the
|
||||
* reference keys beyong those. */
|
||||
if (factor >= 0.5) {
|
||||
|
||||
if (factor >= 0) {
|
||||
/* Stop the function if there is no key beyond the the right neighboring one. */
|
||||
if (segment->start_index + segment->length > fcu->totvert - 1) {
|
||||
if (segment->start_index + segment->length >= fcu->totvert - 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
reference_key = right_key;
|
||||
beyond_key = fcu->bezt[segment->start_index + segment->length + 1];
|
||||
}
|
||||
else {
|
||||
|
||||
/* Stop the function if there is no key beyond the left neighboring one. */
|
||||
if (segment->start_index == 1) {
|
||||
if (segment->start_index <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
reference_key = left_key;
|
||||
beyond_key = fcu->bezt[segment->start_index - 2];
|
||||
}
|
||||
|
||||
/* This delta values are used to get the relationship between the bookend keys and the
|
||||
* reference keys beyong those. */
|
||||
const float y_delta = beyond_key.vec[1][1] - reference_key->vec[1][1];
|
||||
const float x_delta = beyond_key.vec[1][0] - reference_key->vec[1][0];
|
||||
|
||||
@ -534,13 +526,6 @@ void blend_to_infinity_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const
|
||||
return;
|
||||
}
|
||||
|
||||
if (factor >= 0.5) {
|
||||
reference_key = right_key;
|
||||
}
|
||||
else {
|
||||
reference_key = left_key;
|
||||
}
|
||||
|
||||
for (int i = segment->start_index; i < segment->start_index + segment->length; i++) {
|
||||
|
||||
/* These new deltas are used to determine the relationship between the current key and the
|
||||
@ -550,7 +535,7 @@ void blend_to_infinity_fcurve_segment(FCurve *fcu, FCurveSegment *segment, const
|
||||
|
||||
const float delta = reference_key->vec[1][1] + new_y_delta - fcu->bezt[i].vec[1][1];
|
||||
|
||||
const float key_y_value = fcu->bezt[i].vec[1][1] + delta * bidirectional_factor;
|
||||
const float key_y_value = fcu->bezt[i].vec[1][1] + delta * fabs(factor);
|
||||
move_key(&fcu->bezt[i], key_y_value);
|
||||
}
|
||||
}
|
||||
|
@ -1074,7 +1074,7 @@ static void blend_to_infinity_graph_keys(bAnimContext *ac, const float factor)
|
||||
ListBase segments = find_fcurve_segments(fcu);
|
||||
|
||||
LISTBASE_FOREACH (FCurveSegment *, segment, &segments) {
|
||||
if (factor >= 0.5){
|
||||
if (factor >= 0){
|
||||
if (segment->start_index + segment->length >= fcu->totvert - 1) {
|
||||
WM_report(RPT_WARNING, "You need at least 2 keys to the right side of the selection.");
|
||||
continue;
|
||||
@ -1146,6 +1146,9 @@ static int blend_to_infinity_invoke(bContext *C, wmOperator *op, const wmEvent *
|
||||
gso->modal_update = blend_to_infinity_modal_update;
|
||||
gso->factor_prop = RNA_struct_find_property(op->ptr, "factor");
|
||||
blend_to_infinity_draw_status_header(C, gso);
|
||||
ED_slider_allow_overshoot_set(gso->slider, false);
|
||||
ED_slider_is_bidirectional_set(gso->slider, true);
|
||||
ED_slider_factor_set(gso->slider, 0.0f);
|
||||
|
||||
return invoke_result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user