Sha256: 4ffd0be577c5cefaa935b9431278c38e2c91f6f5e8c8bcf67b637ede6bd52283

Contents?: true

Size: 1.02 KB

Versions: 36

Compression:

Stored size: 1.02 KB

Contents

# Export for 3DE v3 point files
class Tracksperanto::Export::Equalizer3 < Tracksperanto::Export::Base
  
  HEADER = '// 3DE Multiple Tracking Curves Export %d x %d * %d frames'
  
  def self.desc_and_extension
    "3de_v3.txt"
  end
  
  def self.human_name
    "3DE v3 point export .txt file"
  end
  
  def start_export( img_width, img_height)
    @w, @h = img_width, img_height
    # 3DE needs to know the number of keyframes in advance
    @buffer = Tracksperanto::BufferIO.new
    @highest_keyframe = 0
  end
  
  def start_tracker_segment(tracker_name)
    @buffer.puts(tracker_name)
  end
  
  def export_point(frame, abs_float_x, abs_float_y, float_residual)
    off_by_one = frame + 1
    @buffer.puts("\t%d\t%.3f\t%.3f" % [off_by_one, abs_float_x, abs_float_y])
    @highest_keyframe = off_by_one if (@highest_keyframe < off_by_one)
  end
  
  def end_export
    @buffer.rewind
    @io.puts(HEADER % [@w, @h, @highest_keyframe])
    @io.puts(@buffer.read) until @buffer.eof?
    @buffer.close!
    @io.puts("") # Newline at end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
tracksperanto-2.1.1 lib/export/equalizer3.rb
tracksperanto-2.1.0 lib/export/equalizer3.rb
tracksperanto-2.0.2 lib/export/equalizer3.rb
tracksperanto-2.0.1 lib/export/equalizer3.rb
tracksperanto-2.0.0 lib/export/equalizer3.rb
tracksperanto-1.9.9 lib/export/equalizer3.rb
tracksperanto-1.9.8 lib/export/equalizer3.rb
tracksperanto-1.9.6 lib/export/equalizer3.rb
tracksperanto-1.9.5 lib/export/equalizer3.rb
tracksperanto-1.9.4 lib/export/equalizer3.rb
tracksperanto-1.9.3 lib/export/equalizer3.rb
tracksperanto-1.9.2 lib/export/equalizer3.rb
tracksperanto-1.9.1 lib/export/equalizer3.rb
tracksperanto-1.9.0 lib/export/equalizer3.rb
tracksperanto-1.8.4 lib/export/equalizer3.rb
tracksperanto-1.8.2 lib/export/equalizer3.rb