Sha256: 286255883a9ccd5c339587481c1896364ff8f222b7a44a14b76aeace20c722c4
Contents?: true
Size: 802 Bytes
Versions: 7
Compression:
Stored size: 802 Bytes
Contents
require 'stringio' class Tracksperanto::Import::ShakeText < Tracksperanto::Import::Base def parse(track_file_content) trackers = [] io = StringIO.new(track_file_content) 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
7 entries across 7 versions & 1 rubygems