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:
Diffstat (limited to 'source/blender/blenkernel/intern/spline_base.cc')
-rw-r--r--source/blender/blenkernel/intern/spline_base.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc
index 447e8a5b0a5..11620a30948 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -286,7 +286,7 @@ Array<float> Spline::sample_uniform_index_factors(const int samples_size) const
}
const float total_length = this->length();
- const float sample_length = total_length / (samples_size - 1);
+ const float sample_length = total_length / (samples_size - (is_cyclic_ ? 0 : 1));
/* Store the length at the previous evaluated point in a variable so it can
* start out at zero (the lengths array doesn't contain 0 for the first point). */
@@ -305,7 +305,10 @@ Array<float> Spline::sample_uniform_index_factors(const int samples_size) const
prev_length = length;
}
- samples.last() = lengths.size();
+ if (!is_cyclic_) {
+ /* In rare cases this can prevent overflow of the stored index. */
+ samples.last() = lengths.size();
+ }
return samples;
}