Class: Tracksperanto::Export::MayaLive
- Inherits:
-
Base
- Object
- Base
- Tracksperanto::Export::MayaLive
show all
- Defined in:
- lib/export/maya_live.rb
Constant Summary
collapse
- FORMAT_LINE =
"%d %d %.10f %.10f %s"
Instance Attribute Summary collapse
-
#aspect ⇒ Object
Maya Live exports and imports tracks in “aspect units”, so a point at 0,0 will be at -1.78,-1 in MayaLive coordinates with aspect of 1.78.
Attributes inherited from Base
#io
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#end_export, #initialize
Methods included from ConstName
#const_name
#just_export
Instance Attribute Details
#aspect ⇒ Object
Maya Live exports and imports tracks in “aspect units”, so a point at 0,0 will be at -1.78,-1 in MayaLive coordinates with aspect of 1.78. Therefore we offer an override for the aspect being exported
6
7
8
|
# File 'lib/export/maya_live.rb', line 6
def aspect
@aspect
end
|
Class Method Details
.desc_and_extension ⇒ Object
8
9
10
|
# File 'lib/export/maya_live.rb', line 8
def self.desc_and_extension
"mayalive.txt"
end
|
.human_name ⇒ Object
12
13
14
|
# File 'lib/export/maya_live.rb', line 12
def self.human_name
"MayaLive track export"
end
|
Instance Method Details
#end_tracker_segment ⇒ Object
30
31
32
|
# File 'lib/export/maya_live.rb', line 30
def end_tracker_segment
@tracker_number += 1
end
|
#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/export/maya_live.rb', line 36
def export_point(frame, abs_float_x, abs_float_y, float_residual)
values = [
@tracker_number, frame,
aspectize_x(abs_float_x), aspectize_y(abs_float_y),
residual_with_reset(float_residual)
]
@io.puts(FORMAT_LINE % values)
end
|
#start_export(img_width, img_height) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/export/maya_live.rb', line 16
def start_export( img_width, img_height)
@aspect ||= img_width.to_f / img_height
@w, @h = img_width, img_height
first_line = (%w( # Size) + [@w, @h, "%.2f" % @aspect]).join(" ")
@io.puts(first_line)
@tracker_number = 0
end
|
#start_tracker_segment(tracker_name) ⇒ Object
26
27
28
|
# File 'lib/export/maya_live.rb', line 26
def start_tracker_segment(tracker_name)
@io.puts('# Name %s' % tracker_name)
end
|