Class: Tracksperanto::Export::Maxscript

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

Overview

Export each tracker as a moving 3dsmax null

Constant Summary collapse

MULTIPLIER =
10.0
IMAGE_PLANE =
'new_plane = convertToPoly (plane width:%0.5f length:%0.5f lengthsegs:1 widthsegs:1 name:"TracksperantoPlane" backFaceCull:True)'

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



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

def self.desc_and_extension
  "3dsmax_nulls.ms"
end

.human_nameObject



12
13
14
# File 'lib/export/maxscript.rb', line 12

def self.human_name
  "Autodesk 3dsmax script for nulls on an image plane"
end

Instance Method Details

#end_exportObject



50
51
52
53
54
# File 'lib/export/maxscript.rb', line 50

def end_export
  # Create a Model group and parent all the trackers and the image plane to it
  @io.puts('animate off')
  @io.puts('EnableSceneRedraw()')
end

#end_tracker_segmentObject



33
34
35
36
37
# File 'lib/export/maxscript.rb', line 33

def end_tracker_segment
  # Parent the null to the image plane
  #@tracker_names.push(@t)
  @io.puts(')')
end

#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/export/maxscript.rb', line 39

def export_point(frame, abs_float_x, abs_float_y, float_residual)
  coords = get_coordinates(abs_float_x, abs_float_y)
  coords.unshift @t
  if !@initalized
    @io.puts('pt = Point name:"%s" pos:[%0.5f,%0.5f,0.000] size:1.000000 axistripod:off centermarker:on isSelected:on' % coords)
    @initalized = true
  end
  @io.puts('at time %d pt.pos.x = %.5f' % [frame, coords[1]])
  @io.puts('at time %d pt.pos.y = %.5f' % [frame, coords[2]])
end

#start_export(w, h) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/export/maxscript.rb', line 16

def start_export(w, h)
  # Pixel sizes are HUGE. Hence we downscale
  @factor = (1 / w.to_f) * MULTIPLIER
  @true_width, @true_height = w * @factor, h * @factor
  
  # Generate a Plane primitive
  @io.puts(IMAGE_PLANE % [@true_width, @true_height])

end

#start_tracker_segment(tracker_name) ⇒ Object



26
27
28
29
30
31
# File 'lib/export/maxscript.rb', line 26

def start_tracker_segment(tracker_name)
  @t = tracker_name
  @initalized = false
  @io.puts("-- Data for tracker %s" % @t)
  @io.puts('animate on (')
end