Sha256: 34d71c3077ac1d918a3e2dd63a66d93fed4fdf538a0f40820760924ea9cdff44

Contents?: true

Size: 771 Bytes

Versions: 8

Compression:

Stored size: 771 Bytes

Contents

class Tracksperanto::Import::ShakeText < Tracksperanto::Import::Base
  
  def self.human_name
    "Shake .txt tracker file"
  end
  
  def parse(io)
    trackers = []
    io.each do | line |
      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

8 entries across 8 versions & 1 rubygems

Version Path
tracksperanto-1.9.8 lib/import/shake_text.rb
tracksperanto-1.9.6 lib/import/shake_text.rb
tracksperanto-1.9.5 lib/import/shake_text.rb
tracksperanto-1.9.4 lib/import/shake_text.rb
tracksperanto-1.9.3 lib/import/shake_text.rb
tracksperanto-1.9.2 lib/import/shake_text.rb
tracksperanto-1.9.1 lib/import/shake_text.rb
tracksperanto-1.9.0 lib/import/shake_text.rb