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:
authorMattias Fredriksson <Osares>2022-04-07 00:54:22 +0300
committerHans Goudey <h.goudey@me.com>2022-04-07 00:54:22 +0300
commit52af51708f0fb7e7f8d8bae1d72869222aa56770 (patch)
treedaefde418b73c6f45b0efcb17fc23933ae306186
parentc9f485195b5c65957ea3f992e973459f4a318f8b (diff)
Fix: Copy resolution when creating CurveEval from Curves
Set the curve resolution to Bezier and Nurbs curves when converting data using `curves_to_curve_eval`. This was missed in 9ec12c26f16ea3d. Differential Revision: https://developer.blender.org/D14577
-rw-r--r--source/blender/blenkernel/intern/curve_eval.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc
index 7761b7acc49..c41fdabf8f8 100644
--- a/source/blender/blenkernel/intern/curve_eval.cc
+++ b/source/blender/blenkernel/intern/curve_eval.cc
@@ -382,6 +382,8 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
const blender::bke::CurvesGeometry &geometry = blender::bke::CurvesGeometry::wrap(
curves.geometry);
+ VArray<int> resolution = geometry.resolution();
+
VArray_Span<float> nurbs_weights{
src_component.attribute_get_for_read<float>("nurbs_weight", ATTR_DOMAIN_POINT, 0.0f)};
VArray_Span<int> nurbs_orders{
@@ -410,6 +412,7 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
case CURVE_TYPE_BEZIER: {
std::unique_ptr<BezierSpline> bezier_spline = std::make_unique<BezierSpline>();
bezier_spline->resize(point_range.size());
+ bezier_spline->set_resolution(resolution[curve_index]);
bezier_spline->handle_types_left().copy_from(handle_types_left.slice(point_range));
bezier_spline->handle_types_right().copy_from(handle_types_right.slice(point_range));
@@ -419,6 +422,7 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
case CURVE_TYPE_NURBS: {
std::unique_ptr<NURBSpline> nurb_spline = std::make_unique<NURBSpline>();
nurb_spline->resize(point_range.size());
+ nurb_spline->set_resolution(resolution[curve_index]);
nurb_spline->weights().copy_from(nurbs_weights.slice(point_range));
nurb_spline->set_order(nurbs_orders[curve_index]);
nurb_spline->knots_mode = static_cast<KnotsMode>(nurbs_knots_modes[curve_index]);
@@ -445,6 +449,7 @@ std::unique_ptr<CurveEval> curves_to_curve_eval(const Curves &curves)
copy_attributes_between_components(src_component,
dst_component,
{"curve_type",
+ "resolution",
"nurbs_weight",
"nurbs_order",
"knots_mode",