class Tracksperanto::Export::MayaLive
Constants
- FORMAT_LINE
Attributes
aspect[RW]
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 exported
Public Class Methods
desc_and_extension()
click to toggle source
# File lib/export/maya_live.rb, line 8 def self.desc_and_extension "mayalive.txt" end
human_name()
click to toggle source
# File lib/export/maya_live.rb, line 12 def self.human_name "MayaLive track export" end
Public Instance Methods
end_tracker_segment()
click to toggle source
# File lib/export/maya_live.rb, line 30 def end_tracker_segment @tracker_number += 1 end
export_point(frame, abs_float_x, abs_float_y, float_residual)
click to toggle source
# File lib/export/maya_live.rb, line 36 def export_point(frame, abs_float_x, abs_float_y, float_residual) values = [ @tracker_number, frame, aspectize_x(abs_float_x), aspectize_y(abs_float_y), residual_with_reset(float_residual) ] @io.puts(FORMAT_LINE % values) end
start_export( img_width, img_height)
click to toggle source
# File lib/export/maya_live.rb, line 16 def start_export( img_width, img_height) @aspect ||= img_width.to_f / img_height @w, @h = img_width, img_height first_line = (%w( # Size) + [@w, @h, "%.2f" % @aspect]).join(" ") @io.puts(first_line) @tracker_number = 0 end
start_tracker_segment(tracker_name)
click to toggle source
# File lib/export/maya_live.rb, line 26 def start_tracker_segment(tracker_name) @io.puts('# Name %s' % tracker_name) end
Private Instance Methods
aspectize_x(pix)
click to toggle source
# File lib/export/maya_live.rb, line 47 def aspectize_x(pix) aspectized_pixel = @w.to_f / (@aspect * 2) (pix / aspectized_pixel) - @aspect end
aspectize_y(pix)
click to toggle source
# File lib/export/maya_live.rb, line 52 def aspectize_y(pix) aspectized_pixel = @h.to_f / 2 (pix / aspectized_pixel) - 1 end
residual_with_reset(r)
click to toggle source
# File lib/export/maya_live.rb, line 57 def residual_with_reset(r) "%.10f" % (r/10) end