lib/export/flame_stabilizer.rb in tracksperanto-1.8.4 vs lib/export/flame_stabilizer.rb in tracksperanto-1.9.0
- old
+ new
@@ -52,23 +52,14 @@
end
def export_point(frame, abs_float_x, abs_float_y, float_residual)
flame_frame = frame + 1
if @write_first_frame
- @base_x, @base_y = abs_float_x, abs_float_y
- write_first_frame(abs_float_x, abs_float_y)
- # For Flame to recognize the reference frame of the Shift channel
- # we need it to contain zero as an int, not as a float. The shift proceeds
- # from there.
- @x_shift_values = [[flame_frame, 0]]
- @y_shift_values = [[flame_frame, 0]]
+ export_first_point(flame_frame, abs_float_x, abs_float_y)
@write_first_frame = false
else
- # Just continue buffering the upcoming shift keyframes and flush them in the end
- shift_x, shift_y = @base_x - abs_float_x, @base_y - abs_float_y
- @x_shift_values.push([flame_frame, shift_x])
- @y_shift_values.push([flame_frame, shift_y])
+ export_remaining_point(flame_frame, abs_float_x, abs_float_y)
end
end
def end_tracker_segment
# We write these at tracker end since we need to know in advance
@@ -76,9 +67,26 @@
write_shift_channel("shift/x", @x_shift_values)
write_shift_channel("shift/y", @y_shift_values)
end
private
+
+ def export_remaining_point(flame_frame, abs_float_x, abs_float_y)
+ # Just continue buffering the upcoming shift keyframes and flush them in the end
+ shift_x, shift_y = @base_x - abs_float_x, @base_y - abs_float_y
+ @x_shift_values.push([flame_frame, shift_x])
+ @y_shift_values.push([flame_frame, shift_y])
+ end
+
+ def export_first_point(flame_frame, abs_float_x, abs_float_y)
+ @base_x, @base_y = abs_float_x, abs_float_y
+ write_first_frame(abs_float_x, abs_float_y)
+ # For Flame to recognize the reference frame of the Shift channel
+ # we need it to contain zero as an int, not as a float. The shift proceeds
+ # from there.
+ @x_shift_values = [[flame_frame, 0]]
+ @y_shift_values = [[flame_frame, 0]]
+ end
# The shift channel is what determines how the tracking point moves.
def write_shift_channel(name_without_prefix, values)
@writer.channel(prefix(name_without_prefix)) do | c |
c.extrapolation :constant