class Tracksperanto::Export::XSI
Export each tracker as a moving Softimage|XSI null
Constants
- IMAGE_PLANE
- MULTIPLIER
Public Class Methods
desc_and_extension()
click to toggle source
# File lib/export/xsi.rb, line 12 def self.desc_and_extension "xsi_nulls.py" end
human_name()
click to toggle source
# File lib/export/xsi.rb, line 16 def self.human_name "Autodesk Softimage nulls Python script" end
Public Instance Methods
end_export()
click to toggle source
# File lib/export/xsi.rb, line 51 def end_export # Create a Model group and parent all the trackers and the image plane to it @io.puts('Application.DeselectAll()') @io.puts('Application.AddToSelection("ImagePlane", "", "")') @tracker_names.each do | tracker_name | @io.puts('Application.AddToSelection("%s", "", "")' % tracker_name) end @io.puts('Application.CreateModel("", "", "", "")') @io.puts('Application.SetValue("Model.Name", "Tracksperanto", "")') end
end_tracker_segment()
click to toggle source
# File lib/export/xsi.rb, line 40 def end_tracker_segment # Parent the null to the image plane @tracker_names.push(@t) end
export_point(frame, abs_float_x, abs_float_y, float_residual)
click to toggle source
# File lib/export/xsi.rb, line 45 def export_point(frame, abs_float_x, abs_float_y, float_residual) coords = get_coordinates(abs_float_x, abs_float_y) @io.puts('Application.Translate("", %0.5f, %0.5f, 0, "siAbsolute", "siView", "siObj", "siXYZ", "", "", "", "", "", "", "", "", "", 0, "")'% coords) @io.puts('Application.SaveKeyOnKeyable("%s", %d, "", "", "", False, "")' % [@t, frame + 1]) end
start_export(w, h)
click to toggle source
# File lib/export/xsi.rb, line 20 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 Grid primitive @io.puts(IMAGE_PLANE % [@true_width, @true_height]) @tracker_names = [] end
start_tracker_segment(tracker_name)
click to toggle source
# File lib/export/xsi.rb, line 30 def start_tracker_segment(tracker_name) @t = tracker_name @io.puts("# Data for tracker %s" % @t) @io.puts 'Application.GetPrim("Null", "", "", "")' @io.puts('Application.SetValue("null.Name", "%s", "")' % @t) # Application.ToggleSelection("Track_Point_02", "", "") # Select the tracker that we will animate @io.puts('Application.SelectObj("%s", "", True)' % @t) end
Private Instance Methods
get_coordinates(x, y)
click to toggle source
# File lib/export/xsi.rb, line 64 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