Class: Tracksperanto::Import::MayaLive
- Defined in:
- lib/import/maya_live.rb
Constant Summary collapse
- COMMENT =
/^# /
Instance Attribute Summary collapse
-
#aspect ⇒ Object
Maya Live exports and imports tracks in “aspect units”, so a point at 0,0 will be at -1.78,-1 in MayaLive coordinates with aspect of 1.78.
Attributes inherited from Base
#height, #io, #progress_block, #width
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
distinct_file_ext, inherited, #report_progress
Methods included from BlockInit
Methods included from ZipTuples
Methods included from ConstName
Methods included from Safety
Methods included from Casts
#cast_to_float, #cast_to_int, #cast_to_string, included
Instance Attribute Details
#aspect ⇒ Object
Maya Live exports and imports tracks in “aspect units”, so a point at 0,0 will be at -1.78,-1 in MayaLive coordinates with aspect of 1.78. Therefore we offer an override for the aspect being imported (if the pixels are not square)
7 8 9 |
# File 'lib/import/maya_live.rb', line 7 def aspect @aspect end |
Class Method Details
.autodetects_size? ⇒ Boolean
13 14 15 |
# File 'lib/import/maya_live.rb', line 13 def self.autodetects_size? true end |
.human_name ⇒ Object
9 10 11 |
# File 'lib/import/maya_live.rb', line 9 def self.human_name "Maya Live track export file" end |
Instance Method Details
#each {|@last_tracker| ... } ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/import/maya_live.rb', line 19 def each io = Tracksperanto::ExtIO.new(@io) extract_width_height_and_aspect(io.gets_non_empty) while line = io.gets_and_strip if line =~ COMMENT yield(@last_tracker) if @last_tracker @last_tracker = Tracksperanto::Tracker.new(:name => line.gsub(/#{COMMENT} Name(\s+)/, '')) next end tracker_num, frame, x, y, residual = line.split abs_x, abs_y = aspect_values_to_pixels(x, y) @last_tracker.keyframe! :frame => frame, :abs_x => abs_x, :abs_y => abs_y, :residual => set_residual(residual) end yield(@last_tracker) if @last_tracker end |