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-05-20 00:17:16 +0300
committerHans Goudey <h.goudey@me.com>2021-05-20 00:17:16 +0300
commitd1c9a99c07b1160b01710577ea0109addceac97c (patch)
tree9ac80fb5547f9a0f03fb7ca97052d4ad6702d9a7
parent0b7744f4da666bccf2005ad0d0e77c5ddc73bfd5 (diff)
Splines: Optimize interpolation in special case virtual array
When the input data is a virtual array for a single value, we don't need to run any of the interpolation, instead just copy the input data.
-rw-r--r--source/blender/blenkernel/intern/spline_bezier.cc4
-rw-r--r--source/blender/blenkernel/intern/spline_nurbs.cc4
2 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc
index 0fd3efce033..4be3ba8576e 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -560,6 +560,10 @@ blender::fn::GVArrayPtr BezierSpline::interpolate_to_evaluated_points(
{
BLI_assert(source_data.size() == this->size());
+ if (source_data.is_single()) {
+ return source_data.shallow_copy();
+ }
+
const int eval_size = this->evaluated_points_size();
if (eval_size == 1) {
return source_data.shallow_copy();
diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc
index cd3ebe9e680..ae691d26cdb 100644
--- a/source/blender/blenkernel/intern/spline_nurbs.cc
+++ b/source/blender/blenkernel/intern/spline_nurbs.cc
@@ -389,6 +389,10 @@ blender::fn::GVArrayPtr NURBSpline::interpolate_to_evaluated_points(
{
BLI_assert(source_data.size() == this->size());
+ if (source_data.is_single()) {
+ return source_data.shallow_copy();
+ }
+
this->calculate_basis_cache();
Span<BasisCache> weights(basis_cache_);