Fix T100768: Reverse curves skips handles of middle Bezier points
Reversing Bezier handle types and positions would skip the middle point of curves with an odd number of segments, which is still necessary to swap in order to avoid changing the curve's shape.
This commit is contained in:
parent
e02e844f51
commit
28d8076a2e
Notes:
blender-bot
2023-02-14 00:29:15 +01:00
Referenced by issue #100768, Regression: Reverse curve sometimes change the shape of input curve
|
@ -1345,6 +1345,10 @@ static void reverse_swap_curve_point_data(const CurvesGeometry &curves,
|
|||
std::swap(a[end_index], b[i]);
|
||||
std::swap(b[end_index], a[i]);
|
||||
}
|
||||
if (points.size() % 2) {
|
||||
const int64_t middle_index = points.size() / 2;
|
||||
std::swap(a[middle_index], b[middle_index]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue