Class: Tracksperanto::Import::NukeScript::Tracker3
- Inherits:
-
Object
- Object
- Tracksperanto::Import::NukeScript::Tracker3
- Includes:
- ZipTuples
- Defined in:
- lib/import/nuke_script.rb
Direct Known Subclasses
CornerPin2D, PlanarTracker1_0, Reconcile3D, Tracker4, Transform
Instance Attribute Summary collapse
-
#trackers ⇒ Object
readonly
Returns the value of attribute trackers.
Instance Method Summary collapse
- #extract_curves_from_channel(point_channel) ⇒ Object
-
#initialize(options) ⇒ Tracker3
constructor
A new instance of Tracker3.
- #package_tracker(full_name, xcurve, ycurve) ⇒ Object
- #point_channels ⇒ Object
Methods included from ZipTuples
Constructor Details
#initialize(options) ⇒ Tracker3
Returns a new instance of Tracker3.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/import/nuke_script.rb', line 44 def initialize() @trackers = [] point_channels.each do | point_name | next unless [point_name] point_channel = [point_name] curves = extract_curves_from_channel(point_channel) # We must always have 2 anim curves next unless curves.length == 2 full_name = [["name"], point_name].join('_') tracker = package_tracker(full_name, curves[0], curves[1]) @trackers << tracker end end |
Instance Attribute Details
#trackers ⇒ Object (readonly)
Returns the value of attribute trackers.
42 43 44 |
# File 'lib/import/nuke_script.rb', line 42 def trackers @trackers end |
Instance Method Details
#extract_curves_from_channel(point_channel) ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# 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) ⇒ Object
62 63 64 65 66 67 68 69 |
# 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 ⇒ Object
82 83 84 |
# File 'lib/import/nuke_script.rb', line 82 def point_channels %w( track1 track2 track3 track4 ) end |