From 3090edfecfcea1ac379bbfc9499cb74551fffece Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 30 Aug 2022 15:18:11 -0500 Subject: Cleanup: Use standard variable name for curve points --- source/blender/draw/intern/draw_cache_impl_curves.cc | 6 +++--- source/blender/editors/curves/intern/curves_add.cc | 6 +++--- .../blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc | 11 +++++------ .../nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc | 6 +++--- 4 files changed, 14 insertions(+), 15 deletions(-) (limited to 'source/blender') diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc b/source/blender/draw/intern/draw_cache_impl_curves.cc index 1d3d6222f8f..4f0072ec657 100644 --- a/source/blender/draw/intern/draw_cache_impl_curves.cc +++ b/source/blender/draw/intern/draw_cache_impl_curves.cc @@ -397,10 +397,10 @@ static void curves_batch_cache_fill_strands_data(const Curves &curves_id, curves_id.geometry); for (const int i : IndexRange(curves.curves_num())) { - const IndexRange curve_range = curves.points_for_curve(i); + const IndexRange points = curves.points_for_curve(i); - *(uint *)GPU_vertbuf_raw_step(&data_step) = curve_range.start(); - *(ushort *)GPU_vertbuf_raw_step(&seg_step) = curve_range.size() - 1; + *(uint *)GPU_vertbuf_raw_step(&data_step) = points.start(); + *(ushort *)GPU_vertbuf_raw_step(&seg_step) = points.size() - 1; } } diff --git a/source/blender/editors/curves/intern/curves_add.cc b/source/blender/editors/curves/intern/curves_add.cc index 6556f62443a..07a2dc0b8eb 100644 --- a/source/blender/editors/curves/intern/curves_add.cc +++ b/source/blender/editors/curves/intern/curves_add.cc @@ -114,9 +114,9 @@ bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int poi RandomNumberGenerator rng; for (const int i : curves.curves_range()) { - const IndexRange curve_range = curves.points_for_curve(i); - MutableSpan curve_positions = positions.slice(curve_range); - MutableSpan curve_radii = radii.slice(curve_range); + const IndexRange points = curves.points_for_curve(i); + MutableSpan curve_positions = positions.slice(points); + MutableSpan curve_radii = radius.span.slice(points); const float theta = 2.0f * M_PI * rng.get_float(); const float phi = saacosf(2.0f * rng.get_float() - 1.0f); diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc index 1ee43d98e6f..02ae89b41e6 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_grow_shrink.cc @@ -144,21 +144,20 @@ class ExtrapolateCurvesEffect : public CurvesEffect { for (const int influence_i : range) { const int curve_i = curve_indices[influence_i]; const float move_distance_cu = move_distances_cu[influence_i]; - const IndexRange curve_points = curves.points_for_curve(curve_i); + const IndexRange points = curves.points_for_curve(curve_i); - if (curve_points.size() <= 1) { + if (points.size() <= 1) { continue; } - const float3 old_last_pos_cu = positions_cu[curve_points.last()]; + const float3 old_last_pos_cu = positions_cu[points.last()]; /* Use some point within the curve rather than the end point to smooth out some random * variation. */ - const float3 direction_reference_point = - positions_cu[curve_points[curve_points.size() / 2]]; + const float3 direction_reference_point = positions_cu[points[points.size() / 2]]; const float3 direction = math::normalize(old_last_pos_cu - direction_reference_point); const float3 new_last_pos_cu = old_last_pos_cu + direction * move_distance_cu; - move_last_point_and_resample(positions_cu.slice(curve_points), new_last_pos_cu); + move_last_point_and_resample(positions_cu.slice(points), new_last_pos_cu); } }); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc index 8c3e97edac0..28d979facac 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_endpoint_selection.cc @@ -64,12 +64,12 @@ class EndpointFieldInput final : public bke::CurvesFieldInput { devirtualize_varray2(start_size, end_size, [&](const auto &start_size, const auto &end_size) { threading::parallel_for(curves.curves_range(), 1024, [&](IndexRange curves_range) { for (const int i : curves_range) { - const IndexRange range = curves.points_for_curve(i); + const IndexRange points = curves.points_for_curve(i); const int start = std::max(start_size[i], 0); const int end = std::max(end_size[i], 0); - selection_span.slice(range.take_front(start)).fill(true); - selection_span.slice(range.take_back(end)).fill(true); + selection_span.slice(points.take_front(start)).fill(true); + selection_span.slice(points.take_back(end)).fill(true); } }); }); -- cgit v1.2.3