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

#initialize

Methods included from ConstName

#const_name

Methods included from SimpleExport

#just_export

Constructor Details

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

Class Method Details

.desc_and_extensionObject


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

def self.desc_and_extension
  "tracksperanto_ruby.rb"
end

.human_nameObject


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

def self.human_name
  "Bare Ruby code"
end

Instance Method Details

#end_exportObject


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

def end_export
  @io.puts(" ")
end

#end_tracker_segmentObject


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

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

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


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

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


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

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


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

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