Class: Tracksperanto::Export::MayaLocators
- Inherits:
-
Base
- Object
- Base
- Tracksperanto::Export::MayaLocators
show all
- Defined in:
- lib/export/maya_locators.rb
Overview
Export each tracker as a moving Maya locator
Constant Summary
collapse
- SCENE_PREAMBLE =
[
'//Maya ASCII 2011 scene',
'//Name: TracksperantoLocators.ma',
'//Codeset: UTF-8',
'requires maya "1.0";'
].join("\n")
- PREAMBLE =
'polyPlane -name "TracksperantoImagePlane" -width %0.5f -height %0.5f;'
- LOCATOR_PREAMBLE =
'spaceLocator -name "%s" -p 0 0 0;'
- KEYFRAME_TEMPLATE =
'setKeyframe -time %d -value %0.5f "%s.%s";'
- MULTIPLIER =
10.0
Instance Attribute Summary
Attributes inherited from Base
#io
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#end_tracker_segment, inherited, #initialize
Methods included from ConstName
#const_name, included
#just_export
Class Method Details
.desc_and_extension ⇒ Object
16
17
18
|
# File 'lib/export/maya_locators.rb', line 16
def self.desc_and_extension
"mayaLocators.ma"
end
|
.human_name ⇒ Object
20
21
22
|
# File 'lib/export/maya_locators.rb', line 20
def self.human_name
"Maya ASCII scene with locators on an image plane"
end
|
Instance Method Details
#end_export ⇒ Object
47
48
49
50
51
|
# File 'lib/export/maya_locators.rb', line 47
def end_export
@io.puts('select -r %s;' % @group_members.join(' '))
@io.puts('group -name TracksperantoGroup; xform -os -piv 0 0 0;')
end
|
#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object
42
43
44
45
|
# File 'lib/export/maya_locators.rb', line 42
def export_point(frame, abs_float_x, abs_float_y, float_residual)
@io.puts(KEYFRAME_TEMPLATE % [frame + 1, abs_float_x * @factor, @locator_name, "tx"])
@io.puts(KEYFRAME_TEMPLATE % [frame + 1, abs_float_y * @factor, @locator_name, "ty"])
end
|
#start_export(w, h) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/export/maya_locators.rb', line 24
def start_export(w, h)
@factor = (1 / w.to_f) * MULTIPLIER
@io.puts(SCENE_PREAMBLE)
@io.puts(PREAMBLE % [MULTIPLIER, h * @factor])
@io.puts('rotate -r -os 90;') @io.puts('move -r %0.5f %0.5f 0;' % [MULTIPLIER / 2.0, h * @factor / 2.0])
@group_members = ["TracksperantoImagePlane"]
end
|
#start_tracker_segment(tracker_name) ⇒ Object
36
37
38
39
40
|
# File 'lib/export/maya_locators.rb', line 36
def start_tracker_segment(tracker_name)
@locator_name = tracker_name
@io.puts(LOCATOR_PREAMBLE % @locator_name)
@group_members.push(tracker_name)
end
|