[Bf-blender-cvs] [a201020cd30] master: Cleanup: Editors/Space/Clip, Clang-Tidy else-after-return fixes

Sybren A. Stüvel noreply at git.blender.org
Fri Jul 3 17:43:27 CEST 2020


Commit: a201020cd3048af0a3068e4ba387ee8d16a35c1a
Author: Sybren A. Stüvel
Date:   Fri Jul 3 17:20:41 2020 +0200
Branches: master
https://developer.blender.org/rBa201020cd3048af0a3068e4ba387ee8d16a35c1a

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

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

No functional changes.

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

M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_editor.c
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/editors/space_clip/tracking_ops_orient.c
M	source/blender/editors/space_clip/tracking_ops_plane.c
M	source/blender/editors/space_clip/tracking_ops_track.c

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

diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index fe7ae7096a0..35e0fdbfec3 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -88,7 +88,7 @@ static int generic_track_get_markersnr(MovieTrackingTrack *track,
   if (track) {
     return track->markersnr;
   }
-  else if (plane_track) {
+  if (plane_track) {
     return plane_track->markersnr;
   }
 
@@ -103,7 +103,7 @@ static int generic_track_get_marker_framenr(MovieTrackingTrack *track,
     BLI_assert(marker_index < track->markersnr);
     return track->markers[marker_index].framenr;
   }
-  else if (plane_track) {
+  if (plane_track) {
     BLI_assert(marker_index < plane_track->markersnr);
     return plane_track->markers[marker_index].framenr;
   }
@@ -119,7 +119,7 @@ static bool generic_track_is_marker_enabled(MovieTrackingTrack *track,
     BLI_assert(marker_index < track->markersnr);
     return (track->markers[marker_index].flag & MARKER_DISABLED) == 0;
   }
-  else if (plane_track) {
+  if (plane_track) {
     return true;
   }
 
@@ -134,7 +134,7 @@ static bool generic_track_is_marker_keyframed(MovieTrackingTrack *track,
     BLI_assert(marker_index < track->markersnr);
     return (track->markers[marker_index].flag & MARKER_TRACKED) == 0;
   }
-  else if (plane_track) {
+  if (plane_track) {
     BLI_assert(marker_index < plane_track->markersnr);
     return (plane_track->markers[marker_index].flag & PLANE_MARKER_TRACKED) == 0;
   }
@@ -228,7 +228,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip
           ok = true;
           break;
         }
-        else if (cameras[a].framenr > i) {
+        if (cameras[a].framenr > i) {
           break;
         }
 
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 5be4b2d5df0..f308a11fbfd 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -381,21 +381,20 @@ static bool selected_boundbox(const bContext *C, float min[2], float max[2])
   if (sc->mode == SC_MODE_TRACKING) {
     return selected_tracking_boundbox(sc, min, max);
   }
-  else {
-    if (ED_mask_selected_minmax(C, min, max)) {
-      MovieClip *clip = ED_space_clip_get_clip(sc);
-      int width, height;
-      ED_space_clip_get_size(sc, &width, &height);
-      BKE_mask_coord_to_movieclip(clip, &sc->user, min, min);
-      BKE_mask_coord_to_movieclip(clip, &sc->user, max, max);
-      min[0] *= width;
-      min[1] *= height;
-      max[0] *= width;
-      max[1] *= height;
-      return true;
-    }
-    return false;
+
+  if (ED_mask_selected_minmax(C, min, max)) {
+    MovieClip *clip = ED_space_clip_get_clip(sc);
+    int width, height;
+    ED_space_clip_get_size(sc, &width, &height);
+    BKE_mask_coord_to_movieclip(clip, &sc->user, min, min);
+    BKE_mask_coord_to_movieclip(clip, &sc->user, max, max);
+    min[0] *= width;
+    min[1] *= height;
+    max[0] *= width;
+    max[1] *= height;
+    return true;
   }
+  return false;
 }
 
 bool ED_clip_view_selection(const bContext *C, ARegion *region, bool fit)
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 22707b97afa..a69601316ef 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -463,11 +463,10 @@ static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
     return OPERATOR_FINISHED;
   }
-  else {
-    view_pan_init(C, op, event);
 
-    return OPERATOR_RUNNING_MODAL;
-  }
+  view_pan_init(C, op, event);
+
+  return OPERATOR_RUNNING_MODAL;
 }
 
 static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -633,11 +632,10 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
     return OPERATOR_FINISHED;
   }
-  else {
-    view_zoom_init(C, op, event);
 
-    return OPERATOR_RUNNING_MODAL;
-  }
+  view_zoom_init(C, op, event);
+
+  return OPERATOR_RUNNING_MODAL;
 }
 
 static void view_zoom_apply(
@@ -1253,10 +1251,9 @@ static void do_movie_proxy(void *pjv,
 
     return;
   }
-  else {
-    sfra = 1;
-    efra = clip->len;
-  }
+
+  sfra = 1;
+  efra = clip->len;
 
   if (build_undistort_count) {
     int threads = BLI_system_thread_count();
@@ -1646,27 +1643,26 @@ static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
   if (event->type != NDOF_MOTION) {
     return OPERATOR_CANCELLED;
   }
-  else {
-    SpaceClip *sc = CTX_wm_space_clip(C);
-    ARegion *region = CTX_wm_region(C);
-    float pan_vec[3];
 
-    const wmNDOFMotionData *ndof = event->customdata;
-    const float speed = NDOF_PIXELS_PER_SECOND;
+  SpaceClip *sc = CTX_wm_space_clip(C);
+  ARegion *region = CTX_wm_region(C);
+  float pan_vec[3];
+
+  const wmNDOFMotionData *ndof = event->customdata;
+  const float speed = NDOF_PIXELS_PER_SECOND;
 
-    WM_event_ndof_pan_get(ndof, pan_vec, true);
+  WM_event_ndof_pan_get(ndof, pan_vec, true);
 
-    mul_v2_fl(pan_vec, (speed * ndof->dt) / sc->zoom);
-    pan_vec[2] *= -ndof->dt;
+  mul_v2_fl(pan_vec, (speed * ndof->dt) / sc->zoom);
+  pan_vec[2] *= -ndof->dt;
 
-    sclip_zoom_set_factor(C, 1.0f + pan_vec[2], NULL, false);
-    sc->xof += pan_vec[0];
-    sc->yof += pan_vec[1];
+  sclip_zoom_set_factor(C, 1.0f + pan_vec[2], NULL, false);
+  sc->xof += pan_vec[0];
+  sc->yof += pan_vec[1];
 
-    ED_region_tag_redraw(region);
+  ED_region_tag_redraw(region);
 
-    return OPERATOR_FINISHED;
-  }
+  return OPERATOR_FINISHED;
 }
 
 void CLIP_OT_view_ndof(wmOperatorType *ot)
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 54da00a132d..9c251fb619a 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -585,13 +585,13 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
 
     return true;
   }
-  else if (CTX_data_equals(member, "edit_movieclip")) {
+  if (CTX_data_equals(member, "edit_movieclip")) {
     if (sc->clip) {
       CTX_data_id_pointer_set(result, &sc->clip->id);
     }
     return true;
   }
-  else if (CTX_data_equals(member, "edit_mask")) {
+  if (CTX_data_equals(member, "edit_mask")) {
     if (sc->mask_info.mask) {
       CTX_data_id_pointer_set(result, &sc->mask_info.mask->id);
     }
diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c
index 25e30c116c5..04c335cdf5e 100644
--- a/source/blender/editors/space_clip/tracking_ops_orient.c
+++ b/source/blender/editors/space_clip/tracking_ops_orient.c
@@ -110,9 +110,7 @@ static bool set_orientation_poll(bContext *C)
       if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
         return true;
       }
-      else {
-        return OBACT(view_layer) != NULL;
-      }
+      return OBACT(view_layer) != NULL;
     }
   }
   return false;
diff --git a/source/blender/editors/space_clip/tracking_ops_plane.c b/source/blender/editors/space_clip/tracking_ops_plane.c
index 3c5646911a3..964b59babee 100644
--- a/source/blender/editors/space_clip/tracking_ops_plane.c
+++ b/source/blender/editors/space_clip/tracking_ops_plane.c
@@ -61,18 +61,17 @@ static int create_plane_track_tracks_exec(bContext *C, wmOperator *op)
     BKE_report(op->reports, RPT_ERROR, "Need at least 4 selected point tracks to create a plane");
     return OPERATOR_CANCELLED;
   }
