From a0c45a2d5416f780451a23830087a6e712d26ef1 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 28 Jun 2021 14:28:52 -0500 Subject: Cleanup: Add function to create a CurveEval from a nurbs list Sometimes the current spline list isn't part of the original curve, like when using the deformed control points, etc. This will be helpful in the curve modifier stack. --- source/blender/blenkernel/intern/curve_eval.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/curve_eval.cc') diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc index 0a6e4458a35..72ee2587c8a 100644 --- a/source/blender/blenkernel/intern/curve_eval.cc +++ b/source/blender/blenkernel/intern/curve_eval.cc @@ -257,9 +257,10 @@ static SplinePtr spline_from_dna_poly(const Nurb &nurb) return spline; } -std::unique_ptr curve_eval_from_dna_curve(const Curve &dna_curve) +std::unique_ptr curve_eval_from_dna_curve(const Curve &dna_curve, + const ListBase &nurbs_list) { - Vector nurbs(*BKE_curve_nurbs_get(&const_cast(dna_curve))); + Vector nurbs(nurbs_list); std::unique_ptr curve = std::make_unique(); curve->resize(nurbs.size()); @@ -295,6 +296,11 @@ std::unique_ptr curve_eval_from_dna_curve(const Curve &dna_curve) return curve; } +std::unique_ptr curve_eval_from_dna_curve(const Curve &dna_curve) +{ + return curve_eval_from_dna_curve(dna_curve, *BKE_curve_nurbs_get_for_read(&dna_curve)); +} + /** * Check the invariants that curve control point attributes should always uphold, necessary * because attributes are stored on splines rather than in a flat array on the curve: -- cgit v1.2.3