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>2021-10-29 02:23:55 +0300
committerHans Goudey <h.goudey@me.com>2021-10-29 02:23:55 +0300
commitb43077ba3a2991096aa6484fcccd94d68998fb11 (patch)
tree6e7ff0fda08e4da50dc361b4a2d58e077645e17f
parent35f4d254fd85cec475a00dfc019947b60d6c702d (diff)
Fix T92552: Spline evaluation with all points at the origin
In this case, the uniform index sampling loop would fail to assign any data to the samples, so fill the rest with the largest value possible, corresponding to the end of the spline. Animation Nodes has the same fix for this case.
-rw-r--r--source/blender/blenkernel/intern/spline_base.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc
index 663c1951ba3..bbe4e0aab7b 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -486,6 +486,12 @@ Array<float> Spline::sample_uniform_index_factors(const int samples_size) const
prev_length = length;
}
+ /* Zero lengths or float innacuracies can cause invalid values, or simply
+ * skip some, so set the values that weren't completed in the main loop. */
+ for (const int i : IndexRange(i_sample, samples_size - i_sample)) {
+ samples[i] = float(samples_size);
+ }
+
if (!is_cyclic_) {
/* In rare cases this can prevent overflow of the stored index. */
samples.last() = lengths.size();