Sha256: 0f8a38957006da1df245f7e2bb2b9e645a6038028a0ed7f581dce604562b8105

Contents?: true

Size: 786 Bytes

Versions: 37

Compression:

Stored size: 786 Bytes

Contents

class Tracksperanto::Import::ShakeText < Tracksperanto::Import::Base
  
  def self.human_name
    "Shake .txt tracker file"
  end
  
  def parse(io)
    trackers = []
    until io.eof?
      line = io.gets
      if line =~ /TrackName (.+)/
        trackers << Tracksperanto::Tracker.new{|t| t.name = $1 }
        # Toss the next following string - header
        io.gets
      else
        keyframe_values = line.split
        next if keyframe_values.length < 4
        
        trackers[-1].keyframes << Tracksperanto::Keyframe.new do | kf |
          kf.frame = (keyframe_values[0].to_i - 1)
          kf.abs_x = keyframe_values[1]
          kf.abs_y = keyframe_values[2]
          kf.residual = (1 - keyframe_values[3].to_f)
        end
      end
    end
    
    trackers
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
tracksperanto-1.8.4 lib/import/shake_text.rb
tracksperanto-1.8.2 lib/import/shake_text.rb
tracksperanto-1.8.1 lib/import/shake_text.rb
tracksperanto-1.8.0 lib/import/shake_text.rb
tracksperanto-1.7.5 lib/import/shake_text.rb
tracksperanto-1.7.4 lib/import/shake_text.rb
tracksperanto-1.7.3 lib/import/shake_text.rb
tracksperanto-1.7.2 lib/import/shake_text.rb
tracksperanto-1.7.1 lib/import/shake_text.rb
tracksperanto-1.7.0 lib/import/shake_text.rb
tracksperanto-1.6.9 lib/import/shake_text.rb
tracksperanto-1.6.8 lib/import/shake_text.rb
tracksperanto-1.6.7 lib/import/shake_text.rb
tracksperanto-1.6.6 lib/import/shake_text.rb
tracksperanto-1.6.5 lib/import/shake_text.rb
tracksperanto-1.6.4 lib/import/shake_text.rb
tracksperanto-1.6.3 lib/import/shake_text.rb
tracksperanto-1.6.2 lib/import/shake_text.rb
tracksperanto-1.6.1 lib/import/shake_text.rb
tracksperanto-1.6.0 lib/import/shake_text.rb