Sha256: 7801551a6fd75f87d88d6fb863473d5ab38ea5e3d6b0bac9db7cf844dcbfa915

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

# -*- encoding : utf-8 -*-
# Export for PFTrack .2dt files
class Tracksperanto::Export::PFTrack4 < Tracksperanto::Export::Base
    
    KEYFRAME_TEMPLATE = "%s %.3f %.3f %.3f"
    
    # PFtrack wants cross-platform linebreaks
    LINEBREAK = "\r\n"
    
    def self.desc_and_extension
      "pftrack_v4.2dt"
    end
    
    def self.human_name
      "PFTrack v4 .2dt file"
    end
    
    def start_tracker_segment(tracker_name)
      # Setup for the next tracker
      @frame_count = 0
      @tracker_name = tracker_name
      @tracker_io = Tracksperanto::BufferIO.new
    end
    
    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
    
    def export_point(frame, abs_float_x, abs_float_y, float_residual)
      @frame_count += 1
      line = KEYFRAME_TEMPLATE % [frame, abs_float_x, abs_float_y, float_residual / 8]
      @tracker_io.write(line)
      @tracker_io.write(LINEBREAK)
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
tracksperanto-2.12.0 lib/export/pftrack.rb
tracksperanto-2.11.3 lib/export/pftrack.rb
tracksperanto-2.11.2 lib/export/pftrack.rb
tracksperanto-2.11.1 lib/export/pftrack.rb
tracksperanto-2.11.0 lib/export/pftrack.rb
tracksperanto-2.10.0 lib/export/pftrack.rb
tracksperanto-2.9.9 lib/export/pftrack.rb
tracksperanto-2.9.8 lib/export/pftrack.rb
tracksperanto-2.9.7 lib/export/pftrack.rb
tracksperanto-2.9.6 lib/export/pftrack.rb
tracksperanto-2.9.5 lib/export/pftrack.rb
tracksperanto-2.9.4 lib/export/pftrack.rb
tracksperanto-2.9.3 lib/export/pftrack.rb
tracksperanto-2.9.2 lib/export/pftrack.rb
tracksperanto-2.9.1 lib/export/pftrack.rb
tracksperanto-2.9.0 lib/export/pftrack.rb