diff options
author | Hans Goudey <h.goudey@me.com> | 2021-06-22 19:32:50 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-06-22 19:32:50 +0300 |
commit | f3eecfe386098cf0a18df7ff4d8ffda9a43e9495 (patch) | |
tree | 52a9429269c803ae3a4f0bb8a6c235850c12f124 /source/blender/blenkernel/intern/spline_poly.cc | |
parent | 026de343e3528fe2b2f8d8daba7fa2fd4b807337 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/spline_poly.cc')
-rw-r--r-- | source/blender/blenkernel/intern/spline_poly.cc | 13 |
1 files changed, 7 insertions, 6 deletions
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<PolySpline>(*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<PolySpline> copy = std::make_unique<PolySpline>(); - copy_base_settings(*this, *copy); - return copy; + PolySpline &poly = static_cast<PolySpline &>(dst); + poly.positions_ = positions_; + poly.radii_ = radii_; + poly.tilts_ = tilts_; } int PolySpline::size() const |