Sha256: a0adb5c82d0bfe83b7f7bff1dc262a057863d41a83d691afa034dd3403c5b784

Contents?: true

Size: 1002 Bytes

Versions: 22

Compression:

Stored size: 1002 Bytes

Contents

# -*- encoding : utf-8 -*-
class Tracksperanto::Import::Syntheyes < Tracksperanto::Import::Base
  include Tracksperanto::UVCoordinates
  
  def self.human_name
    "Syntheyes 2D tracker paths file"
  end
  
  def each
    @io.each_line do | line |
      name, frame, x, y, frame_status = line.split
      
      # Do we already have this tracker?
      unless @last_tracker && @last_tracker.name == name
        yield(@last_tracker) if @last_tracker
        report_progress("Allocating tracker #{name}")
        @last_tracker = Tracksperanto::Tracker.new{|t| t.name = name }
      end
      
      # Add the keyframe
      k = Tracksperanto::Keyframe.new do |e| 
        e.frame = frame
        e.abs_x = convert_from_uv(x, width)
        e.abs_y = height - convert_from_uv(y, height) # Convert TL to BL
      end
      
      @last_tracker.push(k)
      report_progress("Adding keyframe #{frame} to #{name}")
    end
    
    yield(@last_tracker) if @last_tracker && @last_tracker.any?
    
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
tracksperanto-3.5.5 lib/import/syntheyes.rb
tracksperanto-3.5.4 lib/import/syntheyes.rb
tracksperanto-3.5.2 lib/import/syntheyes.rb
tracksperanto-3.5.1 lib/import/syntheyes.rb
tracksperanto-3.5.0 lib/import/syntheyes.rb
tracksperanto-3.4.1 lib/import/syntheyes.rb
tracksperanto-3.4.0 lib/import/syntheyes.rb
tracksperanto-3.3.13 lib/import/syntheyes.rb
tracksperanto-3.3.12 lib/import/syntheyes.rb
tracksperanto-3.3.11 lib/import/syntheyes.rb
tracksperanto-3.3.10 lib/import/syntheyes.rb
tracksperanto-3.3.9 lib/import/syntheyes.rb
tracksperanto-3.3.8 lib/import/syntheyes.rb
tracksperanto-3.3.7 lib/import/syntheyes.rb
tracksperanto-3.3.6 lib/import/syntheyes.rb
tracksperanto-3.3.0.pre lib/import/syntheyes.rb
tracksperanto-3.2.2 lib/import/syntheyes.rb
tracksperanto-3.2.1 lib/import/syntheyes.rb
tracksperanto-3.2.0 lib/import/syntheyes.rb
tracksperanto-3.1.0 lib/import/syntheyes.rb