2D stabilizer: Remove check for markers count in the track
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 17 Aug 2016 08:47:05 +0000 (10:47 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 17 Aug 2016 08:47:05 +0000 (10:47 +0200)
This would be a real disaster if track has no markers, which we should
not masquerade and detect such weird cases as soon as possible.

source/blender/blenkernel/intern/tracking_stabilize.c

index 1d5710997234ff5f293a7b4ac9d3c03cd8b6d74d..c352625789ff4a7ab1917103989db4ddb0f353a0 100644 (file)
@@ -414,21 +414,18 @@ static MovieTrackingMarker *get_closest_marker(StabContext *ctx,
                                                MovieTrackingTrack *track,
                                                int ref_frame)
 {
-       if (track->markersnr > 0) {
-               int next_lower = MINAFRAME;
-               int next_higher = MAXFRAME;
-               int  i = search_closest_marker_index(track, ref_frame);
-               retrieve_next_higher_usable_frame(ctx, track, i, ref_frame, &next_higher);
-               retrieve_next_lower_usable_frame(ctx, track, i, ref_frame, &next_lower);
-
-               if ((next_higher - ref_frame) < (ref_frame - next_lower)) {
-                       return BKE_tracking_marker_get_exact(track, next_higher);
-               }
-               else {
-                       return BKE_tracking_marker_get_exact(track, next_lower);
-               }
+       int next_lower = MINAFRAME;
+       int next_higher = MAXFRAME;
+       int i = search_closest_marker_index(track, ref_frame);
+       retrieve_next_higher_usable_frame(ctx, track, i, ref_frame, &next_higher);
+       retrieve_next_lower_usable_frame(ctx, track, i, ref_frame, &next_lower);
+
+       if ((next_higher - ref_frame) < (ref_frame - next_lower)) {
+               return BKE_tracking_marker_get_exact(track, next_higher);
+       }
+       else {
+               return BKE_tracking_marker_get_exact(track, next_lower);
        }
-       return NULL;
 }