lib/import/boujou.rb in tracksperanto-1.9.8 vs lib/import/boujou.rb in tracksperanto-1.9.9

- old
+ new

@@ -2,19 +2,28 @@ def self.human_name "Boujou feature tracks export" end - def parse(io) + def stream_parse(io) wrapped_io = Tracksperanto::ExtIO.new(io) detect_columns(wrapped_io) trackers = {} filtering_trackers_from(wrapped_io) do | name, frame, x, y | - trackers[name] ||= Tracksperanto::Tracker.new(:name => name) + if @last_tracker && (name != @last_tracker.name) + send_tracker(@last_tracker) if @last_tracker && @last_tracker.any? + @last_tracker = nil + end + + if !@last_tracker + @last_tracker = Tracksperanto::Tracker.new(:name => name) + end + report_progress("Extracting frame #{frame} of #{name}") - trackers[name].keyframe!(:frame => (frame.to_i - 1), :abs_y => (@height.to_f - y.to_f), :abs_x => x) + @last_tracker.keyframe!(:frame => (frame.to_i - 1), :abs_y => (@height.to_f - y.to_f), :abs_x => x) end - trackers.values.sort{|a,b| a.name <=> b.name } + + send_tracker(@last_tracker) if @last_tracker && @last_tracker.any? end private COMMENT = /^# / \ No newline at end of file