Cleanup: Editors/Armature, Clang-Tidy else-after-return fixes

This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/editors/armature` module.

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2020-07-03 14:52:32 +02:00
parent f82e52ebc8
commit 7d0a0b8a6d
10 changed files with 61 additions and 99 deletions

View File

@ -182,9 +182,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
if (flipbone == NULL) {
break;
}
else {
SWAP(EditBone *, flipbone, ebone);
}
SWAP(EditBone *, flipbone, ebone);
}
newbone = ED_armature_ebone_add(arm, ebone->name);
@ -1084,13 +1082,12 @@ static EditBone *get_symmetrized_bone(bArmature *arm, EditBone *bone)
if (bone == NULL) {
return NULL;
}
else if (bone->temp.ebone != NULL) {
if (bone->temp.ebone != NULL) {
return bone->temp.ebone;
}
else {
EditBone *mirror = ED_armature_ebone_get_mirrored(arm->edbo, bone);
return (mirror != NULL) ? mirror : bone;
}
EditBone *mirror = ED_armature_ebone_get_mirrored(arm->edbo, bone);
return (mirror != NULL) ? mirror : bone;
}
/**
@ -1417,9 +1414,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
if (flipbone == NULL) {
break;
}
else {
SWAP(EditBone *, flipbone, ebone);
}
SWAP(EditBone *, flipbone, ebone);
}
totbone++;

View File

@ -728,7 +728,8 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No joints selected");
return OPERATOR_CANCELLED;
}
else if (mixed_object_error) {
if (mixed_object_error) {
BKE_report(op->reports, RPT_ERROR, "Bones for different objects selected");
BLI_freelistN(&points);
return OPERATOR_CANCELLED;
@ -1093,7 +1094,8 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Operation requires an active bone");
return OPERATOR_CANCELLED;
}
else if (arm->flag & ARM_MIRROR_EDIT) {
if (arm->flag & ARM_MIRROR_EDIT) {
/* For X-Axis Mirror Editing option, we may need a mirror copy of actbone
* - if there's a mirrored copy of selbone, try to find a mirrored copy of actbone
* (i.e. selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").

View File

@ -207,7 +207,7 @@ static void joined_armature_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data
id, dtar->rna_path, "pose.bones", old_name, new_name, 0, 0, false);
break; /* no need to try any more names for bone path */
}
else if (STREQ(dtar->pchan_name, old_name)) {
if (STREQ(dtar->pchan_name, old_name)) {
/* Change target bone name */
BLI_strncpy(dtar->pchan_name, new_name, sizeof(dtar->pchan_name));
break; /* no need to try any more names for bone subtarget */
@ -636,7 +636,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
has_selected_bone = true;
break;
}
else if (ebone->flag & (BONE_TIPSEL | BONE_ROOTSEL)) {
if (ebone->flag & (BONE_TIPSEL | BONE_ROOTSEL)) {
has_selected_any = true;
}
}
@ -816,7 +816,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Operation requires an active bone");
return OPERATOR_CANCELLED;
}
else if (arm->flag & ARM_MIRROR_EDIT) {
if (arm->flag & ARM_MIRROR_EDIT) {
/* For X-Axis Mirror Editing option, we may need a mirror copy of actbone:
* - If there's a mirrored copy of selbone, try to find a mirrored copy of actbone
* (i.e. selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").

View File

@ -263,10 +263,8 @@ static void *ed_armature_pick_bone_from_selectbuffer_impl(const bool is_editmode
*r_base = firstunSel_base;
return firstunSel;
}
else {
*r_base = firstSel_base;
return firstSel;
}
*r_base = firstSel_base;
return firstSel;
}
EditBone *ED_armature_pick_ebone_from_selectbuffer(Base **bases,
@ -2253,10 +2251,9 @@ static int armature_shortest_path_pick_invoke(bContext *C, wmOperator *op, const
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_WARNING, "Unselectable bone in chain");
return OPERATOR_CANCELLED;
}
BKE_report(op->reports, RPT_WARNING, "Unselectable bone in chain");
return OPERATOR_CANCELLED;
}
void ARMATURE_OT_shortest_path_pick(wmOperatorType *ot)

View File

@ -915,9 +915,7 @@ int ED_armature_ebone_selectflag_get(const EditBone *ebone)
return ((ebone->flag & (BONE_SELECTED | BONE_TIPSEL)) |
((ebone->parent->flag & BONE_TIPSEL) ? BONE_ROOTSEL : 0));
}
else {
return (ebone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL));
}
return (ebone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL));
}
void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag)

View File

@ -640,13 +640,11 @@ static float heat_limit_weight(float weight)
if (weight < WEIGHT_LIMIT_END) {
return 0.0f;
}
else if (weight < WEIGHT_LIMIT_START) {
if (weight < WEIGHT_LIMIT_START) {
t = (weight - WEIGHT_LIMIT_END) / (WEIGHT_LIMIT_START - WEIGHT_LIMIT_END);
return t * WEIGHT_LIMIT_START;
}
else {
return weight;
}
return weight;
}
void heat_bone_weighting(Object *ob,

View File

@ -177,11 +177,10 @@ static int pose_groups_menu_invoke(bContext *C, wmOperator *op, const wmEvent *U
return OPERATOR_INTERFACE;
}
else {
/* just use the active group index, and call the exec callback for the calling operator */
RNA_int_set(op->ptr, "type", pose->active_group);
return op->type->exec(C, op);
}
/* just use the active group index, and call the exec callback for the calling operator */
RNA_int_set(op->ptr, "type", pose->active_group);
return op->type->exec(C, op);
}
/* Assign selected pchans to the bone group that the user selects */
@ -221,9 +220,7 @@ static int pose_group_assign_exec(bContext *C, wmOperator *op)
if (done) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void POSE_OT_group_assign(wmOperatorType *ot)
@ -272,9 +269,7 @@ static int pose_group_unassign_exec(bContext *C, wmOperator *UNUSED(op))
if (done) {
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void POSE_OT_group_unassign(wmOperatorType *ot)

View File

@ -141,9 +141,7 @@ static int poselib_get_free_index(bAction *act)
if (low < high) {
return (low + 1);
}
else {
return (high + 1);
}
return (high + 1);
}
/* returns the active pose for a poselib */
@ -152,9 +150,7 @@ static TimeMarker *poselib_get_active_pose(bAction *act)
if ((act) && (act->active_marker)) {
return BLI_findlink(&act->markers, act->active_marker - 1);
}
else {
return NULL;
}
return NULL;
}
/* Get object that Pose Lib should be found on */
@ -173,9 +169,7 @@ static Object *get_poselib_object(bContext *C)
if (area && (area->spacetype == SPACE_PROPERTIES)) {
return ED_object_context(C);
}
else {
return BKE_object_pose_armature_get(CTX_data_active_object(C));
}
return BKE_object_pose_armature_get(CTX_data_active_object(C));
}
/* Poll callback for operators that require existing PoseLib data (with poses) to work */
@ -221,12 +215,10 @@ static bAction *poselib_validate(Main *bmain, Object *ob)
if (ELEM(NULL, ob, ob->pose)) {
return NULL;
}
else if (ob->poselib == NULL) {
if (ob->poselib == NULL) {
return poselib_init_new(bmain, ob);
}
else {
return ob->poselib;
}
return ob->poselib;
}
/* ************************************************************* */
@ -697,12 +689,11 @@ static int poselib_rename_invoke(bContext *C, wmOperator *op, const wmEvent *eve
BKE_report(op->reports, RPT_ERROR, "Invalid index for pose");
return OPERATOR_CANCELLED;
}
else {
/* Use the existing name of the marker as the name,
* and use the active marker as the one to rename. */
RNA_enum_set(op->ptr, "pose", act->active_marker - 1);
RNA_string_set(op->ptr, "name", marker->name);
}
/* Use the existing name of the marker as the name,
* and use the active marker as the one to rename. */
RNA_enum_set(op->ptr, "pose", act->active_marker - 1);
RNA_string_set(op->ptr, "name", marker->name);
/* part to sync with other similar operators... */
return WM_operator_props_popup_confirm(C, op, event);
@ -1755,9 +1746,7 @@ static int poselib_preview_exit(bContext *C, wmOperator *op)
if (ELEM(exit_state, PL_PREVIEW_CANCEL, PL_PREVIEW_ERROR)) {
return OPERATOR_CANCELLED;
}
else {
return OPERATOR_FINISHED;
}
return OPERATOR_FINISHED;
}
/* Cancel previewing operation (called when exiting Blender) */

View File

@ -1016,7 +1016,7 @@ static bool pose_select_same_keyingset(bContext *C, ReportList *reports, bool ex
BKE_report(reports, RPT_ERROR, "No active Keying Set to use");
return false;
}
else if (ANIM_validate_keyingset(C, NULL, ks) != 0) {
if (ANIM_validate_keyingset(C, NULL, ks) != 0) {
if (ks->paths.first == NULL) {
if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) {
BKE_report(reports,
@ -1129,9 +1129,7 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
return OPERATOR_CANCELLED;
}
void POSE_OT_select_grouped(wmOperatorType *ot)

View File

@ -1122,7 +1122,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
do_pose_update = true;
break;
}
else if (event->val == KM_PRESS) {
if (event->val == KM_PRESS) {
switch (event->type) {
/* Transform Channel Limits */
/* XXX: Replace these hardcoded hotkeys with a modalmap that can be customised */
@ -1307,9 +1307,8 @@ static int pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *ev
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
@ -1328,9 +1327,8 @@ static int pose_slide_push_exec(bContext *C, wmOperator *op)
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* do common exec work */
return pose_slide_exec_common(C, op, pso);
@ -1369,9 +1367,8 @@ static int pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *e
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
@ -1390,9 +1387,8 @@ static int pose_slide_relax_exec(bContext *C, wmOperator *op)
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* do common exec work */
return pose_slide_exec_common(C, op, pso);
@ -1430,9 +1426,8 @@ static int pose_slide_push_rest_invoke(bContext *C, wmOperator *op, const wmEven
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
@ -1451,9 +1446,8 @@ static int pose_slide_push_rest_exec(bContext *C, wmOperator *op)
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* do common exec work */
return pose_slide_exec_common(C, op, pso);
@ -1492,9 +1486,8 @@ static int pose_slide_relax_rest_invoke(bContext *C, wmOperator *op, const wmEve
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
@ -1513,9 +1506,8 @@ static int pose_slide_relax_rest_exec(bContext *C, wmOperator *op)
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* do common exec work */
return pose_slide_exec_common(C, op, pso);
@ -1554,9 +1546,8 @@ static int pose_slide_breakdown_invoke(bContext *C, wmOperator *op, const wmEven
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* initialise percentage so that it won't pop on first mouse move */
pose_slide_mouse_update_percentage(pso, op, event);
@ -1575,9 +1566,8 @@ static int pose_slide_breakdown_exec(bContext *C, wmOperator *op)
pose_slide_exit(op);
return OPERATOR_CANCELLED;
}
else {
pso = op->customdata;
}
pso = op->customdata;
/* do common exec work */
return pose_slide_exec_common(C, op, pso);