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:
authorPablo Dobarro <pablodp606@gmail.com>2021-02-10 03:38:28 +0300
committerPablo Dobarro <pablodp606@gmail.com>2021-02-10 20:06:56 +0300
commit4818ed1c76cad447b59a36056b170282732dde0d (patch)
tree4964d5a6fba57742b0bd6a8569b61c755d45c4ff /source/blender/editors/sculpt_paint/sculpt_pose.c
parent54cbfeedd7852b160696ca1571de5f28e4e88511 (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_pose.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_pose.c76
1 files changed, 39 insertions, 37 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_pose.c b/source/blender/editors/sculpt_paint/sculpt_pose.c
index f9ccbbb849c..a85f805894b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_pose.c
+++ b/source/blender/editors/sculpt_paint/sculpt_pose.c
@@ -490,50 +490,52 @@ static bool pose_face_sets_floodfill_cb(
is_vertex_valid = SCULPT_vertex_has_face_set(ss, index, data->current_face_set);
}
- if (is_vertex_valid) {
-
- if (!BLI_BITMAP_TEST(data->is_weighted, index)) {
- data->pose_factor[index] = 1.0f;
- BLI_BITMAP_ENABLE(data->is_weighted, index);
- visit_next = true;
- }
-
- /* Fallback origin accumulation. */
- if (symmetry_check) {
- add_v3_v3(data->fallback_origin, SCULPT_vertex_co_get(ss, index));
- data->fallback_count++;
- }
-
- if (symmetry_check && !SCULPT_vertex_has_unique_face_set(ss, index)) {
+ if (!is_vertex_valid) {
+ return visit_next;
+ }
- /* We only add coordinates for calculating the origin when it is possible to go from this
- * vertex to another vertex in a valid face set for the next iteration. */
- bool count_as_boundary = false;
+ if (!BLI_BITMAP_TEST(data->is_weighted, index)) {
+ data->pose_factor[index] = 1.0f;
+ BLI_BITMAP_ENABLE(data->is_weighted, index);
+ visit_next = true;
+ }
- SculptVertexNeighborIter ni;
- SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, index, ni) {
- int next_face_set_candidate = SCULPT_vertex_face_set_get(ss, ni.index);
+ /* Fallback origin accumulation. */
+ if (symmetry_check) {
+ add_v3_v3(data->fallback_origin, SCULPT_vertex_co_get(ss, index));
+ data->fallback_count++;
+ }
- /* Check if we can get a valid face set for the next iteration from this neighbor. */
- if (SCULPT_vertex_has_unique_face_set(ss, ni.index) &&
- !BLI_gset_haskey(data->visited_face_sets, POINTER_FROM_INT(next_face_set_candidate))) {
- if (!data->next_face_set_found) {
- data->next_face_set = next_face_set_candidate;
- data->next_vertex = ni.index;
- data->next_face_set_found = true;
- }
- count_as_boundary = true;
- }
- }
- SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
+ if (!symmetry_check || SCULPT_vertex_has_unique_face_set(ss, index)) {
+ return visit_next;
+ }
- /* Origin accumulation. */
- if (count_as_boundary) {
- add_v3_v3(data->pose_origin, SCULPT_vertex_co_get(ss, index));
- data->tot_co++;
+ /* We only add coordinates for calculating the origin when it is possible to go from this
+ * vertex to another vertex in a valid face set for the next iteration. */
+ bool count_as_boundary = false;
+
+ SculptVertexNeighborIter ni;
+ SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, index, ni) {
+ int next_face_set_candidate = SCULPT_vertex_face_set_get(ss, ni.index);
+
+ /* Check if we can get a valid face set for the next iteration from this neighbor. */
+ if (SCULPT_vertex_has_unique_face_set(ss, ni.index) &&
+ !BLI_gset_haskey(data->visited_face_sets, POINTER_FROM_INT(next_face_set_candidate))) {
+ if (!data->next_face_set_found) {
+ data->next_face_set = next_face_set_candidate;
+ data->next_vertex = ni.index;
+ data->next_face_set_found = true;
}
+ count_as_boundary = true;
}
}
+ SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
+
+ /* Origin accumulation. */
+ if (count_as_boundary) {
+ add_v3_v3(data->pose_origin, SCULPT_vertex_co_get(ss, index));
+ data->tot_co++;
+ }
return visit_next;
}