class Tracksperanto::Import::NukeScript::Tracker3
Attributes
trackers[R]
Public Class Methods
new(options)
click to toggle source
# File lib/import/nuke_script.rb, line 44 def initialize(options) @trackers = [] point_channels.each do | point_name | next unless options[point_name] point_channel = options[point_name] curves = extract_curves_from_channel(point_channel) # We must always have 2 anim curves next unless curves.length == 2 full_name = [options["name"], point_name].join('_') tracker = package_tracker(full_name, curves[0], curves[1]) @trackers << tracker end end
Public Instance Methods
extract_curves_from_channel(point_channel)
click to toggle source
# File lib/import/nuke_script.rb, line 71 def extract_curves_from_channel(point_channel) # First element is the :c curly identifier point_channel[1..-1].map do | curve_argument | if curve_argument[1] == "curve" Tickly::Curve.new(curve_argument) else nil end end.compact end
package_tracker(full_name, xcurve, ycurve)
click to toggle source
# File lib/import/nuke_script.rb, line 62 def package_tracker(full_name, xcurve, ycurve) frame_x_and_y = zip_curve_tuples(xcurve, ycurve) Tracksperanto::Tracker.new(:name => full_name) do | t | frame_x_and_y.each do | (f, x, y) | t.keyframe!(:frame => (f -1), :abs_x => x, :abs_y => y) end end end
point_channels()
click to toggle source
# File lib/import/nuke_script.rb, line 82 def point_channels %w( track1 track2 track3 track4 ) end