Class: Tracksperanto::Import::NukeScript::Tracker4

Inherits:
Tracker3
  • Object
show all
Defined in:
lib/import/nuke_script.rb

Instance Attribute Summary

Attributes inherited from Tracker3

#trackers

Instance Method Summary collapse

Methods inherited from Tracker3

#extract_curves_from_channel, #package_tracker, #point_channels

Methods included from ZipTuples

#zip_curve_tuples

Constructor Details

#initialize(options) ⇒ Tracker4

Returns a new instance of Tracker4.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/import/nuke_script.rb', line 122

def initialize(options)
  
  @name = options["name"]
  @trackers = []
  tracks = options["tracks"]
  
  return unless tracks # For linked Tracker nodes that have no tracks
  
  preamble = tracks[1]
  headers = tracks[2]
  values = tracks[3]
  
  # When this was written, this was the order of the columns in the table:
  # le("e", "name", "track_x", "track_y", "offset_x", "offset_y", "T", "R", "S", "error", 
  #  "error_min", "error_max", "pattern_x", "pattern_y", "pattern_r", "pattern_t", "search_x",
  # "search_y", "search_r", "search_t", "key_track", "key_search_x", "key_search_y", "key_search_r",
  # "key_search_t", "key_track_x", "key_track_y", "key_track_r", "key_track_t", "key_centre_offset_x", "key_centre_offset_y")
  tracker_rows = values[0]
  
  # The 0 element is the :c symbol
  tracker_rows[1..-1].each do | row |
    row_content = row[0]
    
    # For offsets see above
    point_name = row_content[2]
    begin
      x_curve = Tickly::Curve.new(row_content[3])
      y_curve = Tickly::Curve.new(row_content[4])
      full_name = [options["name"], point_name].join('_')
      tracker = package_tracker(full_name, x_curve, y_curve)
      @trackers << tracker
    rescue Tickly::Curve::InvalidCurveError
      # $stderr.puts "Failed to recover a tracker, it probably contained expressions"
    end
  end
end