diff options
author | Hans Goudey <h.goudey@me.com> | 2022-10-14 02:21:39 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-10-14 02:21:39 +0300 |
commit | 1fbd300adb9a1b371abe9b5b7f24fa6de1fbe6f4 (patch) | |
tree | 4f2517f0136056d0f9f2455826feeb9aa3e08bf7 | |
parent | e8eed82bd54b208fb5f1b79e6648d56d562673da (diff) |
Fix: Curves sculpt adding resets attribute values
Error in 9088a1f4764f371f7.
-rw-r--r-- | source/blender/geometry/intern/add_curves_on_mesh.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/geometry/intern/add_curves_on_mesh.cc b/source/blender/geometry/intern/add_curves_on_mesh.cc index 25935691bf4..a03c9b994a9 100644 --- a/source/blender/geometry/intern/add_curves_on_mesh.cc +++ b/source/blender/geometry/intern/add_curves_on_mesh.cc @@ -385,10 +385,11 @@ AddCurvesOnMeshOutputs add_curves_on_mesh(CurvesGeometry &curves, return true; } bke::GSpanAttributeWriter attribute = attributes.lookup_for_write_span(id); - const int new_elements_num = attribute.domain == ATTR_DOMAIN_POINT ? new_points_num : - new_curves_num; + /* The new elements are added at the end of the array. */ + const int old_elements_num = attribute.domain == ATTR_DOMAIN_POINT ? old_points_num : + old_curves_num; const CPPType &type = attribute.span.type(); - GMutableSpan new_data = attribute.span.take_back(new_elements_num); + GMutableSpan new_data = attribute.span.drop_front(old_elements_num); type.fill_assign_n(type.default_value(), new_data.data(), new_data.size()); attribute.finish(); return true; |