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:
@@ -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();
|
||||
|
||||
@@ -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_);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user