-  else {
-    BKE_tracking_tracks_deselect_all(tracks_base);
 
-    plane_track->flag |= SELECT;
-    clip->tracking.act_track = NULL;
-    clip->tracking.act_plane_track = plane_track;
+  BKE_tracking_tracks_deselect_all(tracks_base);
 
-    /* Compute homoraphies and apply them on marker's corner, so we've got
-     * quite nice motion from the very beginning.
-     */
-    BKE_tracking_track_plane_from_existing_motion(plane_track, framenr);
-  }
+  plane_track->flag |= SELECT;
+  clip->tracking.act_track = NULL;
+  clip->tracking.act_plane_track = plane_track;
+
+  /* Compute homoraphies and apply them on marker's corner, so we've got
+   * quite nice motion from the very beginning.
+   */
+  BKE_tracking_track_plane_from_existing_motion(plane_track, framenr);
 
   DEG_id_tag_update(&clip->id, ID_RECALC_COPY_ON_WRITE);
   WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c
index 05623347366..cec7b371457 100644
--- a/source/blender/editors/space_clip/tracking_ops_track.c
+++ b/source/blender/editors/space_clip/tracking_ops_track.c
@@ -358,14 +358,13 @@ static int track_markers(bContext *C, wmOperator *op, bool use_job)
 
     return OPERATOR_RUNNING_MODAL;
   }
-  else {
-    short stop = 0, do_update = 0;
-    float progress = 0.0f;
-    track_markers_startjob(tmj, &stop, &do_update, &progress);
-    track_markers_endjob(tmj);
-    track_markers_freejob(tmj);
-    return OPERATOR_FINISHED;
-  }
+
+  short stop = 0, do_update = 0;
+  float progress = 0.0f;
+  track_markers_startjob(tmj, &stop, &do_update, &progress);
+  track_markers_endjob(tmj);
+  track_markers_freejob(tmj);
+  return OPERATOR_FINISHED;
 }
 
 static int track_markers_exec(bContext *C, wmOperator *op)



More information about the Bf-blender-cvs mailing list