Sha256: 2e17edf1d607d9ee57d583d7d466a4572d402b615002b53c9b42929f78fbf3ec

Contents?: true

Size: 1.08 KB

Versions: 36

Compression:

Stored size: 1.08 KB

Contents

# -*- encoding : utf-8 -*-
# Export for 3DE v3 point files. 3DE always starts frames at 1.
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-3.5.9 lib/export/equalizer3.rb
tracksperanto-3.5.8 lib/export/equalizer3.rb
tracksperanto-3.5.7 lib/export/equalizer3.rb
tracksperanto-3.5.6 lib/export/equalizer3.rb
tracksperanto-3.5.5 lib/export/equalizer3.rb
tracksperanto-3.5.4 lib/export/equalizer3.rb
tracksperanto-3.5.2 lib/export/equalizer3.rb
tracksperanto-3.5.1 lib/export/equalizer3.rb
tracksperanto-3.5.0 lib/export/equalizer3.rb
tracksperanto-3.4.1 lib/export/equalizer3.rb
tracksperanto-3.4.0 lib/export/equalizer3.rb
tracksperanto-3.3.13 lib/export/equalizer3.rb
tracksperanto-3.3.12 lib/export/equalizer3.rb
tracksperanto-3.3.11 lib/export/equalizer3.rb
tracksperanto-3.3.10 lib/export/equalizer3.rb
tracksperanto-3.3.9 lib/export/equalizer3.rb
tracksperanto-3.3.8 lib/export/equalizer3.rb
tracksperanto-3.3.7 lib/export/equalizer3.rb
tracksperanto-3.3.6 lib/export/equalizer3.rb
tracksperanto-3.3.0.pre lib/export/equalizer3.rb