Sha256: 78131c07fdd8ae746b8ce2270b38475684e5a1eede3a17be70515162063cadf1

Contents?: true

Size: 994 Bytes

Versions: 6

Compression:

Stored size: 994 Bytes

Contents

class Tracksperanto::Import::Syntheyes < Tracksperanto::Import::Base
  include Tracksperanto::UVCoordinates
  
  def self.human_name
    "Syntheyes 2D tracker paths file"
  end
  
  def stream_parse(io)
    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
        send_tracker(@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
    send_tracker(@last_tracker) if @last_tracker && @last_tracker.any?
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tracksperanto-2.1.1 lib/import/syntheyes.rb
tracksperanto-2.1.0 lib/import/syntheyes.rb
tracksperanto-2.0.2 lib/import/syntheyes.rb
tracksperanto-2.0.1 lib/import/syntheyes.rb
tracksperanto-2.0.0 lib/import/syntheyes.rb
tracksperanto-1.9.9 lib/import/syntheyes.rb