diff options
author | Hans Goudey <h.goudey@me.com> | 2022-04-07 00:30:27 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-04-07 00:30:27 +0300 |
commit | 8551e890687de7185388eed9e77171b0df7943a3 (patch) | |
tree | 7833056784792f3a46ac8fb6bd9776f3ced33367 /source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc | |
parent | 8b04308953adae983562026a2aa7bbd38e74174d (diff) |
Curves: Name mutable data retrieval functions explicitly
Add "for_write" on function names that retrieve mutable data arrays.
Though this makes function names longer, it's likely worth it because
it allows more easily using the const functions in a non-const context,
and reduces cases of mistakenly retrieving with edit access.
In the long term, this situation might change more if we implement
attributes storage that is accessible directly on `CurvesGeometry`
without duplicating the attribute API on geometry components,
which is currently the rough plan.
Differential Revision: https://developer.blender.org/D14562
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc index aa4b3a785f1..c33ba3e2a4c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_circle.cc @@ -111,9 +111,9 @@ static Curves *create_point_circle_curve( Curves *curves_id = bke::curves_new_nomain_single(resolution, CURVE_TYPE_POLY); bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id->geometry); - curves.cyclic().first() = true; + curves.cyclic_for_write().first() = true; - MutableSpan<float3> positions = curves.positions(); + MutableSpan<float3> positions = curves.positions_for_write(); float3 center; /* Midpoints of `P1->P2` and `P2->P3`. */ @@ -164,9 +164,9 @@ static Curves *create_radius_circle_curve(const int resolution, const float radi { Curves *curves_id = bke::curves_new_nomain_single(resolution, CURVE_TYPE_POLY); bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id->geometry); - curves.cyclic().first() = true; + curves.cyclic_for_write().first() = true; - MutableSpan<float3> positions = curves.positions(); + MutableSpan<float3> positions = curves.positions_for_write(); const float theta_step = (2.0f * M_PI) / float(resolution); for (int i : IndexRange(resolution)) { |