[Bf-blender-cvs] [651d1aa7c83] master: Cleanup: Editors/Transform, Clang-Tidy else-after-return fixes
Sybren A. Stüvel
noreply at git.blender.org
Fri Jul 3 17:43:28 CEST 2020
Commit: 651d1aa7c836892e95117e17716605a774c0220b
Author: Sybren A. Stüvel
Date: Fri Jul 3 17:25:04 2020 +0200
Branches: master
https://developer.blender.org/rB651d1aa7c836892e95117e17716605a774c0220b
Cleanup: Editors/Transform, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/transform` module.
No functional changes.
===================================================================
M source/blender/editors/transform/transform.c
M source/blender/editors/transform/transform_convert.c
M source/blender/editors/transform/transform_convert_action.c
M source/blender/editors/transform/transform_convert_mesh.c
M source/blender/editors/transform/transform_convert_paintcurve.c
M source/blender/editors/transform/transform_generics.c
M source/blender/editors/transform/transform_mode.c
M source/blender/editors/transform/transform_mode_edge_slide.c
M source/blender/editors/transform/transform_ops.c
M source/blender/editors/transform/transform_snap_object.c
===================================================================
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index eb60273fc79..76cce5e725f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -673,10 +673,10 @@ static bool transform_modal_item_poll(const wmOperator *op, int value)
if (t->spacetype != SPACE_VIEW3D) {
return false;
}
- else if ((t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) == 0) {
+ if ((t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) == 0) {
return false;
}
- else if (!validSnap(t)) {
+ if (!validSnap(t)) {
return false;
}
break;
@@ -1417,9 +1417,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
if (handled || t->redraw) {
return 0;
}
- else {
- return OPERATOR_PASS_THROUGH;
- }
+ return OPERATOR_PASS_THROUGH;
}
bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], float cent2d[2])
diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c
index 5d1fd1543df..d68489759fe 100644
--- a/source/blender/editors/transform/transform_convert.c
+++ b/source/blender/editors/transform/transform_convert.c
@@ -96,12 +96,10 @@ static int trans_data_compare_dist(const void *a, const void *b)
if (td_a->dist < td_b->dist) {
return -1;
}
- else if (td_a->dist > td_b->dist) {
+ if (td_a->dist > td_b->dist) {
return 1;
}
- else {
- return 0;
- }
+ return 0;
}
static int trans_data_compare_rdist(const void *a, const void *b)
@@ -112,12 +110,10 @@ static int trans_data_compare_rdist(const void *a, const void *b)
if (td_a->rdist < td_b->rdist) {
return -1;
}
- else if (td_a->rdist > td_b->rdist) {
+ if (td_a->rdist > td_b->rdist) {
return 1;
}
- else {
- return 0;
- }
+ return 0;
}
static void sort_trans_data_dist_container(const TransInfo *t, TransDataContainer *tc)
@@ -610,9 +606,7 @@ bool FrameOnMouseSide(char side, float frame, float cframe)
if (side == 'R') {
return (frame >= cframe);
}
- else {
- return (frame <= cframe);
- }
+ return (frame <= cframe);
}
/** \} */
@@ -670,7 +664,7 @@ void posttrans_fcurve_clean(FCurve *fcu, const int sel_flag, const bool use_hand
found = true;
break;
}
- else if (rk->frame < bezt->vec[1][0]) {
+ if (rk->frame < bezt->vec[1][0]) {
/* Terminate early if have passed the supposed insertion point? */
break;
}
@@ -696,11 +690,10 @@ void posttrans_fcurve_clean(FCurve *fcu, const int sel_flag, const bool use_hand
}
return;
}
- else {
- /* Compute the average values for each retained keyframe */
- LISTBASE_FOREACH (tRetainedKeyframe *, rk, &retained_keys) {
- rk->val = rk->val / (float)rk->tot_count;
- }
+
+ /* Compute the average values for each retained keyframe */
+ LISTBASE_FOREACH (tRetainedKeyframe *, rk, &retained_keys) {
+ rk->val = rk->val / (float)rk->tot_count;
}
/* 2) Delete all keyframes duplicating the "retained keys" found above
@@ -925,13 +918,13 @@ int special_transform_moving(TransInfo *t)
if (t->spacetype == SPACE_SEQ) {
return G_TRANSFORM_SEQ;
}
- else if (t->spacetype == SPACE_GRAPH) {
+ if (t->spacetype == SPACE_GRAPH) {
return G_TRANSFORM_FCURVES;
}
- else if ((t->flag & T_EDIT) || (t->flag & T_POSE)) {
+ if ((t->flag & T_EDIT) || (t->flag & T_POSE)) {
return G_TRANSFORM_EDIT;
}
- else if (t->flag & (T_OBJECT | T_TEXTURE)) {
+ if (t->flag & (T_OBJECT | T_TEXTURE)) {
return G_TRANSFORM_OBJ;
}
diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c
index b9292aa151c..40e60544642 100644
--- a/source/blender/editors/transform/transform_convert_action.c
+++ b/source/blender/editors/transform/transform_convert_action.c
@@ -84,9 +84,7 @@ static int count_fcurve_keys(FCurve *fcu, char side, float cfra, bool is_prop_ed
if (is_prop_edit && count > 0) {
return count_all;
}
- else {
- return count;
- }
+ return count;
}
/* fully select selected beztriples, but only include if it's on the right side of cfra */
@@ -112,9 +110,7 @@ static int count_gplayer_frames(bGPDlayer *gpl, char side, float cfra, bool is_p
if (is_prop_edit && count > 0) {
return count_all;
}
- else {
- return count;
- }
+ return count;
}
/* fully select selected beztriples, but only include if it's on the right side of cfra */
@@ -141,9 +137,7 @@ static int count_masklayer_frames(MaskLayer *masklay, char side, float cfra, boo
if (is_prop_edit && count > 0) {
return count_all;
}
- else {
- return count;
- }
+ return count;
}
/* This function assigns the information to transdata */
diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c
index 5e27fd3c4ce..90e45253afa 100644
--- a/source/blender/editors/transform/transform_convert_mesh.c
+++ b/source/blender/editors/transform/transform_convert_mesh.c
@@ -830,101 +830,100 @@ void createTransEditVerts(TransInfo *t)
if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
continue;
}
- else {
- int island_index = -1;
- if (island_data.island_vert_map) {
- const int connected_index = (dists_index && dists_index[a] != -1) ? dists_index[a] : a;
- island_index = island_data.island_vert_map[connected_index];
- }
- if (mirror_data.vert_map && mirror_data.vert_map[a].index != -1) {
- int elem_index = mirror_data.vert_map[a].index;
- BMVert *v_src = BM_vert_at_index(bm, elem_index);
+ int island_index = -1;
+ if (island_data.island_vert_map) {
+ const int connected_index = (dists_index && dists_index[a] != -1) ? dists_index[a] : a;
+ island_index = island_data.island_vert_map[connected_index];
+ }
- if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- mirror_data.vert_map[a].flag |= TD_SELECTED;
- }
+ if (mirror_data.vert_map && mirror_data.vert_map[a].index != -1) {
+ int elem_index = mirror_data.vert_map[a].index;
+ BMVert *v_src = BM_vert_at_index(bm, elem_index);
- td_mirror->extra = eve;
- td_mirror->loc = eve->co;
- copy_v3_v3(td_mirror->iloc, eve->co);
- td_mirror->flag = mirror_data.vert_map[a].flag;
- td_mirror->loc_src = v_src->co;
- transdata_center_get(&island_data, island_index, td_mirror->iloc, td_mirror->center);
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ mirror_data.vert_map[a].flag |= TD_SELECTED;
+ }
+
+ td_mirror->extra = eve;
+ td_mirror->loc = eve->co;
+ copy_v3_v3(td_mirror->iloc, eve->co);
+ td_mirror->flag = mirror_data.vert_map[a].flag;
+ td_mirror->loc_src = v_src->co;
+ transdata_center_get(&island_data, island_index, td_mirror->iloc, td_mirror->center);
- td_mirror++;
+ td_mirror++;
+ }
+ else if (prop_mode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ float *bweight = (cd_vert_bweight_offset != -1) ?
+ BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset) :
+ NULL;
+
+ /* Do not use the island center in case we are using islands
+ * only to get axis for snap/rotate to normal... */
+ VertsToTransData(t, tob, tx, em, eve, bweight, &island_data, island_index);
+ if (tx) {
+ tx++;
}
- else if (prop_mode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- float *bweight = (cd_vert_bweight_offset != -1) ?
- BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset) :
- NULL;
-
- /* Do not use the island center in case we are using islands
- * only to get axis for snap/rotate to normal... */
- VertsToTransData(t, tob, tx, em, eve, bweight, &island_data, island_index);
- if (tx) {
- tx++;
- }
- /* selected */
- if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- tob->flag |= TD_SELECTED;
- }
+ /* selected */
+ if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+ tob->flag |= TD_SELECTED;
+ }
- if (prop_mode) {
- if (prop_mode & T_PROP_CONNECTED) {
- tob->dist = dists[a];
- }
- else {
- tob->flag |= TD_NOTCONNECTED;
- tob->dist = FLT_MAX;
- }
+ if (prop_mode) {
+ if (prop_mode & T_PROP_CONNECTED) {
+ tob->dist = dists[a];
+ }
+ else {
+ tob->flag |= TD_NOTCONNECTED;
+ tob->dist = FLT_MAX;
}
+ }
- /* CrazySpace */
- const bool use_quats = quats && BM_elem_flag_test(eve, BM_ELEM_TAG);
- if (use_quats || defmats) {
- float mat[3][3], qmat[3][3], imat[3][3];
+ /* CrazySpace */
+ const bool use_quats = quats && BM_elem_flag_test(eve, BM_ELEM_TAG);
+ if (use_quats || defmats) {
+ float mat[3][3], qmat[3][3], imat[3][3];
- /* Use both or either quat and defmat correction. */
- if (use_quats) {
- quat_to_mat3(qmat, quats[BM_elem_index_get(eve)]);
+ /* Use both or either quat and defmat correction. */
+ if (use_quats) {
+ quat_to_mat3(qmat, quats[BM_elem_index_get(eve)]);
- if (defmats) {
- mul_m3_series(mat, defmats[a], qmat, mtx);
- }
- else {
- mul_m3_m3m3(mat, mtx, qmat);
- }
+ if (defmats) {
+ mul_m3_series(mat, defmats[a], qmat, mtx);
}
else {
- mul_m3_m3m3(mat, mtx, defmats[a]);
+ mul_m3_m3m3(mat, mtx, qmat);
}
-
- invert_m3_m3(imat, mat);
-
- copy_m3_m3(tob->sm
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list