Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-06-22 19:32:50 +0300
committerHans Goudey <h.goudey@me.com>2021-06-22 19:32:50 +0300
commitf3eecfe386098cf0a18df7ff4d8ffda9a43e9495 (patch)
tree52a9429269c803ae3a4f0bb8a6c235850c12f124 /source/blender/blenkernel/intern/spline_bezier.cc
parent026de343e3528fe2b2f8d8daba7fa2fd4b807337 (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_bezier.cc')
-rw-r--r--source/blender/blenkernel/intern/spline_bezier.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc
index daae03167ef..02d26ac715b 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -29,17 +29,22 @@ using blender::fn::GVArray;
using blender::fn::GVArray_For_ArrayContainer;
using blender::fn::GVArrayPtr;
-SplinePtr BezierSpline::copy() const
+void BezierSpline::copy_settings(Spline &dst) const
{
- return std::make_unique<BezierSpline>(*this);
+ BezierSpline &bezier = static_cast<BezierSpline &>(dst);
+ bezier.resolution_ = resolution_;
}
-SplinePtr BezierSpline::copy_settings() const
+void BezierSpline::copy_data(Spline &dst) const
{
- std::unique_ptr<BezierSpline> copy = std::make_unique<BezierSpline>();
- copy_base_settings(*this, *copy);
- copy->resolution_ = resolution_;
- return copy;
+ BezierSpline &bezier = static_cast<BezierSpline &>(dst);
+ bezier.positions_ = positions_;
+ bezier.handle_types_left_ = handle_types_left_;
+ bezier.handle_positions_left_ = handle_positions_left_;
+ bezier.handle_types_right_ = handle_types_right_;
+ bezier.handle_positions_right_ = handle_positions_right_;
+ bezier.radii_ = radii_;
+ bezier.tilts_ = tilts_;
}
int BezierSpline::size() const