[Bf-blender-cvs] [f82e52ebc83] master: Cleanup: Editors/Animation, Clang-Tidy else-after-return fixes

Sybren A. Stüvel noreply at git.blender.org
Fri Jul 3 16:15:11 CEST 2020


Commit: f82e52ebc838b666c258090236f0323d0d4f6aee
Author: Sybren A. Stüvel
Date:   Fri Jul 3 14:51:19 2020 +0200
Branches: master
https://developer.blender.org/rBf82e52ebc838b666c258090236f0323d0d4f6aee

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

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

No functional changes.

===================================================================

M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_channels_edit.c
M	source/blender/editors/animation/anim_draw.c
M	source/blender/editors/animation/anim_filter.c
M	source/blender/editors/animation/anim_ipo_utils.c
M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/animation/drivers.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/animation/keyframes_edit.c
M	source/blender/editors/animation/keyframes_general.c
M	source/blender/editors/animation/keyframing.c
M	source/blender/editors/animation/keyingsets.c

===================================================================

diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 0947023e071..843b8400a32 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -322,9 +322,7 @@ static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
   if (acf && acf->get_indent_level) {
     return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
   }
-  else {
-    return 0;
-  }
+  return 0;
 }
 
 /* offset based on nodetree type */
@@ -514,11 +512,10 @@ static int acf_summary_setting_flag(bAnimContext *UNUSED(ac),
     *neg = true;
     return ADS_FLAG_SUMMARY_COLLAPSED;
   }
-  else {
-    /* unsupported */
-    *neg = false;
-    return 0;
-  }
+
+  /* unsupported */
+  *neg = false;
+  return 0;
 }
 
 /* get pointer to the setting */
@@ -538,11 +535,10 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale,
     /* return pointer to DopeSheet's flag */
     return GET_ACF_FLAG_PTR(ads->flag, type);
   }
-  else {
-    /* can't return anything useful - unsupported */
-    *type = 0;
-    return NULL;
-  }
+
+  /* can't return anything useful - unsupported */
+  *type = 0;
+  return NULL;
 }
 
 /* all animation summary (DopeSheet only) type define */
@@ -3815,19 +3811,15 @@ static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac),
             /* ok - we've got a solo track, and this is it */
             return true;
           }
-          else {
-            /* not ok - we've got a solo track, but this isn't it, so make it more obvious */
-            return false;
-          }
+          /* not ok - we've got a solo track, but this isn't it, so make it more obvious */
+          return false;
         }
 
         /* ok - no tracks are solo'd, and this isn't being tweaked */
         return true;
       }
-      else {
-        /* unsupported - this track is being tweaked */
-        return false;
-      }
+      /* unsupported - this track is being tweaked */
+      return false;
 
     /* unsupported */
     default:
@@ -3901,9 +3893,8 @@ static int acf_nlaaction_icon(bAnimListElem *ale)
   if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
     return ICON_ACTION_TWEAK;
   }
-  else {
-    return ICON_ACTION;
-  }
+
+  return ICON_ACTION;
 }
 
 /* Backdrop color for nla action channel
@@ -4157,9 +4148,8 @@ const bAnimChannelType *ANIM_channel_get_typeinfo(bAnimListElem *ale)
   if ((ale->type >= 0) && (ale->type < ANIMTYPE_NUM_TYPES)) {
     return animchannelTypeInfo[ale->type];
   }
-  else {
-    return NULL;
-  }
+
+  return NULL;
 }
 
 /* --------------------------- */
@@ -4227,9 +4217,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
           if (negflag) {
             return ((*val) & flag) == 0;
           }
-          else {
-            return ((*val) & flag) != 0;
-          }
+          return ((*val) & flag) != 0;
         }
         case sizeof(short): /* short pointer for setting */
         {
@@ -4238,9 +4226,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
           if (negflag) {
             return ((*val) & flag) == 0;
           }
-          else {
-            return ((*val) & flag) != 0;
-          }
+          return ((*val) & flag) != 0;
         }
         case sizeof(char): /* char pointer for setting */
         {
@@ -4249,9 +4235,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChanne
           if (negflag) {
             return ((*val) & flag) == 0;
           }
-          else {
-            return ((*val) & flag) != 0;
-          }
+          return ((*val) & flag) != 0;
         }
       }
     }
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 1ca3452e8d8..d5f68e44ad8 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -505,9 +505,9 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac,
     printf("ERROR: no channel matching the one changed was found\n");
     return;
   }
-  else {
-    const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale_setting);
 
+  {
+    const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale_setting);
     if (acf == NULL) {
       printf("ERROR: no channel info for the changed channel\n");
       return;
@@ -571,9 +571,7 @@ void ANIM_flush_setting_anim_channels(bAnimContext *ac,
            * finished, so skip until we get to the parent of this level
            */
         }
-        else {
-          continue;
-        }
+        continue;
       }
     }
   }
