diff --git a/source/blender/blenkernel/intern/geometry_component_curve.cc b/source/blender/blenkernel/intern/geometry_component_curve.cc index de8dc355557..bc85305fea8 100644 --- a/source/blender/blenkernel/intern/geometry_component_curve.cc +++ b/source/blender/blenkernel/intern/geometry_component_curve.cc @@ -240,14 +240,18 @@ static GVArrayPtr adapt_curve_domain_point_to_spline(const CurveEval &curve, GVA * unless it is necessary (in that case the materialize functions will be called). */ template class VArray_For_SplineToPoint final : public VArray { + GVArrayPtr original_varray_; /* Store existing data materialized if it was not already a span. This is expected * to be worth it because a single spline's value will likely be accessed many times. */ - VArray_Span original_data_; + fn::GVArray_Span original_data_; Array offsets_; public: - VArray_For_SplineToPoint(const VArray &original_varray, Array offsets) - : VArray(offsets.last()), original_data_(original_varray), offsets_(std::move(offsets)) + VArray_For_SplineToPoint(GVArrayPtr original_varray, Array offsets) + : VArray(offsets.last()), + original_varray_(std::move(original_varray)), + original_data_(*original_varray_), + offsets_(std::move(offsets)) { } @@ -309,7 +313,7 @@ static GVArrayPtr adapt_curve_domain_spline_to_point(const CurveEval &curve, GVA Array offsets = curve.control_point_offsets(); new_varray = std::make_unique>>( - offsets.last(), *varray->typed(), std::move(offsets)); + offsets.last(), std::move(varray), std::move(offsets)); }); return new_varray; }