Fix: Curves sculpt adding resets attribute values

Error in 9088a1f476.
This commit is contained in:
Hans Goudey 2022-10-13 18:21:39 -05:00
parent e8eed82bd5
commit 1fbd300adb
Notes: blender-bot 2023-02-14 07:39:46 +01:00
Referenced by issue #101805, Blender (Linux) does not use its icon anymore in GNOME 43, since Wayland went public
1 changed files with 4 additions and 3 deletions

View File

@ -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;