lib/middleware/lint.rb in tracksperanto-2.7.0 vs lib/middleware/lint.rb in tracksperanto-2.8.0

- old
+ new

@@ -4,10 +4,20 @@ def message "There were no trackers exported" end end + class NonSequentialKeyframes < RuntimeError + def initialize(args) + @name, @last_frame, @current_frame = args + end + + def message + "A keyframe for #{@name} has been sent that comes before the previous keyframe (#{@current_frame} should NOT come after #{@last_frame})." + end + end + class EmptyTrackerSentError < RuntimeError def initialize(name) @name = name end @@ -37,14 +47,17 @@ raise TrackerRestartedError.new(name) if @in_tracker @in_tracker = true @last_tracker_name = name @keyframes = 0 + @last_frame = 0 super end - def export_point(*a) + def export_point(frame, abs_float_x, abs_float_y, float_residual) @keyframes += 1 + raise NonSequentialKeyframes, [@last_tracker_name, @last_frame, frame] if @last_frame > frame + @last_frame = frame super end def end_tracker_segment raise EmptyTrackerSentError.new(@last_tracker_name) if @keyframes.zero? \ No newline at end of file