Fix T103632: Single point trim samples curve end point incorrectly
Trim erronously samples the next to last control point when it should sample the last control point on the curve. This only happens when reducing the curve to a single point. These changes should correct the behavior. Differential Revision: https://developer.blender.org/D17003
This commit is contained in:
parent
a219507d57
commit
c55767b32e
Notes:
blender-bot
2023-02-14 00:09:06 +01:00
Referenced by issue #103632, Regression: Trim Curve at 100% Causing Jumping of vertices away from the original position
|
@ -885,10 +885,15 @@ static void compute_curve_trim_parameters(const bke::CurvesGeometry &curves,
|
|||
if (end_length <= start_length) {
|
||||
/* Single point. */
|
||||
dst_curve_size[curve_i] = 1;
|
||||
src_ranges[curve_i] = bke::curves::IndexRangeCyclic::get_range_from_size(
|
||||
start_points[curve_i].index,
|
||||
start_points[curve_i].is_controlpoint(), /* Only iterate if control point. */
|
||||
point_count);
|
||||
if (start_points[curve_i].is_controlpoint()) {
|
||||
/* Only iterate if control point. */
|
||||
const int single_point_index = start_points[curve_i].parameter == 1.0f ?
|
||||
start_points[curve_i].next_index :
|
||||
start_points[curve_i].index;
|
||||
src_ranges[curve_i] = bke::curves::IndexRangeCyclic::get_range_from_size(
|
||||
single_point_index, 1, point_count);
|
||||
}
|
||||
/* else: leave empty range */
|
||||
}
|
||||
else {
|
||||
/* Split. */
|
||||
|
|
Loading…
Reference in New Issue