class Tracksperanto::Export::PFTrack4
Export for PFTrack .2dt files
Constants
- KEYFRAME_TEMPLATE
- LINEBREAK
PFtrack wants cross-platform linebreaks
Public Class Methods
desc_and_extension()
click to toggle source
# File lib/export/pftrack.rb, line 11 def self.desc_and_extension "pftrack_v4.2dt" end
human_name()
click to toggle source
# File lib/export/pftrack.rb, line 15 def self.human_name "PFTrack v4 .2dt file" end
Public Instance Methods
end_tracker_segment()
click to toggle source
# File lib/export/pftrack.rb, line 31 def end_tracker_segment 2.times { @io.write(LINEBREAK) } @io.write(@tracker_name.inspect) # autoquotes @io.write(LINEBREAK) @io.write(@frame_count) @io.write(LINEBREAK) @tracker_io.rewind @io.write(@tracker_io.read) until @tracker_io.eof? @tracker_io.close! end
export_point(frame, abs_float_x, abs_float_y, float_residual)
click to toggle source
# File lib/export/pftrack.rb, line 43 def export_point(frame, abs_float_x, abs_float_y, float_residual) @frame_count += 1 line = KEYFRAME_TEMPLATE % [frame, to_pfcoord(abs_float_x), to_pfcoord(abs_float_y), float_residual / 8] @tracker_io.write(line) @tracker_io.write(LINEBREAK) end
start_export(w, h)
click to toggle source
# File lib/export/pftrack.rb, line 19 def start_export(w, h) @width = w @height = h end
start_tracker_segment(tracker_name)
click to toggle source
# File lib/export/pftrack.rb, line 24 def start_tracker_segment(tracker_name) # Setup for the next tracker @frame_count = 0 @tracker_name = tracker_name @tracker_io = Tracksperanto::BufferIO.new end