diff options
author | Hans Goudey <h.goudey@me.com> | 2022-05-20 11:56:19 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-05-20 11:56:19 +0300 |
commit | 019681b9841d7e34bac56211d645cf0497f8e9cf (patch) | |
tree | 304fc1f3da6791b5b2c784aa61d2bcefd8d486a3 /source/blender/editors/sculpt_paint | |
parent | 47c2a876bf9e975cbe7683fabe30f0f2b586c1fa (diff) |
Cleanup: Simplify loop syntax for curve points
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_comb.cc | 8 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/curves_sculpt_delete.cc | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc index 72257659c52..cecb13fbf7f 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_comb.cc @@ -381,11 +381,11 @@ struct CombOperationExecutor { threading::parallel_for(changed_curves.index_range(), 256, [&](const IndexRange range) { for (const int curve_i : changed_curves.as_span().slice(range)) { const IndexRange points = curves_->points_for_curve(curve_i); - for (const int segment_i : IndexRange(points.size() - 1)) { - const float3 &p1_cu = positions_cu[points[segment_i]]; - float3 &p2_cu = positions_cu[points[segment_i] + 1]; + for (const int segment_i : points.drop_back(1)) { + const float3 &p1_cu = positions_cu[segment_i]; + float3 &p2_cu = positions_cu[segment_i + 1]; const float3 direction = math::normalize(p2_cu - p1_cu); - const float expected_length_cu = expected_lengths_cu[points[segment_i]]; + const float expected_length_cu = expected_lengths_cu[segment_i]; p2_cu = p1_cu + direction * expected_length_cu; } } diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc b/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc index f07c0a65933..9446f38891e 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_delete.cc @@ -162,9 +162,9 @@ struct DeleteOperationExecutor { threading::parallel_for(curves_->curves_range(), 512, [&](IndexRange curve_range) { for (const int curve_i : curve_range) { const IndexRange points = curves_->points_for_curve(curve_i); - for (const int segment_i : IndexRange(points.size() - 1)) { - const float3 pos1_cu = brush_transform_inv * positions_cu[points[segment_i]]; - const float3 pos2_cu = brush_transform_inv * positions_cu[points[segment_i + 1]]; + for (const int segment_i : points.drop_back(1)) { + const float3 pos1_cu = brush_transform_inv * positions_cu[segment_i]; + const float3 pos2_cu = brush_transform_inv * positions_cu[segment_i + 1]; float2 pos1_re, pos2_re; ED_view3d_project_float_v2_m4(region_, pos1_cu, pos1_re, projection.values); @@ -220,9 +220,9 @@ struct DeleteOperationExecutor { threading::parallel_for(curves_->curves_range(), 512, [&](IndexRange curve_range) { for (const int curve_i : curve_range) { const IndexRange points = curves_->points_for_curve(curve_i); - for (const int segment_i : IndexRange(points.size() - 1)) { - const float3 pos1_cu = positions_cu[points[segment_i]]; - const float3 pos2_cu = positions_cu[points[segment_i] + 1]; + for (const int segment_i : points.drop_back(1)) { + const float3 &pos1_cu = positions_cu[segment_i]; + const float3 &pos2_cu = positions_cu[segment_i + 1]; float3 closest_segment_cu, closest_brush_cu; isect_seg_seg_v3(pos1_cu, |