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

#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



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

def self.desc_and_extension
  "3dsmax_nulls.ms"
end

.human_nameObject



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

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

Instance Method Details

#end_exportObject



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

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



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

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



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

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



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

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



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

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