Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-07 00:30:27 +0300
committerHans Goudey <h.goudey@me.com>2022-04-07 00:30:27 +0300
commit8551e890687de7185388eed9e77171b0df7943a3 (patch)
tree7833056784792f3a46ac8fb6bd9776f3ced33367 /source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
parent8b04308953adae983562026a2aa7bbd38e74174d (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_bezier_segment.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
index 297674e11f4..875664c41fa 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
@@ -64,17 +64,17 @@ static Curves *create_bezier_segment_curve(const float3 start,
{
Curves *curves_id = bke::curves_new_nomain_single(2, CURVE_TYPE_BEZIER);
bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id->geometry);
- curves.resolution().fill(resolution);
+ curves.resolution_for_write().fill(resolution);
- MutableSpan<float3> positions = curves.positions();
- curves.handle_types_left().fill(BEZIER_HANDLE_ALIGN);
- curves.handle_types_right().fill(BEZIER_HANDLE_ALIGN);
+ MutableSpan<float3> positions = curves.positions_for_write();
+ curves.handle_types_left_for_write().fill(BEZIER_HANDLE_ALIGN);
+ curves.handle_types_right_for_write().fill(BEZIER_HANDLE_ALIGN);
positions.first() = start;
positions.last() = end;
- MutableSpan<float3> handles_right = curves.handle_positions_right();
- MutableSpan<float3> handles_left = curves.handle_positions_left();
+ MutableSpan<float3> handles_right = curves.handle_positions_right_for_write();
+ MutableSpan<float3> handles_left = curves.handle_positions_left_for_write();
if (mode == GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION) {
handles_left.first() = 2.0f * start - start_handle_right;