lib/export/pftrack.rb in tracksperanto-1.1.1 vs lib/export/pftrack.rb in tracksperanto-1.2.0

- old
+ new

@@ -1,32 +1,32 @@ -class Tracksperanto::Export::Pftrack < Tracksperanto::Export::Base +# Export for PFTrack .2dt files +class Tracksperanto::Export::PFTrack < Tracksperanto::Export::Base - # Should return the suffix and extension of this export file (like "_flame.stabilizer") + KEYFRAME_TEMPLATE = "%s %.3f %.3f %.3f" + def self.desc_and_extension "pftrack.2dt" end + def self.human_name + "PFTrack .2dt file" + end + def start_tracker_segment(tracker_name) # Setup for the next tracker @prev_tracker = [] @tracker_name = tracker_name end def end_tracker_segment - # If there was a previous tracker, write it out - # - now we know how many keyframes it has - if @prev_tracker && @prev_tracker.any? - block = [ - "\n", - @tracker_name.inspect, # "autoquotes" - @prev_tracker.length, - @prev_tracker.join("\n") - ] - @io.puts block.join("\n") - end + block = [ "\n", + @tracker_name.inspect, # "autoquotes" + @prev_tracker.length, + @prev_tracker.join("\n") ] + @io.puts block.join("\n") end def export_point(frame, abs_float_x, abs_float_y, float_residual) - line = "%s %.3f %.3f %.3f" % [frame, abs_float_x, abs_float_y, float_residual] + line = KEYFRAME_TEMPLATE % [frame, abs_float_x, abs_float_y, float_residual / 8] @prev_tracker << line end end \ No newline at end of file