Class: Tracksperanto::Export::AE
- Inherits:
-
Base
- Object
- Base
- Tracksperanto::Export::AE
show all
- Defined in:
- lib/export/cosa.rb
Overview
Exports trackers as an AfterEffects script creating nulls
Constant Summary
collapse
- PREAMBLE =
'// Run this script from the Script Editor
function convertFrameToSeconds(layerWithFootage, frameValue)
{
var comp = layerWithFootage.containingComp;
var rate = 1.0 / comp.frameDuration;
// Frames in AE are 0-based by default
return (frameValue) / rate;
}
var activeComp = app.project.activeItem;
if(!activeComp) {
// Totally fail
alert("You need to be focused on a comp for the tracker creation to work");
} else {'
Instance Attribute Summary
Attributes inherited from Base
#io
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Methods included from ConstName
#const_name
#just_export
Class Method Details
.desc_and_extension ⇒ Object
19
20
21
|
# File 'lib/export/cosa.rb', line 19
def self.desc_and_extension
"createNulls.jsx"
end
|
.human_name ⇒ Object
23
24
25
|
# File 'lib/export/cosa.rb', line 23
def self.human_name
"AfterEffects .jsx script generating null layers"
end
|
Instance Method Details
#end_export ⇒ Object
50
51
52
|
# File 'lib/export/cosa.rb', line 50
def end_export
@io.puts('}') end
|
#end_tracker_segment ⇒ Object
46
47
48
|
# File 'lib/export/cosa.rb', line 46
def end_tracker_segment
@count += 1
end
|
#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object
42
43
44
|
# File 'lib/export/cosa.rb', line 42
def export_point(frame, abs_float_x, abs_float_y, float_residual)
@io.puts('pos.setValueAtTime(convertFrameToSeconds(layer%d, %d), [%0.5f,%0.5f]);' % [@count, frame, abs_float_x, @height - abs_float_y])
end
|
#start_export(w, h) ⇒ Object
27
28
29
30
31
32
|
# File 'lib/export/cosa.rb', line 27
def start_export(w, h)
@io.puts(PREAMBLE)
@io.puts("")
@count = 0
@height = h
end
|
#start_tracker_segment(tracker_name) ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/export/cosa.rb', line 34
def start_tracker_segment(tracker_name)
@io.puts("")
@io.puts('var layer%d = activeComp.layers.addNull();' % @count)
@io.puts( 'layer%d.name = %s;' % [@count, tracker_name.inspect])
@io.puts("")
@io.puts('var pos = layer%d.property("Transform").property("Position");' % @count)
end
|