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_nurbs.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_nurbs.cc')
-rw-r--r--source/blender/blenkernel/intern/spline_nurbs.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc
index 31ac23589be..85fb9730e83 100644
--- a/source/blender/blenkernel/intern/spline_nurbs.cc
+++ b/source/blender/blenkernel/intern/spline_nurbs.cc
@@ -31,19 +31,23 @@ using blender::fn::GVArray_For_ArrayContainer;
using blender::fn::GVArray_Typed;
using blender::fn::GVArrayPtr;
-SplinePtr NURBSpline::copy() const
+void NURBSpline::copy_settings(Spline &dst) const
{
- return std::make_unique<NURBSpline>(*this);
+ NURBSpline &nurbs = static_cast<NURBSpline &>(dst);
+ nurbs.knots_mode = knots_mode;
+ nurbs.resolution_ = resolution_;
+ nurbs.order_ = order_;
}
-SplinePtr NURBSpline::copy_settings() const
+void NURBSpline::copy_data(Spline &dst) const
{
- std::unique_ptr<NURBSpline> copy = std::make_unique<NURBSpline>();
- copy_base_settings(*this, *copy);
- copy->knots_mode = knots_mode;
- copy->resolution_ = resolution_;
- copy->order_ = order_;
- return copy;
+ NURBSpline &nurbs = static_cast<NURBSpline &>(dst);
+ nurbs.positions_ = positions_;
+ nurbs.weights_ = weights_;
+ nurbs.knots_ = knots_;
+ nurbs.knots_dirty_ = false;
+ nurbs.radii_ = radii_;
+ nurbs.tilts_ = tilts_;
}
int NURBSpline::size() const