[Bf-blender-cvs] [87e9451d660] master: Fix: Remove special case from curve segment size function

Hans Goudey noreply at git.blender.org
Wed Mar 30 02:56:48 CEST 2022


Commit: 87e9451d660e8288d70aa781530b69f4005bf0ea
Author: Hans Goudey
Date:   Tue Mar 29 19:56:38 2022 -0500
Branches: master
https://developer.blender.org/rB87e9451d660e8288d70aa781530b69f4005bf0ea

Fix: Remove special case from curve segment size function

The idea that curves with two points cannot be cyclic came from some
existing code, but there's not fundamental reason for it, so remove the
check in this function. The case can be handled elsewhere if necessary.

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

M	source/blender/blenkernel/BKE_curves.hh

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

diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh
index 05a20917552..13b3d280bc7 100644
--- a/source/blender/blenkernel/BKE_curves.hh
+++ b/source/blender/blenkernel/BKE_curves.hh
@@ -351,13 +351,12 @@ class CurvesGeometry : public ::CurvesGeometry {
 namespace curves {
 
 /**
- * The number of segments between control points, accounting for the last segment of cyclic curves,
- * and the fact that curves with two points cannot be cyclic. The logic is simple, but this
- * function should be used to make intentions clearer.
+ * The number of segments between control points, accounting for the last segment of cyclic
+ * curves. The logic is simple, but this function should be used to make intentions clearer.
  */
 inline int curve_segment_size(const int points_num, const bool cyclic)
 {
-  return (cyclic && points_num > 2) ? points_num : points_num - 1;
+  return cyclic ? points_num : points_num - 1;
 }
 
 namespace bezier {



More information about the Bf-blender-cvs mailing list