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.
This commit is contained in:
2021-05-19 17:17:16 -04:00
parent 0b7744f4da
commit d1c9a99c07
2 changed files with 8 additions and 0 deletions

View File

@@ -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();

View File

@@ -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_);