lib/import/pftrack.rb in tracksperanto-1.8.2 vs lib/import/pftrack.rb in tracksperanto-1.8.4

- old
+ new

@@ -5,19 +5,19 @@ def self.distinct_file_ext ".2dt" end - CHARACTERS = /[AZaz]/ + CHARACTERS_OR_QUOTES = /[AZaz"]/ def parse(io) trackers = [] until io.eof? line = io.gets next if (!line || line =~ /^#/) - if line =~ CHARACTERS # Tracker with a name + if line =~ CHARACTERS_OR_QUOTES # Tracker with a name t = Tracksperanto::Tracker.new{|t| t.name = line.strip.gsub(/"/, '') } report_progress("Reading tracker #{t.name}") parse_tracker(t, io) trackers << t end @@ -28,18 +28,17 @@ private def parse_tracker(t, io) first_tracker_line = io.gets.chomp - if first_tracker_line =~ CHARACTERS # PFTrack version 5 format + if first_tracker_line =~ CHARACTERS_OR_QUOTES # PFTrack version 5 format first_tracker_line = io.gets.chomp end num_of_keyframes = first_tracker_line.to_i t.keyframes = (1..num_of_keyframes).map do | keyframe_idx | report_progress("Reading keyframe #{keyframe_idx} of #{num_of_keyframes} in #{t.name}") - Tracksperanto::Keyframe.new do |k| - k.frame, k.abs_x, k.abs_y, k.residual = io.gets.chomp.split - end + f, x, y, residual = io.gets.chomp.split + Tracksperanto::Keyframe.new(:frame => f, :abs_x => x, :abs_y => y, :residual => residual.to_f * 8) end end end \ No newline at end of file