diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2021-02-10 03:38:28 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2021-02-10 20:06:56 +0300 |
commit | 4818ed1c76cad447b59a36056b170282732dde0d (patch) | |
tree | 4964d5a6fba57742b0bd6a8569b61c755d45c4ff /source/blender/editors/sculpt_paint/sculpt_automasking.c | |
parent | 54cbfeedd7852b160696ca1571de5f28e4e88511 (diff) |
Cleanup: Unindent if statements in sculpt tools code
This removes indentations from if statements by converting them to early
returns and continue.
Most of the code of brushes and tools has loops with a full indented
body inside of an if, which was also copied into some of the new tools.
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D10333
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_automasking.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_automasking.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.c b/source/blender/editors/sculpt_paint/sculpt_automasking.c index bb68ec56b25..5f5fb51d75f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_automasking.c +++ b/source/blender/editors/sculpt_paint/sculpt_automasking.c @@ -298,24 +298,26 @@ float *SCULPT_boundary_automasking_init(Object *ob, for (int propagation_it = 0; propagation_it < propagation_steps; propagation_it++) { for (int i = 0; i < totvert; i++) { - if (edge_distance[i] == EDGE_DISTANCE_INF) { - SculptVertexNeighborIter ni; - SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, i, ni) { - if (edge_distance[ni.index] == propagation_it) { - edge_distance[i] = propagation_it + 1; - } + if (edge_distance[i] != EDGE_DISTANCE_INF) { + continue; + } + SculptVertexNeighborIter ni; + SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, i, ni) { + if (edge_distance[ni.index] == propagation_it) { + edge_distance[i] = propagation_it + 1; } - SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); } + SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); } } for (int i = 0; i < totvert; i++) { - if (edge_distance[i] != EDGE_DISTANCE_INF) { - const float p = 1.0f - ((float)edge_distance[i] / (float)propagation_steps); - const float edge_boundary_automask = pow2f(p); - automask_factor[i] *= (1.0f - edge_boundary_automask); + if (edge_distance[i] == EDGE_DISTANCE_INF) { + continue; } + const float p = 1.0f - ((float)edge_distance[i] / (float)propagation_steps); + const float edge_boundary_automask = pow2f(p); + automask_factor[i] *= (1.0f - edge_boundary_automask); } MEM_SAFE_FREE(edge_distance); |