diff options
author | Hans Goudey <h.goudey@me.com> | 2022-08-30 23:20:44 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-08-30 23:32:10 +0300 |
commit | bcd671e565cd337292562d7b2542410f17ab0ff6 (patch) | |
tree | 9a6c0139deca81bdc0097e018679f23c274cf4a1 /source/blender | |
parent | 3090edfecfcea1ac379bbfc9499cb74551fffece (diff) |
Cleanup: Use C++ attribute API
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/curves/intern/curves_add.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/curves/intern/curves_add.cc b/source/blender/editors/curves/intern/curves_add.cc index 07a2dc0b8eb..f234a58f439 100644 --- a/source/blender/editors/curves/intern/curves_add.cc +++ b/source/blender/editors/curves/intern/curves_add.cc @@ -102,10 +102,9 @@ bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int poi MutableSpan<int> offsets = curves.offsets_for_write(); MutableSpan<float3> positions = curves.positions_for_write(); - - float *radius_data = (float *)CustomData_add_layer_named( - &curves.point_data, CD_PROP_FLOAT, CD_SET_DEFAULT, nullptr, curves.point_num, "radius"); - MutableSpan<float> radii{radius_data, curves.points_num()}; + bke::MutableAttributeAccessor attributes = curves.attributes_for_write(); + bke::SpanAttributeWriter<float> radius = attributes.lookup_or_add_for_write_only_span<float>( + "radius", ATTR_DOMAIN_POINT); for (const int i : offsets.index_range()) { offsets[i] = points_per_curve * i; @@ -135,6 +134,8 @@ bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int poi } } + radius.finish(); + return curves; } |