lib/import/shake_script.rb in tracksperanto-1.9.5 vs lib/import/shake_script.rb in tracksperanto-1.9.6
- old
+ new
@@ -15,37 +15,37 @@
class Traxtractor < Tracksperanto::ShakeGrammar::Catcher
include Tracksperanto::ZipTuples
# Normally, we wouldn't need to look for the variable name from inside of the funcall. However,
# in this case we DO want to take this shortcut so we know how the tracker node is called
- def push(atom)
- return super unless (atom.is_a?(Array) && atom[0] == :assign)
- return super unless (atom[2][0] == :retval)
- return super unless (atom[2][1].is_a?(Array))
- return super unless (atom[2][1][0].is_a?(Tracksperanto::Tracker))
-
- node_name = atom[1]
- atom[2][1].map do | tracker |
- tracker.name = [node_name, tracker.name].join("_")
- sentinel[0].push(tracker)
- end
- end
+ def push(atom)
+ return super unless (atom.is_a?(Array)) &&
+ (atom[0] == :assign) &&
+ (atom[2][0] == :retval) &&
+ (atom[2][1][0] == :trk)
+ node_name = atom[1][-1]
+ trackers = atom[2][1][1..-1]
+ trackers.map do | tracker |
+ tracker.name = [node_name, tracker.name].join("_")
+ sentinel[0].push(tracker)
+ end
+ end
# For Linear() curve calls. If someone selected JSpline or Hermite it's his problem.
# We put the frame number at the beginning since it works witih oru tuple zipper
- def linear(first_arg, *keyframes)
+ def linear(extrapolation_type, *keyframes)
report_progress("Translating Linear animation")
keyframes.map { |kf| [kf.at, kf.value] }
end
alias_method :nspline, :linear
alias_method :jspline, :linear
# Hermite interpolation looks like this
# Hermite(0,[1379.04,-0.02,-0.02]@1,[1379.04,-0.03,-0.03]@2)
# The first value in the array is the keyframe value, the other two are
# tangent positions (which we discard)
- def hermite(initial_value, *keyframes)
+ def hermite(extrapolation_type, *keyframes)
report_progress("Translating Hermite curve, removing tangents")
keyframes.map{ |kf| [kf.at, kf.value[0]] }
end
# image Tracker(
@@ -60,15 +60,20 @@
# int limitProcessing,
# float referencFrame
# ...
# );
def tracker(input, trackRange, subPixelRes, matchSpace,
- referenceTolerance, referenceBehavior, failureTolerance, failureBehavior, limitProcessing, referencFrame, s1, s2,
- s3, s4, s5, s6, *trackers)
+ referenceTolerance, referenceBehavior, failureTolerance, failureBehavior, limitProcessing, referencFrame,
+ s1, s2, s3, s4, s5, s6, *trackers)
+ flat_tracks = if (s1 == "v2.0") # The Shake version stupid Winfucks users didn't get
+ trackers
+ else
+ [s1, s2, s3, s4, s4, s6] + trackers
+ end
report_progress("Parsing Tracker node")
- collect_trackers_from(trackers)
+ collect_trackers_from(flat_tracks).unshift(:trk)
end
# stabilize {
# image In,
# int applyTransform,
@@ -110,11 +115,11 @@
[
collect_stabilizer_tracker("track1", track1X, track1Y),
collect_stabilizer_tracker("track2", track2X, track2Y),
collect_stabilizer_tracker("track3", track3X, track3Y),
collect_stabilizer_tracker("track4", track4X, track4Y),
- ].compact
+ ].compact.unshift(:trk)
end
# image = MatchMove(
# Background,
# Foreground,
@@ -177,10 +182,10 @@
[
collect_stabilizer_tracker("track1", track1X, track1Y),
collect_stabilizer_tracker("track2", track2X, track2Y),
collect_stabilizer_tracker("track3", track3X, track3Y),
collect_stabilizer_tracker("track4", track4X, track4Y),
- ].compact
+ ].compact.unshift(:trk)
end
private
def report_progress(with_message)
\ No newline at end of file