Class: Tracksperanto::Export::PFTrack4
- Inherits:
-
Base
- Object
- Base
- Tracksperanto::Export::PFTrack4
show all
- Includes:
- PFCoords
- Defined in:
- lib/export/pftrack.rb
Overview
Export for PFTrack .2dt files
Constant Summary
collapse
- KEYFRAME_TEMPLATE =
"%s %.3f %.3f %.3f"
- LINEBREAK =
PFtrack wants cross-platform linebreaks
"\r\n"
Instance Attribute Summary
Attributes inherited from Base
#io
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from PFCoords
#from_pfcoord, #to_pfcoord
Methods inherited from Base
#end_export, #initialize
Methods included from ConstName
#const_name
#just_export
Class Method Details
.desc_and_extension ⇒ Object
11
12
13
|
# File 'lib/export/pftrack.rb', line 11
def self.desc_and_extension
"pftrack_v4.2dt"
end
|
.human_name ⇒ Object
15
16
17
|
# File 'lib/export/pftrack.rb', line 15
def self.human_name
"PFTrack v4 .2dt file"
end
|
Instance Method Details
#end_tracker_segment ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/export/pftrack.rb', line 31
def end_tracker_segment
2.times { @io.write(LINEBREAK) }
@io.write(@tracker_name.inspect) @io.write(LINEBREAK)
@io.write(@frame_count)
@io.write(LINEBREAK)
@tracker_io.rewind
@io.write(@tracker_io.read) until @tracker_io.eof?
@tracker_io.close!
end
|
#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object
43
44
45
46
47
48
|
# File 'lib/export/pftrack.rb', line 43
def export_point(frame, abs_float_x, abs_float_y, float_residual)
@frame_count += 1
line = KEYFRAME_TEMPLATE % [frame, to_pfcoord(abs_float_x), to_pfcoord(abs_float_y), float_residual / 8]
@tracker_io.write(line)
@tracker_io.write(LINEBREAK)
end
|
#start_export(w, h) ⇒ Object
19
20
21
22
|
# File 'lib/export/pftrack.rb', line 19
def start_export(w, h)
@width = w
@height = h
end
|
#start_tracker_segment(tracker_name) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/export/pftrack.rb', line 24
def start_tracker_segment(tracker_name)
@frame_count = 0
@tracker_name = tracker_name
@tracker_io = Tracksperanto::BufferIO.new
end
|