[Bf-blender-cvs] [9eafdb985d4] master: Fix: Incorrect logic in spline lookup function

Angus Stanton noreply at git.blender.org
Sun Jul 18 18:01:22 CEST 2021


Commit: 9eafdb985d4b45a441164ff86a212a4cc6b29a09
Author: Angus Stanton
Date:   Sun Jul 18 11:59:23 2021 -0400
Branches: master
https://developer.blender.org/rB9eafdb985d4b45a441164ff86a212a4cc6b29a09

Fix: Incorrect logic in spline lookup function

This section of code deals with evaluated points,
so that is the size it should use.

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

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

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

diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc
index 6234cdf87e2..a7caae967f6 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -410,7 +410,7 @@ Spline::LookupResult Spline::lookup_evaluated_length(const float length) const
 
   const float *offset = std::lower_bound(lengths.begin(), lengths.end(), length);
   const int index = offset - lengths.begin();
-  const int next_index = (index == this->size() - 1) ? 0 : index + 1;
+  const int next_index = (index == this->evaluated_points_size() - 1) ? 0 : index + 1;
 
   const float previous_length = (index == 0) ? 0.0f : lengths[index - 1];
   const float factor = (length - previous_length) / (lengths[index] - previous_length);



More information about the Bf-blender-cvs mailing list