Sha256: a86c929289b2bc5276be60de058cf700a6b17013ebb090513d5c1176e409c469

Contents?: true

Size: 858 Bytes

Versions: 13

Compression:

Stored size: 858 Bytes

Contents

# Import for Shake Text files
class Tracksperanto::Import::ShakeText < Tracksperanto::Import::Base
  
  def self.human_name
    "Shake .txt tracker file"
  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

13 entries across 13 versions & 1 rubygems

Version Path
tracksperanto-2.6.3 lib/import/shake_text.rb
tracksperanto-2.6.2 lib/import/shake_text.rb
tracksperanto-2.6.1 lib/import/shake_text.rb
tracksperanto-2.6.0 lib/import/shake_text.rb
tracksperanto-2.5.0 lib/import/shake_text.rb
tracksperanto-2.4.1 lib/import/shake_text.rb
tracksperanto-2.3.3 lib/import/shake_text.rb
tracksperanto-2.3.2 lib/import/shake_text.rb
tracksperanto-2.3.1 lib/import/shake_text.rb
tracksperanto-2.3.0 lib/import/shake_text.rb
tracksperanto-2.2.4 lib/import/shake_text.rb
tracksperanto-2.2.2 lib/import/shake_text.rb
tracksperanto-2.2.0 lib/import/shake_text.rb