[Bf-blender-cvs] [de7c9f41e61] master: Cleanup: Editors/Object, Clang-Tidy else-after-return fixes
Sybren A. Stüvel
noreply at git.blender.org
Fri Jul 3 16:15:12 CEST 2020
Commit: de7c9f41e613a704f8e3258050b952d2ada60083
Author: Sybren A. Stüvel
Date: Fri Jul 3 15:42:22 2020 +0200
Branches: master
https://developer.blender.org/rBde7c9f41e613a704f8e3258050b952d2ada60083
Cleanup: Editors/Object, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/object` module.
No functional changes.
===================================================================
M source/blender/editors/object/object_add.c
M source/blender/editors/object/object_bake_api.c
M source/blender/editors/object/object_constraint.c
M source/blender/editors/object/object_data_transfer.c
M source/blender/editors/object/object_edit.c
M source/blender/editors/object/object_gpencil_modifier.c
M source/blender/editors/object/object_hook.c
M source/blender/editors/object/object_modifier.c
M source/blender/editors/object/object_relations.c
M source/blender/editors/object/object_remesh.c
M source/blender/editors/object/object_select.c
M source/blender/editors/object/object_shader_fx.c
M source/blender/editors/object/object_shapekey.c
M source/blender/editors/object/object_transform.c
M source/blender/editors/object/object_utils.c
M source/blender/editors/object/object_vgroup.c
M source/blender/editors/object/object_volume.c
===================================================================
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 4850764eecd..48b50be411e 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1642,7 +1642,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
ob->id.name + 2);
continue;
}
- else if (is_indirectly_used && ID_REAL_USERS(ob) <= 1 && ID_EXTRA_USERS(ob) == 0) {
+ if (is_indirectly_used && ID_REAL_USERS(ob) <= 1 && ID_EXTRA_USERS(ob) == 0) {
BKE_reportf(op->reports,
RPT_WARNING,
"Cannot delete object '%s' from scene '%s', indirectly used objects need at "
@@ -1866,7 +1866,7 @@ static bool dupliobject_cmp(const void *a_, const void *b_)
if (a->persistent_id[i] != b->persistent_id[i]) {
return true;
}
- else if (a->persistent_id[i] == INT_MAX) {
+ if (a->persistent_id[i] == INT_MAX) {
break;
}
}
@@ -1891,7 +1891,7 @@ static bool dupliobject_instancer_cmp(const void *a_, const void *b_)
if (a->persistent_id[i] != b->persistent_id[i]) {
return true;
}
- else if (a->persistent_id[i] == INT_MAX) {
+ if (a->persistent_id[i] == INT_MAX) {
break;
}
}
@@ -3097,9 +3097,7 @@ static bool object_join_poll(bContext *C)
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_ARMATURE, OB_GPENCIL)) {
return ED_operator_screenactive(C);
}
- else {
- return false;
- }
+ return false;
}
static int object_join_exec(bContext *C, wmOperator *op)
@@ -3110,11 +3108,11 @@ static int object_join_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
return OPERATOR_CANCELLED;
}
- else if (BKE_object_obdata_is_libdata(ob)) {
+ if (BKE_object_obdata_is_libdata(ob)) {
BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return OPERATOR_CANCELLED;
}
- else if (ob->type == OB_GPENCIL) {
+ if (ob->type == OB_GPENCIL) {
bGPdata *gpd = (bGPdata *)ob->data;
if ((!gpd) || GPENCIL_ANY_MODE(gpd)) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in this mode");
@@ -3125,13 +3123,13 @@ static int object_join_exec(bContext *C, wmOperator *op)
if (ob->type == OB_MESH) {
return ED_mesh_join_objects_exec(C, op);
}
- else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+ if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
return ED_curve_join_objects_exec(C, op);
}
- else if (ob->type == OB_ARMATURE) {
+ if (ob->type == OB_ARMATURE) {
return ED_armature_join_objects_exec(C, op);
}
- else if (ob->type == OB_GPENCIL) {
+ if (ob->type == OB_GPENCIL) {
return ED_gpencil_join_objects_exec(C, op);
}
@@ -3172,9 +3170,7 @@ static bool join_shapes_poll(bContext *C)
if (ob->type == OB_MESH) {
return ED_operator_screenactive(C);
}
- else {
- return false;
- }
+ return false;
}
static int join_shapes_exec(bContext *C, wmOperator *op)
@@ -3185,7 +3181,7 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
return OPERATOR_CANCELLED;
}
- else if (BKE_object_obdata_is_libdata(ob)) {
+ if (BKE_object_obdata_is_libdata(ob)) {
BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index e84dbca2469..c4cb21a67f3 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -434,14 +434,12 @@ static bool bake_object_check(ViewLayer *view_layer, Object *ob, ReportList *rep
BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is not a mesh", ob->id.name + 2);
return false;
}
- else {
- Mesh *me = (Mesh *)ob->data;
- if (CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV) == -1) {
- BKE_reportf(
- reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2);
- return false;
- }
+ Mesh *me = (Mesh *)ob->data;
+ if (CustomData_get_active_layer_index(&me->ldata, CD_MLOOPUV) == -1) {
+ BKE_reportf(
+ reports, RPT_ERROR, "No active UV layer found in the object \"%s\"", ob->id.name + 2);
+ return false;
}
for (i = 0; i < ob->totcol; i++) {
@@ -542,14 +540,11 @@ static bool bake_pass_filter_check(eScenePassType pass_type,
return false;
}
- else {
- BKE_report(reports,
- RPT_ERROR,
- "Combined bake pass requires Emit, or a light pass with "
- "Direct or Indirect contributions enabled");
- return false;
- }
- break;
+ BKE_report(reports,
+ RPT_ERROR,
+ "Combined bake pass requires Emit, or a light pass with "
+ "Direct or Indirect contributions enabled");
+ return false;
case SCE_PASS_DIFFUSE_COLOR:
case SCE_PASS_GLOSSY_COLOR:
case SCE_PASS_TRANSM_COLOR:
@@ -1071,10 +1066,7 @@ static int bake(Render *re,
(normal_swizzle[2] == R_BAKE_POSZ)) {
break;
}
- else {
- RE_bake_normal_world_to_world(
- pixel_array_low, num_pixels, depth, result, normal_swizzle);
- }
+ RE_bake_normal_world_to_world(pixel_array_low, num_pixels, depth, result, normal_swizzle);
break;
}
case R_BAKE_SPACE_OBJECT: {
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 5746480e3f8..3618eae7db9 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -816,9 +816,7 @@ static int stretchto_reset_invoke(bContext *C, wmOperator *op, const wmEvent *UN
if (edit_constraint_invoke_properties(C, op)) {
return stretchto_reset_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_stretchto_reset(wmOperatorType *ot)
@@ -873,9 +871,7 @@ static int limitdistance_reset_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_constraint_invoke_properties(C, op)) {
return limitdistance_reset_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
@@ -953,9 +949,7 @@ static int childof_set_inverse_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_constraint_invoke_properties(C, op)) {
return childof_set_inverse_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_childof_set_inverse(wmOperatorType *ot)
@@ -1004,9 +998,7 @@ static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, const wmEve
if (edit_constraint_invoke_properties(C, op)) {
return childof_clear_inverse_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_childof_clear_inverse(wmOperatorType *ot)
@@ -1131,9 +1123,7 @@ static int followpath_path_animate_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return followpath_path_animate_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_followpath_path_animate(wmOperatorType *ot)
@@ -1214,9 +1204,7 @@ static int objectsolver_set_inverse_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return objectsolver_set_inverse_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_objectsolver_set_inverse(wmOperatorType *ot)
@@ -1272,9 +1260,7 @@ static int objectsolver_clear_inverse_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return objectsolver_clear_inverse_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_objectsolver_clear_inverse(wmOperatorType *ot)
@@ -1423,10 +1409,8 @@ static int constraint_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else {
- /* couldn't remove due to some invalid data */
- return OPERATOR_CANCELLED;
- }
+ /* couldn't remove due to some invalid data */
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_delete(wmOperatorType *ot)
@@ -1476,9 +1460,7 @@ static int constraint_move_down_invoke(bContext *C, wmOperator *op, const wmEven
if (edit_constraint_invoke_properties(C, op)) {
return constraint_move_down_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_move_down(wmOperatorType *ot)
@@ -1532,9 +1514,7 @@ static int constraint_move_up_invoke(bContext *C, wmOperator *op, const wmEvent
if (edit_constraint_invoke_properties(C, op)) {
return constraint_move_up_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_move_up(wmOperatorType *ot)
@@ -1592,9 +1572,7 @@ static int constraint_move_to_index_invoke(bContext *C,
if (edit_constraint_invoke_properties(C, op)) {
return constraint_move_to_index_exec(C, op);
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void CONSTRAINT_OT_move_to_index(wmOperatorType *ot)
@@ -1908,8 +1886,7 @@ static bool get_new_constraint_target(
break;
}
- else if (((!only_curve) || (ob->type == OB_CURVE)) &&
- ((!only_mesh) || (ob->type == OB_MESH))) {
+ if (((!only_curve) || (ob->type == OB_CURVE)) && ((!only_mesh) || (ob->type == OB_MESH))) {
/* set target */
*tar_ob = ob;
found = true;
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index 0df33255c34..14bf73027d9 100644
--- a/source/blender/editors/object/object_data
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list