@@ -2314,7 +2312,7 @@ static int animchannels_clean_empty_exec(bContext *C, wmOperator *UNUSED(op))
           nla_empty = false;
           break;
         }
-        else if (nlt->strips.first == NULL) {
+        if (nlt->strips.first == NULL) {
           /* this track is empty, but another one may still have stuff in it, so can't break yet */
           nla_empty = true;
         }
@@ -2812,10 +2810,9 @@ static int animchannels_rename_invoke(bContext *C, wmOperator *UNUSED(op), const
   if (rename_anim_channels(&ac, channel_index)) {
     return OPERATOR_FINISHED;
   }
-  else {
-    /* allow event to be handled by selectall operator */
-    return OPERATOR_PASS_THROUGH;
-  }
+
+  /* allow event to be handled by selectall operator */
+  return OPERATOR_PASS_THROUGH;
 }
 
 static void ANIM_OT_channels_rename(wmOperatorType *ot)
@@ -3372,10 +3369,9 @@ static int animchannels_channel_select_keys_invoke(bContext *C,
     WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
     return OPERATOR_FINISHED;
   }
-  else {
-    /* allow event to be handled by selectall operator */
-    return OPERATOR_PASS_THROUGH;
-  }
+
+  /* allow event to be handled by selectall operator */
+  return OPERATOR_PASS_THROUGH;
 }
 
 static void ANIM_OT_channel_select_keys(wmOperatorType *ot)
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index a2a1f7eb1d2..4cbea0ded15 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -473,9 +473,7 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag
           if (flag & ANIM_UNITCONV_RESTORE) {
             return DEG2RADF(1.0f); /* degrees to radians */
           }
-          else {
-            return RAD2DEGF(1.0f); /* radians to degrees */
-          }
+          return RAD2DEGF(1.0f); /* radians to degrees */
         }
       }
 
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 9564b662b12..08be6c72bbc 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -571,7 +571,7 @@ bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
     channel_data, channel_type, owner_id, fcurve_owner_id, ale_statement) \
   if (filter_mode & ANIMFILTER_TMP_PEEK) \
     return 1; \
-  else { \
+  { \
     bAnimListElem *ale = make_new_animlistelem( \
         channel_data, channel_type, (ID *)owner_id, fcurve_owner_id); \
     if (ale) { \
@@ -1169,10 +1169,8 @@ static bool name_matches_dopesheet_filter(bDopeSheet *ads, char *name)
     /* if we have a match somewhere, this returns true */
     return found;
   }
-  else {
-    /* fallback/default - just case insensitive, but starts from start of word */
-    return BLI_strcasestr(name, ads->searchstr) != NULL;
-  }
+  /* fallback/default - just case insensitive, but starts from start of word */
+  return BLI_strcasestr(name, ads->searchstr) != NULL;
 }
 
 /* (Display-)Name-based F-Curve filtering
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 3613ca9eeda..72103d68b05 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -59,7 +59,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
   if (name == NULL) {
     return icon;
   }
-  else if (ELEM(NULL, id, fcu, fcu->rna_path)) {
+
+  if (ELEM(NULL, id, fcu, fcu->rna_path)) {
     if (fcu == NULL) {
       strcpy(name, TIP_("<invalid>"));
     }
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 46566feea91..d823b976a47 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -110,9 +110,7 @@ ListBase *ED_animcontext_get_markers(const bAnimContext *ac)
   if (ac) {
     return context_get_markers(ac->scene, ac->area);
   }
-  else {
-    return NULL;
-  }
+  return NULL;
 }
 
 /* --------------------------------- */
@@ -307,7 +305,7 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only
       }
       return;
     }
-    else if (ce->cfra > marker->frame) {
+    if (ce->cfra > marker->frame) {
       break;
     }
   }
@@ -487,13 +485,11 @@ static int marker_get_icon_id(TimeMarker *marker, int flag)
                                      (marker->flag & SELECT) ? ICON_PMARKER_SEL : ICON_PMARKER;
   }
 #ifdef DURIAN_CAMERA_SWITCH
-  else if (marker->camera) {
+  if (marker->camera) {
     return (marker->flag & SELECT) ? ICON_OUTLINER_OB_CAMERA : ICON_CAMERA_DATA;
   }
 #endif
-  else {
-    return (marker->flag & SELECT) ? ICON_MARKER_HLT : ICON_MARKER;
-  }
+  return (marker->flag & SELECT) ? ICON_MARKER_HLT : ICON_MARKER;
 }
 
 static void draw_marker(
@@ -1508,9 +1504,8 @@ static int ed_marker_rename_exec(bContext *C, wmOperator *op)
 
     return OPERATOR_FINISHED;
   }
-  else {
-    return OPERATOR_CANCELLED;
-  }
+
+  return OPERATOR_CANCELLED;
 }
 
 static int ed_marker_rename_invoke(bContext *C, wmOperator *op, const wmEvent *event)
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 328e435877c..3b15cd794d8 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -1020,9 +1020,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list