From f3eecfe386098cf0a18df7ff4d8ffda9a43e9495 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 22 Jun 2021 11:32:50 -0500 Subject: Cleanup: Refactor spline copying functions Make the virtual functions protected and simpler, so that the logic is better contained in the base class's implementation. Also introduce a `copy_without_attributes` method to be used for realizing instances. --- source/blender/blenkernel/intern/spline_poly.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/spline_poly.cc') diff --git a/source/blender/blenkernel/intern/spline_poly.cc b/source/blender/blenkernel/intern/spline_poly.cc index e344b8d4910..dfd24b2566e 100644 --- a/source/blender/blenkernel/intern/spline_poly.cc +++ b/source/blender/blenkernel/intern/spline_poly.cc @@ -25,16 +25,17 @@ using blender::Span; using blender::fn::GVArray; using blender::fn::GVArrayPtr; -SplinePtr PolySpline::copy() const +void PolySpline::copy_settings(Spline &UNUSED(dst)) const { - return std::make_unique(*this); + /* Poly splines have no settings not covered by the base class. */ } -SplinePtr PolySpline::copy_settings() const +void PolySpline::copy_data(Spline &dst) const { - std::unique_ptr copy = std::make_unique(); - copy_base_settings(*this, *copy); - return copy; + PolySpline &poly = static_cast(dst); + poly.positions_ = positions_; + poly.radii_ = radii_; + poly.tilts_ = tilts_; } int PolySpline::size() const -- cgit v1.2.3