class Tracksperanto::Export::MayaLocators

Export each tracker as a moving Maya locator

Constants

KEYFRAME_TEMPLATE
LOCATOR_PREAMBLE
MULTIPLIER
PREAMBLE
SCENE_PREAMBLE

Public Class Methods

desc_and_extension() click to toggle source
# File lib/export/maya_locators.rb, line 15
def self.desc_and_extension
  "mayaLocators.ma"
end
human_name() click to toggle source
# File lib/export/maya_locators.rb, line 19
def self.human_name
  "Maya ASCII scene with locators on an image plane"
end

Public Instance Methods

end_export() click to toggle source
# File lib/export/maya_locators.rb, line 46
def end_export
  # Group all the stuff
  @io.puts('select -r %s;' % @group_members.join(' '))
  @io.puts('group -name TracksperantoGroup; xform -os -piv 0 0 0;')
end
export_point(frame, abs_float_x, abs_float_y, float_residual) click to toggle source
# File lib/export/maya_locators.rb, line 41
def export_point(frame, abs_float_x, abs_float_y, float_residual)
  @io.puts(KEYFRAME_TEMPLATE % [frame + 1, abs_float_x * @factor, @locator_name, "tx"])
  @io.puts(KEYFRAME_TEMPLATE % [frame + 1, abs_float_y * @factor, @locator_name, "ty"])
end
start_export(w, h) click to toggle source
# File lib/export/maya_locators.rb, line 23
def start_export(w, h)
  # Pixel sizes are HUGE for maya. What we do is we assume that the width is 1,
  # and scale the height to that
  @factor = (1 / w.to_f) * MULTIPLIER
  
  @io.puts(SCENE_PREAMBLE)
  @io.puts(PREAMBLE % [MULTIPLIER, h * @factor])
  @io.puts('rotate -r -os 90;') # Position it in the XY plane
  @io.puts('move -r %0.5f %0.5f 0;' % [MULTIPLIER / 2.0, h * @factor / 2.0])
  @group_members = ["TracksperantoImagePlane"]
end
start_tracker_segment(tracker_name) click to toggle source
# File lib/export/maya_locators.rb, line 35
def start_tracker_segment(tracker_name)
  @locator_name = tracker_name
  @io.puts(LOCATOR_PREAMBLE % @locator_name)
  @group_members.push(tracker_name)
end