Class: Tracksperanto::Export::ShakeText

Inherits:
Base
  • Object
show all
Defined in:
lib/export/shake_text.rb

Overview

Export for Shake .txt tracker blobs

Direct Known Subclasses

NukeCameraUsertracks

Constant Summary collapse

PREAMBLE =
"TrackName %s\n   Frame             X             Y   Correlation\n"
POSTAMBLE =
"\n"
TEMPLATE =
"   %.2f   %.3f   %.3f   %.3f"

Instance Attribute Summary

Attributes inherited from Base

#io

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#end_export, #initialize, #start_export

Methods included from ConstName

#const_name

Methods included from SimpleExport

#just_export

Constructor Details

This class inherits a constructor from Tracksperanto::Export::Base

Class Method Details

.desc_and_extensionObject


7
8
9
# File 'lib/export/shake_text.rb', line 7

def self.desc_and_extension
  "shake_trackers.txt"
end

.human_nameObject


11
12
13
# File 'lib/export/shake_text.rb', line 11

def self.human_name
  "Shake trackers in a .txt file"
end

Instance Method Details

#end_tracker_segmentObject


19
20
21
# File 'lib/export/shake_text.rb', line 19

def end_tracker_segment
  @io.puts POSTAMBLE
end

#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object


23
24
25
26
27
# File 'lib/export/shake_text.rb', line 23

def export_point(frame, abs_float_x, abs_float_y, float_residual)
  # Shake starts from frame 1, not 0
  line = TEMPLATE % [frame + 1, abs_float_x, abs_float_y, 1 - float_residual]
  @io.puts line
end

#start_tracker_segment(tracker_name) ⇒ Object


15
16
17
# File 'lib/export/shake_text.rb', line 15

def start_tracker_segment(tracker_name)
  @io.puts PREAMBLE % tracker_name
end