class Tracksperanto::Import::SyntheyesAllTrackerPaths

Constants

CHARACTERS_OR_QUOTES
TRACKER_KEYFRAME

Public Class Methods

human_name() click to toggle source
# File lib/import/syntheyes_all_tracker_paths.rb, line 2
def self.human_name
  "Syntheyes \"All Tracker Paths\" export .txt file"
end
known_snags() click to toggle source
# File lib/import/syntheyes_all_tracker_paths.rb, line 9
def self.known_snags
  "Syntheyes has two formats for exporting tracks. One is called \"Tracker 2-D paths\" in the menu. " +
  "The other is called \"All Tracker Paths\". You told Tracksperanto to treat your file as " +
  "\"All Tracker Paths\", if something goes wrong might be a good idea to try the other Tracksperanto input format"
end

Public Instance Methods

each() { |t| ... } click to toggle source
# File lib/import/syntheyes_all_tracker_paths.rb, line 16
def each
  t = Tracksperanto::Tracker.new
  while line = @io.gets do
    if line =~ CHARACTERS_OR_QUOTES
      t = Tracksperanto::Tracker.new(:name => line)
      fill_tracker(t, @io)
      yield(t)
    end
  end
end

Private Instance Methods

fill_tracker(t, io) click to toggle source
# File lib/import/syntheyes_all_tracker_paths.rb, line 29
def fill_tracker(t, io)
  loop do
    prev_pos = io.pos
    line = io.gets
    if line =~ TRACKER_KEYFRAME
      parts = line.scan(TRACKER_KEYFRAME).flatten
      t.keyframe!(:frame => parts[0], :abs_x => parts[1], :abs_y => parts[2])
    else
      # Backtrack to where we started the line and return control
      io.pos = prev_pos
      return
    end
  end
end