class Tracksperanto::Import::Equalizer4

Imports 3D Equalizer's text files

Constants

KF_PATTERN

Public Class Methods

human_name() click to toggle source
# File lib/import/equalizer4.rb, line 4
def self.human_name
  "3DE v4 point export file"
end

Public Instance Methods

each() { |extract_tracker(io)| ... } click to toggle source
# File lib/import/equalizer4.rb, line 8
def each
  io = Tracksperanto::ExtIO.new(@io)
  num_t = detect_num_of_points(io)
  num_t.times { yield(extract_tracker(io)) }
end

Private Instance Methods

detect_num_of_points(io) click to toggle source
# File lib/import/equalizer4.rb, line 16
def detect_num_of_points(io)
  io.gets_non_empty.to_i
end
extract_tracker(io) click to toggle source
# File lib/import/equalizer4.rb, line 21
def extract_tracker(io)
  t = Tracksperanto::Tracker.new(:name => io.gets.strip)
  
  report_progress("Capturing tracker #{t.name}")
  
  io.gets # Tracker color, internal 3DE repr and 0 is Red
  
  num_of_keyframes = io.gets.to_i
  catch(:__emp) do
    num_of_keyframes.times do
      line = io.gets_non_empty
      throw :__emp unless line
      
      frame, x, y = line.scan(KF_PATTERN).flatten
      report_progress("Capturing keyframe #{frame}")
      t.keyframe!(:frame => (frame.to_i - 1), :abs_x => x, :abs_y => y)
    end
  end
  t
end