lib/import/shake_script.rb in tracksperanto-3.3.12 vs lib/import/shake_script.rb in tracksperanto-3.3.13
- old
+ new
@@ -260,18 +260,27 @@
tracker_args[0] = "#{tracker_args[0]}"
collect_tracker(*tracker_args)
end.compact
end
+ # Remove tuples which have more than 2 values, and tuples that
+ # have non-Numeric members
+ def clean_tuples(frame_and_value_tuples)
+ frame_and_value_tuples.reject do | element |
+ element.length > 2
+ end.reject do | element |
+ element.any?{|e| !e.is_a?(Numeric) }
+ end
+ end
+
def collect_stabilizer_tracker(name, x_curve, y_curve)
return unless valid_curves?(x_curve, y_curve)
report_progress("Assembling Stabilizer node tracker #{name}")
- keyframes = zip_curve_tuples(x_curve, y_curve).map do | (frame, x, y) |
+ keyframes = zip_curve_tuples(clean_tuples(x_curve), clean_tuples(y_curve)).map do | (frame, x, y) |
Tracksperanto::Keyframe.new(:frame => frame - 1, :abs_x => x, :abs_y => y)
end
-
Tracksperanto::Tracker.new(:name => name, :keyframes => keyframes)
end
def collect_tracker(name, x_curve, y_curve, corr_curve, *discard)
return unless valid_curves?(x_curve, y_curve)