From 1931387799919e5a6bb4ebfec8922a6bf6ab3ca5 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 22 Dec 2021 18:38:30 -0600 Subject: Fix: Curve trim node test failure Caused by 60c59d7d611dfd726. The position wasn't copied into the correct place on each spline. Somehow I didn't catch that in the tests I ran. --- source/blender/geometry/intern/mesh_to_curve_convert.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source/blender/geometry') diff --git a/source/blender/geometry/intern/mesh_to_curve_convert.cc b/source/blender/geometry/intern/mesh_to_curve_convert.cc index 398ce609d55..965c09984fa 100644 --- a/source/blender/geometry/intern/mesh_to_curve_convert.cc +++ b/source/blender/geometry/intern/mesh_to_curve_convert.cc @@ -93,13 +93,18 @@ static std::unique_ptr create_curve_from_vert_indices( } } + VArray mesh_positions = mesh_component.attribute_get_for_read( + "position", ATTR_DOMAIN_POINT, float3(0)); + threading::parallel_for(splines.index_range(), 128, [&](IndexRange range) { + for (const int i : range) { + copy_attribute_to_points(mesh_positions, vert_indices[i], splines[i]->positions()); + } + }); + for (const bke::AttributeIDRef &attribute_id : source_attribute_ids) { if (mesh_component.attribute_is_builtin(attribute_id)) { - /* Don't copy attributes that are built-in on meshes but not on curves, - * except for the position attribute. */ - if (!(attribute_id == "position")) { - continue; - } + /* Don't copy attributes that are built-in on meshes but not on curves. */ + continue; } if (!attribute_id.should_be_kept()) { -- cgit v1.2.3