class Tracksperanto::Export::Maxscript
Export each tracker as a moving 3dsmax null
Constants
- IMAGE_PLANE
- MULTIPLIER
Public Class Methods
desc_and_extension()
click to toggle source
# File lib/export/maxscript.rb, line 7 def self.desc_and_extension "3dsmax_nulls.ms" end
human_name()
click to toggle source
# File lib/export/maxscript.rb, line 11 def self.human_name "Autodesk 3dsmax script for nulls on an image plane" end
Public Instance Methods
end_export()
click to toggle source
# File lib/export/maxscript.rb, line 49 def end_export # Create a Model group and parent all the trackers and the image plane to it @io.puts('animate off') @io.puts('EnableSceneRedraw()') end
end_tracker_segment()
click to toggle source
# File lib/export/maxscript.rb, line 32 def end_tracker_segment # Parent the null to the image plane #@tracker_names.push(@t) @io.puts(')') end
export_point(frame, abs_float_x, abs_float_y, float_residual)
click to toggle source
# File lib/export/maxscript.rb, line 38 def export_point(frame, abs_float_x, abs_float_y, float_residual) coords = get_coordinates(abs_float_x, abs_float_y) coords.unshift @t if !@initalized @io.puts('pt = Point name:"%s" pos:[%0.5f,%0.5f,0.000] size:1.000000 axistripod:off centermarker:on isSelected:on' % coords) @initalized = true end @io.puts('at time %d pt.pos.x = %.5f' % [frame, coords[1]]) @io.puts('at time %d pt.pos.y = %.5f' % [frame, coords[2]]) end
start_export(w, h)
click to toggle source
# File lib/export/maxscript.rb, line 15 def start_export(w, h) # Pixel sizes are HUGE. Hence we downscale @factor = (1 / w.to_f) * MULTIPLIER @true_width, @true_height = w * @factor, h * @factor # Generate a Plane primitive @io.puts(IMAGE_PLANE % [@true_width, @true_height]) end
start_tracker_segment(tracker_name)
click to toggle source
# File lib/export/maxscript.rb, line 25 def start_tracker_segment(tracker_name) @t = tracker_name @initalized = false @io.puts("-- Data for tracker %s" % @t) @io.puts('animate on (') end
Private Instance Methods
get_coordinates(x, y)
click to toggle source
# File lib/export/maxscript.rb, line 57 def get_coordinates(x, y) # Get the coords multiplied by factor, and let the scene origin be the center of the composition [(x * @factor) - (@true_width / 2), y * @factor - (@true_height / 2)] end