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.
This commit is contained in:
parent
35f4d254fd
commit
b43077ba3a
Notes:
blender-bot
2023-06-12 00:52:52 +02:00
Referenced by issue #92632, Linked Scenes disappear from the listing Referenced by issue #92552, Geometry Nodes: Curve Primitive Circle zero radius crash
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue