Sha256: 3b99e358e2042aa4c0f62fbe7c946bddc2ea2b1c9b7eed0d5266e15dff4e74b0

Contents?: true

Size: 927 Bytes

Versions: 42

Compression:

Stored size: 927 Bytes

Contents

# -*- encoding : utf-8 -*-
# Import for Shake Text files
class Tracksperanto::Import::ShakeText < Tracksperanto::Import::Base
  
  def self.human_name
    "Shake .txt tracker file and Nuke CameraTracker auto tracks export"
  end
  
  def each
    @io.each do | line |
      if line =~ /TrackName (.+)/
        yield(@last_tracker) if @last_tracker && @last_tracker.any?
        @last_tracker = Tracksperanto::Tracker.new(:name => $1)
        # Toss the next following string - header
        io.gets
      else
        keyframe_values = line.split
        next if keyframe_values.length < 4
        
        @last_tracker.keyframe!(
          :frame => (keyframe_values[0].to_i - 1),
          :abs_x => keyframe_values[1],
          :abs_y => keyframe_values[2],
          :residual => (1 - keyframe_values[3].to_f)
        )
      end
    end
    
    yield(@last_tracker) if @last_tracker && @last_tracker.any?
  end
  
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
tracksperanto-3.5.9 lib/import/shake_text.rb
tracksperanto-3.5.8 lib/import/shake_text.rb
tracksperanto-3.5.7 lib/import/shake_text.rb
tracksperanto-3.5.6 lib/import/shake_text.rb
tracksperanto-3.5.5 lib/import/shake_text.rb
tracksperanto-3.5.4 lib/import/shake_text.rb
tracksperanto-3.5.2 lib/import/shake_text.rb
tracksperanto-3.5.1 lib/import/shake_text.rb
tracksperanto-3.5.0 lib/import/shake_text.rb
tracksperanto-3.4.1 lib/import/shake_text.rb
tracksperanto-3.4.0 lib/import/shake_text.rb
tracksperanto-3.3.13 lib/import/shake_text.rb
tracksperanto-3.3.12 lib/import/shake_text.rb
tracksperanto-3.3.11 lib/import/shake_text.rb
tracksperanto-3.3.10 lib/import/shake_text.rb
tracksperanto-3.3.9 lib/import/shake_text.rb
tracksperanto-3.3.8 lib/import/shake_text.rb
tracksperanto-3.3.7 lib/import/shake_text.rb
tracksperanto-3.3.6 lib/import/shake_text.rb
tracksperanto-3.3.0.pre lib/import/shake_text.rb