Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-02 20:05:12 +0300
committerHans Goudey <h.goudey@me.com>2022-09-02 20:05:12 +0300
commit28d8076a2e4e98002a3d455930b13366947e71ee (patch)
treebfd1d4f563c58bf90ac06fc598db4505495c42af
parente02e844f511528a0ff5d57ebbe35d129ae3fae69 (diff)
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.
-rw-r--r--source/blender/blenkernel/intern/curves_geometry.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc
index ef4a4ee1d6b..af9533dc77f 100644
--- a/source/blender/blenkernel/intern/curves_geometry.cc
+++ b/source/blender/blenkernel/intern/curves_geometry.cc
@@ -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]);
+ }
}
});
}