Fix T89702: Curve to points node assert on single point spline

This function could be refactored slightly if we assumed the input was
always sorted, but a special for a single point input is also fine.
This commit is contained in:
Hans Goudey 2021-07-06 21:09:01 -05:00
parent 0521272ab3
commit cd38daeff4
Notes: blender-bot 2023-02-14 09:48:25 +01:00
Referenced by issue #89702, Geometry Nodes: Assert fails with Curve To Points node when curve has one point
1 changed files with 4 additions and 0 deletions

View File

@ -512,6 +512,10 @@ void Spline::sample_with_index_factors(const GVArray &src,
using T = decltype(dummy);
const GVArray_Typed<T> src_typed = src.typed<T>();
MutableSpan<T> dst_typed = dst.typed<T>();
if (src.size() == 1) {
dst_typed.fill(src_typed[0]);
return;
}
blender::threading::parallel_for(dst_typed.index_range(), 1024, [&](IndexRange range) {
for (const int i : range) {
const LookupResult interp = this->lookup_data_from_index_factor(index_factors[i]);