diff options
author | Hans Goudey <h.goudey@me.com> | 2021-06-02 16:11:35 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-06-02 16:11:35 +0300 |
commit | 21de669141dc8cde86eb8edfb18ab614c2b3109e (patch) | |
tree | bac9ba578be813a9195c21d73ec490a36c9220de /source/blender/blenkernel/intern/spline_nurbs.cc | |
parent | 5b176b66da1f85f19e042f69dc302e8e72e0dc44 (diff) |
Splines: Function to copy spline settings without data
Often you need to copy a spline to do an operation, but don't want
to manually copy over all of the settings. I've already forgotten to
do it once anyway. These functions copy a spline's "settings" into a
new spline, but not the data. I tried to avoid duplicating any copying
so this is easier to extend in the future.
Differential Revision: https://developer.blender.org/D11463
Diffstat (limited to 'source/blender/blenkernel/intern/spline_nurbs.cc')
-rw-r--r-- | source/blender/blenkernel/intern/spline_nurbs.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc index ae691d26cdb..cae206341a0 100644 --- a/source/blender/blenkernel/intern/spline_nurbs.cc +++ b/source/blender/blenkernel/intern/spline_nurbs.cc @@ -32,6 +32,16 @@ SplinePtr NURBSpline::copy() const return std::make_unique<NURBSpline>(*this); } +SplinePtr NURBSpline::copy_settings() 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; +} + int NURBSpline::size() const { const int size = positions_.size(); |