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_resample.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_resample.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
index 139b17138fa..fababfd027b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
@@ -301,7 +301,7 @@ static Curves *resample_to_uniform_count(const CurveComponent &src_component,
CD_MASK_ALL,
CD_DUPLICATE,
src_curves.curves_num());
- MutableSpan<int> dst_offsets = dst_curves.offsets();
+ MutableSpan<int> dst_offsets = dst_curves.offsets_for_write();
GeometryComponentFieldContext field_context{src_component, ATTR_DOMAIN_CURVE};
fn::FieldEvaluator evaluator{field_context, src_curves.curves_num()};
@@ -318,12 +318,12 @@ static Curves *resample_to_uniform_count(const CurveComponent &src_component,
dst_curves.resize(dst_offsets.last(), dst_curves.curves_num());
/* All resampled curves are poly curves. */
- dst_curves.curve_types().fill_indices(selection, CURVE_TYPE_POLY);
+ dst_curves.curve_types_for_write().fill_indices(selection, CURVE_TYPE_POLY);
VArray<bool> curves_cyclic = src_curves.cyclic();
VArray<int8_t> curve_types = src_curves.curve_types();
Span<float3> evaluated_positions = src_curves.evaluated_positions();
- MutableSpan<float3> dst_positions = dst_curves.positions();
+ MutableSpan<float3> dst_positions = dst_curves.positions_for_write();
AttributesForInterpolation attributes;
gather_point_attributes_to_interpolate(src_component, dst_component, attributes);
@@ -464,8 +464,8 @@ static Curves *resample_to_evaluated(const CurveComponent &src_component,
CD_DUPLICATE,
src_curves.curves_num());
/* All resampled curves are poly curves. */
- dst_curves.curve_types().fill_indices(selection, CURVE_TYPE_POLY);
- MutableSpan<int> dst_offsets = dst_curves.offsets();
+ dst_curves.curve_types_for_write().fill_indices(selection, CURVE_TYPE_POLY);
+ MutableSpan<int> dst_offsets = dst_curves.offsets_for_write();
src_curves.ensure_evaluated_offsets();
threading::parallel_for(selection.index_range(), 4096, [&](IndexRange range) {
@@ -480,7 +480,7 @@ static Curves *resample_to_evaluated(const CurveComponent &src_component,
/* Create the correct number of uniform-length samples for every selected curve. */
Span<float3> evaluated_positions = src_curves.evaluated_positions();
- MutableSpan<float3> dst_positions = dst_curves.positions();
+ MutableSpan<float3> dst_positions = dst_curves.positions_for_write();
AttributesForInterpolation attributes;
gather_point_attributes_to_interpolate(src_component, dst_component, attributes);