Class: Tracksperanto::Import::Boujou

Inherits:
Base
  • Object
show all
Defined in:
lib/import/boujou.rb

Instance Attribute Summary

Attributes inherited from Base

#height, #io, #progress_block, #width

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

autodetects_size?, distinct_file_ext, inherited, known_snags, #report_progress

Methods included from BlockInit

#initialize

Methods included from ZipTuples

#zip_curve_tuples

Methods included from ConstName

#const_name

Methods included from Safety

#safe_reader

Methods included from Casts

#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string

Class Method Details

.human_nameObject



3
4
5
# File 'lib/import/boujou.rb', line 3

def self.human_name
  "Boujou feature tracks export"
end

Instance Method Details

#each {|@last_tracker| ... } ⇒ Object

Yields:

  • (@last_tracker)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/import/boujou.rb', line 7

def each
  wrapped_io = Tracksperanto::ExtIO.new(@io)
  detect_columns(wrapped_io)
  trackers = {}
  filtering_trackers_from(wrapped_io) do | name, frame, x, y |
    if @last_tracker && (name != @last_tracker.name)
      yield(@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}")
    @last_tracker.keyframe!(:frame => (frame.to_i - 1), :abs_y => (@height.to_f - y.to_f - 1), :abs_x => x)
  end
  
  yield(@last_tracker) if @last_tracker && @last_tracker.any?
end