[Bf-blender-cvs] [cd38daeff41] master: Fix T89702: Curve to points node assert on single point spline
Hans Goudey
noreply at git.blender.org
Wed Jul 7 04:09:10 CEST 2021
Commit: cd38daeff411941e2de3bcd7dd1ddcd2b8a10645
Author: Hans Goudey
Date: Tue Jul 6 21:09:01 2021 -0500
Branches: master
https://developer.blender.org/rBcd38daeff411941e2de3bcd7dd1ddcd2b8a10645
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.
===================================================================
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 aa0d95d4d61..6234cdf87e2 100644
--- a/source/blender/blenkernel/intern/spline_base.cc
+++ b/source/blender/blenkernel/intern/spline_base.cc
@@ -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]);
More information about the Bf-blender-cvs
mailing list