Sha256: 2746b14083ddbc400bd397dbf7d0b1a1f50c9a8fdbabe235cebab1cc908451ea

Contents?: true

Size: 974 Bytes

Versions: 17

Compression:

Stored size: 974 Bytes

Contents

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(width, x)
        e.abs_y = height - convert_from_uv(height, y) # 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

17 entries across 17 versions & 1 rubygems

Version Path
tracksperanto-2.8.6 lib/import/syntheyes.rb
tracksperanto-2.8.5 lib/import/syntheyes.rb
tracksperanto-2.8.4 lib/import/syntheyes.rb
tracksperanto-2.8.2 lib/import/syntheyes.rb
tracksperanto-2.8.1 lib/import/syntheyes.rb
tracksperanto-2.8.0 lib/import/syntheyes.rb
tracksperanto-2.7.0 lib/import/syntheyes.rb
tracksperanto-2.6.3 lib/import/syntheyes.rb
tracksperanto-2.6.2 lib/import/syntheyes.rb
tracksperanto-2.6.1 lib/import/syntheyes.rb
tracksperanto-2.6.0 lib/import/syntheyes.rb
tracksperanto-2.5.0 lib/import/syntheyes.rb
tracksperanto-2.4.1 lib/import/syntheyes.rb
tracksperanto-2.3.3 lib/import/syntheyes.rb
tracksperanto-2.3.2 lib/import/syntheyes.rb
tracksperanto-2.3.1 lib/import/syntheyes.rb
tracksperanto-2.3.0 lib/import/syntheyes.rb