From 33a74941c5fd4efb6eefcaace3315d3e2b65681f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 3 Jul 2020 17:30:31 +0200 Subject: Cleanup: Editors, Clang-Tidy else-after-return fixes This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors` module. No functional changes. --- source/blender/editors/space_nla/nla_channels.c | 35 +++++++++---------- source/blender/editors/space_nla/nla_edit.c | 46 ++++++++++--------------- 2 files changed, 35 insertions(+), 46 deletions(-) (limited to 'source/blender/editors/space_nla') diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index d399ea47d7e..86bb189c638 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -461,10 +461,9 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) "block)"); return OPERATOR_CANCELLED; } - else { - id = adt_ptr.owner_id; - adt = adt_ptr.data; - } + + id = adt_ptr.owner_id; + adt = adt_ptr.data; } else { /* indexed channel */ @@ -483,7 +482,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) ANIM_animdata_freelist(&anim_data); return OPERATOR_CANCELLED; } - else if (ale->type != ANIMTYPE_NLAACTION) { + if (ale->type != ANIMTYPE_NLAACTION) { BKE_reportf(op->reports, RPT_ERROR, "Animation channel at index %d is not a NLA 'Active Action' channel", @@ -505,22 +504,21 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Internal Error - AnimData block is not valid"); return OPERATOR_CANCELLED; } - else if (nlaedit_is_tweakmode_on(&ac)) { + if (nlaedit_is_tweakmode_on(&ac)) { BKE_report(op->reports, RPT_WARNING, "Cannot push down actions while tweaking a strip's action, exit tweak mode first"); return OPERATOR_CANCELLED; } - else if (adt->action == NULL) { + if (adt->action == NULL) { BKE_report(op->reports, RPT_WARNING, "No active action to push down"); return OPERATOR_CANCELLED; } - else { - /* 'push-down' action - only usable when not in TweakMode */ - BKE_nla_action_pushdown(adt); - DEG_id_tag_update_ex(CTX_data_main(C), id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE); - } + /* 'push-down' action - only usable when not in TweakMode */ + BKE_nla_action_pushdown(adt); + + DEG_id_tag_update_ex(CTX_data_main(C), id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE); /* set notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); @@ -735,14 +733,13 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op) /* done */ return OPERATOR_FINISHED; } - else { - /* failed to add any tracks */ - BKE_report( - op->reports, RPT_WARNING, "Select an existing NLA Track or an empty action line first"); - /* not done */ - return OPERATOR_CANCELLED; - } + /* failed to add any tracks */ + BKE_report( + op->reports, RPT_WARNING, "Select an existing NLA Track or an empty action line first"); + + /* not done */ + return OPERATOR_CANCELLED; } void NLA_OT_tracks_add(wmOperatorType *ot) diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index dec7a0fd93c..bc9bd0e18f2 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -269,9 +269,7 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op) if (ok) { return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + return OPERATOR_CANCELLED; } void NLA_OT_tweakmode_exit(wmOperatorType *ot) @@ -373,9 +371,8 @@ static int nlaedit_previewrange_exec(bContext *C, wmOperator *UNUSED(op)) if (ac.scene == NULL) { return OPERATOR_CANCELLED; } - else { - scene = ac.scene; - } + + scene = ac.scene; /* set the range directly */ get_nlastrip_extents(&ac, &min, &max, true); @@ -616,7 +613,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op) // printf("Add strip - actname = '%s'\n", actname); return OPERATOR_CANCELLED; } - else if (act->idroot == 0) { + if (act->idroot == 0) { /* hopefully in this case (i.e. library of userless actions), * the user knows what they're doing... */ BKE_reportf(op->reports, @@ -830,12 +827,11 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op) /* done */ return OPERATOR_FINISHED; } - else { - BKE_report(op->reports, - RPT_ERROR, - "Needs at least a pair of adjacent selected strips with a gap between them"); - return OPERATOR_CANCELLED; - } + + BKE_report(op->reports, + RPT_ERROR, + "Needs at least a pair of adjacent selected strips with a gap between them"); + return OPERATOR_CANCELLED; } void NLA_OT_transition_add(wmOperatorType *ot) @@ -1146,9 +1142,8 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op) /* done */ return OPERATOR_FINISHED; } - else { - return OPERATOR_CANCELLED; - } + + return OPERATOR_CANCELLED; } static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) @@ -1293,9 +1288,8 @@ static void nlaedit_split_strip_actclip( if (IS_EQF(len, 0.0f)) { return; } - else { - splitframe = strip->start + (len / 2.0f); - } + + splitframe = strip->start + (len / 2.0f); /* action range */ len = strip->actend - strip->actstart; @@ -2504,10 +2498,9 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied"); return OPERATOR_CANCELLED; } - else { - /* no updates needed - copy is non-destructive operation */ - return OPERATOR_FINISHED; - } + + /* no updates needed - copy is non-destructive operation */ + return OPERATOR_FINISHED; } void NLA_OT_fmodifier_copy(wmOperatorType *ot) @@ -2591,10 +2584,9 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL); return OPERATOR_FINISHED; } - else { - BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste"); - return OPERATOR_CANCELLED; - } + + BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste"); + return OPERATOR_CANCELLED; } void NLA_OT_fmodifier_paste(wmOperatorType *ot) -- cgit v1.2.3