[Bf-blender-cvs] [28d8076a2e4] blender-v3.3-release: Fix T100768: Reverse curves skips handles of middle Bezier points

Hans Goudey noreply at git.blender.org
Fri Sep 2 20:09:37 CEST 2022


Commit: 28d8076a2e4e98002a3d455930b13366947e71ee
Author: Hans Goudey
Date:   Fri Sep 2 12:05:12 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rB28d8076a2e4e98002a3d455930b13366947e71ee

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.

===================================================================

M	source/blender/blenkernel/intern/curves_geometry.cc

===================================================================

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]);
+      }
     }
   });
 }



More information about the Bf-blender-cvs mailing list