Class: Tracksperanto::Export::Ruby

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

Overview

Exports the trackers to a script that is fit for massaging with Tracksperanto as is

Instance Attribute Summary

Attributes inherited from Base

#io

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Methods included from ConstName

#const_name, included

Methods included from SimpleExport

#just_export

Constructor Details

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

Class Method Details

.desc_and_extensionObject



5
6
7
# File 'lib/export/ruby.rb', line 5

def self.desc_and_extension
  "tracksperanto_ruby.rb"
end

.human_nameObject



9
10
11
# File 'lib/export/ruby.rb', line 9

def self.human_name
  "Bare Ruby code"
end

Instance Method Details

#end_exportObject



35
36
37
# File 'lib/export/ruby.rb', line 35

def end_export
  @io.puts(" ")
end

#end_tracker_segmentObject



31
32
33
# File 'lib/export/ruby.rb', line 31

def end_tracker_segment
  @io.puts(@tracker.to_ruby)# Just leave that
end

#export_point(f, x, y, r) ⇒ Object



27
28
29
# File 'lib/export/ruby.rb', line 27

def export_point(f, x, y, r)
  @tracker.keyframe! :frame => f, :abs_x => x, :abs_y => y, :residual => r
end

#start_export(w, h) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/export/ruby.rb', line 13

def start_export(w,h)
  @io.puts "require 'rubygems'"
  @io.puts "require 'tracksperanto'"
  @io.puts("width = %d" % w)
  @io.puts("height = %d" % h)
  @io.puts("trackers = []")
end

#start_tracker_segment(name) ⇒ Object



21
22
23
24
25
# File 'lib/export/ruby.rb', line 21

def start_tracker_segment(name)
  @io.puts(" ")
  @io.write("trackers << ")
  @tracker = Tracksperanto::Tracker.new(:name => name)
end