tracksperanto 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +7 -0
- data/Manifest.txt +4 -0
- data/bin/tracksperanto +4 -1
- data/lib/export/nuke_script.rb +24 -7
- data/lib/import/shake_grammar/lexer.rb +16 -4
- data/lib/middleware/lerp.rb +62 -0
- data/lib/pipeline/base.rb +2 -1
- data/lib/tracksperanto.rb +1 -1
- data/test/export/samples/ref_NukeScript.nk +5 -0
- data/test/export/test_nuke_export.rb +24 -1
- data/test/import/samples/syntheyes_2d_paths/one_tracker.txt +49 -0
- data/test/import/test_shake_lexer.rb +15 -1
- data/test/import/test_shake_script_import.rb +2 -2
- data/test/import/test_syntheyes_import.rb +11 -0
- data/test/middleware/test_lerp_middleware.rb +42 -0
- metadata +7 -2
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 1.7.2 / 2010-01-31
|
2
|
+
|
3
|
+
* Add a Lerp middleware that linearly interpolates missing keyframes (USE CAREFULLY!)
|
4
|
+
* Prevent the Shake lexer from walking into the woods on files that are certainly wrong
|
5
|
+
* Export proper project length with Nuke scripts
|
6
|
+
* Ensure preamble for Nuke exports does not get overriden in width/height
|
7
|
+
|
1
8
|
=== 1.7.1 / 2010-01-24
|
2
9
|
|
3
10
|
* Fix Ruby 1.9 compatibility
|
data/Manifest.txt
CHANGED
@@ -31,6 +31,7 @@ lib/import/shake_text.rb
|
|
31
31
|
lib/import/syntheyes.rb
|
32
32
|
lib/middleware/base.rb
|
33
33
|
lib/middleware/golden.rb
|
34
|
+
lib/middleware/lerp.rb
|
34
35
|
lib/middleware/prefix.rb
|
35
36
|
lib/middleware/reformat.rb
|
36
37
|
lib/middleware/scaler.rb
|
@@ -100,6 +101,7 @@ test/import/samples/shake_text/one_shake_tracker_from_first.txt
|
|
100
101
|
test/import/samples/shake_text/two_shake_trackers.txt
|
101
102
|
test/import/samples/syntheyes_2d_paths/cola_plate.txt
|
102
103
|
test/import/samples/syntheyes_2d_paths/flyover2DP_syntheyes.txt
|
104
|
+
test/import/samples/syntheyes_2d_paths/one_tracker.txt
|
103
105
|
test/import/samples/syntheyes_2d_paths/shake_tracker_nodes_to_syntheyes.txt
|
104
106
|
test/import/test_3de_import.rb
|
105
107
|
test/import/test_3de_import3.rb
|
@@ -115,6 +117,7 @@ test/import/test_shake_script_import.rb
|
|
115
117
|
test/import/test_shake_text_import.rb
|
116
118
|
test/import/test_syntheyes_import.rb
|
117
119
|
test/middleware/test_golden_middleware.rb
|
120
|
+
test/middleware/test_lerp_middleware.rb
|
118
121
|
test/middleware/test_prefix.rb
|
119
122
|
test/middleware/test_reformat_middleware.rb
|
120
123
|
test/middleware/test_scaler_middleware.rb
|
@@ -126,3 +129,4 @@ test/test_format_detector.rb
|
|
126
129
|
test/test_keyframe.rb
|
127
130
|
test/test_simple_export.rb
|
128
131
|
test/test_tracker.rb
|
132
|
+
test/test_tracksperanto.rb
|
data/bin/tracksperanto
CHANGED
@@ -27,6 +27,7 @@ x_shift = 0
|
|
27
27
|
y_shift = 0
|
28
28
|
set_prefix = ''
|
29
29
|
sole_format = nil
|
30
|
+
lerp = false
|
30
31
|
reader_name = "ShakeScript"
|
31
32
|
readers = Tracksperanto.importer_names
|
32
33
|
writers = Tracksperanto.exporter_names
|
@@ -60,6 +61,7 @@ parser = OptionParser.new do | p |
|
|
60
61
|
}
|
61
62
|
p.on(" -xm", "--xshift X_IN_PIXELS", Float, "Move the points left or right") {|sx| x_shift = sx }
|
62
63
|
p.on(" -ym", "--yshift Y_IN_PIXELS", Float, "Move the points up or down") {|sx| y_shift = sx }
|
64
|
+
p.on("--lerp", "Linearly interpolate missing keyframes") {|v| lerp = true }
|
63
65
|
p.on("--version", "Show the version and exit") {|v|
|
64
66
|
puts "#{Tracksperanto::VERSION} running on Ruby #{RUBY_VERSION} on #{RUBY_PLATFORM}"
|
65
67
|
puts "Copyright 2008-#{Time.now.year} by Guerilla-DI (Julik Tarkhanov and contributors)"
|
@@ -118,7 +120,7 @@ if sole_format
|
|
118
120
|
end
|
119
121
|
end
|
120
122
|
|
121
|
-
pipe.run(input_file, :pix_w => width, :pix_h => height, :parser => reader_klass) do | scaler, slipper, golden, reformat, shift, prefix |
|
123
|
+
pipe.run(input_file, :pix_w => width, :pix_h => height, :parser => reader_klass) do | scaler, slipper, golden, reformat, shift, prefix, lerpm |
|
122
124
|
slipper.slip = slip
|
123
125
|
scaler.x_factor = scale_x
|
124
126
|
scaler.y_factor = scale_y
|
@@ -128,5 +130,6 @@ pipe.run(input_file, :pix_w => width, :pix_h => height, :parser => reader_klass)
|
|
128
130
|
shift.x_shift = x_shift
|
129
131
|
shift.y_shift = y_shift
|
130
132
|
prefix.prefix = set_prefix
|
133
|
+
lerpm.enabled = lerp
|
131
134
|
end
|
132
135
|
STDOUT.puts("\rConverted #{pipe.converted_points} trackers with #{pipe.converted_keyframes} keys")
|
data/lib/export/nuke_script.rb
CHANGED
@@ -11,11 +11,16 @@ Tracker3 {
|
|
11
11
|
KEYFRAME_PRECISION_TEMPLATE = "%.4f"
|
12
12
|
PREAMBLE = %[
|
13
13
|
version 5.1200
|
14
|
+
Root {
|
15
|
+
inputs 0
|
16
|
+
frame 1
|
17
|
+
last_frame %d
|
18
|
+
}
|
14
19
|
Constant {
|
15
20
|
inputs 0
|
16
21
|
channels rgb
|
17
|
-
format "
|
18
|
-
name
|
22
|
+
format "%d %d 0 0 %d %d 1"
|
23
|
+
name CompSize_%dx%d
|
19
24
|
postage_stamp false
|
20
25
|
xpos 0
|
21
26
|
ypos -60
|
@@ -35,19 +40,22 @@ Constant {
|
|
35
40
|
end
|
36
41
|
|
37
42
|
def start_export(w, h)
|
38
|
-
@
|
39
|
-
|
43
|
+
@max_frame, @ypos, @w, @h = 0, 0, w, h
|
44
|
+
# At the start of the file we need to provide the length of the script.
|
45
|
+
# We allocate an IO for the file being output that will contain all the trackers,
|
46
|
+
# and then write that one into the script preceded by the preamble that sets length
|
47
|
+
# based on the last frame position in time
|
48
|
+
@trackers_io = Tempfile.new("nukex")
|
40
49
|
end
|
41
50
|
|
42
51
|
# We accumulate a tracker and on end dump it out in one piece
|
43
52
|
def start_tracker_segment(tracker_name)
|
44
53
|
# Setup for the next tracker
|
45
|
-
@tracker = T.new
|
46
|
-
@tracker.name = tracker_name
|
54
|
+
@tracker = T.new(:name => tracker_name)
|
47
55
|
end
|
48
56
|
|
49
57
|
def end_tracker_segment
|
50
|
-
@
|
58
|
+
@trackers_io.puts(
|
51
59
|
NODE_TEMPLATE % [curves_from_tuples(@tracker), @tracker.name, (@ypos += SCHEMATIC_OFFSET)]
|
52
60
|
)
|
53
61
|
end
|
@@ -55,6 +63,15 @@ Constant {
|
|
55
63
|
def export_point(frame, abs_float_x, abs_float_y, float_residual)
|
56
64
|
# Nuke uses 1-based frames
|
57
65
|
@tracker << [frame + 1, abs_float_x, abs_float_y]
|
66
|
+
@max_frame = frame if frame > @max_frame
|
67
|
+
end
|
68
|
+
|
69
|
+
def end_export
|
70
|
+
@trackers_io.rewind
|
71
|
+
preamble_values = [@max_frame + 1, @w, @h, @w, @h, @w, @h]
|
72
|
+
@io.puts(PREAMBLE % preamble_values)
|
73
|
+
@io.write(@trackers_io.read) until @trackers_io.eof?
|
74
|
+
@trackers_io.close!
|
58
75
|
end
|
59
76
|
|
60
77
|
private
|
@@ -1,4 +1,6 @@
|
|
1
1
|
module Tracksperanto::ShakeGrammar
|
2
|
+
class WrongInput < RuntimeError; end
|
3
|
+
|
2
4
|
# Since Shake uses a C-like language for it's scripts we rig up a very sloppy
|
3
5
|
# but concise C-like lexer to cope
|
4
6
|
class Lexer
|
@@ -15,8 +17,8 @@ module Tracksperanto::ShakeGrammar
|
|
15
17
|
# The second argument is a "sentinel" that is going to be passed
|
16
18
|
# to the downstream lexers instantiated for nested data structures.
|
17
19
|
# You can use the sentinel to collect data from child nodes for example.
|
18
|
-
def initialize(with_io, sentinel = nil, limit_to_one_stmt = false)
|
19
|
-
@io, @stack, @buf, @sentinel, @limit_to_one_stmt = with_io, [], '', sentinel,
|
20
|
+
def initialize(with_io, sentinel = nil, limit_to_one_stmt = false, stack_depth = 0)
|
21
|
+
@io, @stack, @buf, @sentinel, @limit_to_one_stmt, @stack_depth = with_io, [], '', sentinel, limit_to_one_stmt, stack_depth
|
20
22
|
catch(STOP_TOKEN) { parse until @io.eof? }
|
21
23
|
in_comment? ? consume_comment("\n") : consume_atom!
|
22
24
|
end
|
@@ -37,11 +39,21 @@ module Tracksperanto::ShakeGrammar
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def parse
|
42
|
+
|
40
43
|
c = @io.read(1)
|
44
|
+
|
45
|
+
if @buf.length > 32000 # Wrong format and the buffer is filled up, bail
|
46
|
+
raise WrongInput, "Buffer overflow at 32K, this is definitely not a Shake script"
|
47
|
+
end
|
48
|
+
|
49
|
+
if @stack_depth > 127 # Wrong format - parentheses overload
|
50
|
+
raise WrongInput, "Stack overflow at level 128, this is probably a LISP program uploaded by accident"
|
51
|
+
end
|
52
|
+
|
41
53
|
return consume_comment(c) if in_comment?
|
42
54
|
|
43
55
|
if !@buf.empty? && (c == "(") # Funcall
|
44
|
-
push([:funcall, @buf.strip] + self.class.new(@io, @sentinel).stack)
|
56
|
+
push([:funcall, @buf.strip] + self.class.new(@io, @sentinel, false, @stack_depth + 1).stack)
|
45
57
|
@buf = ''
|
46
58
|
elsif c == "[" # Array, booring
|
47
59
|
push([:arr, self.class.new(@io).stack])
|
@@ -57,7 +69,7 @@ module Tracksperanto::ShakeGrammar
|
|
57
69
|
elsif (c == ";" || c == "\n")
|
58
70
|
# Skip these - the subexpression already is expanded anyway
|
59
71
|
elsif (c == "=")
|
60
|
-
push [:assign, @buf.strip, self.class.new(@io, @sentinel, to_semicolon = true).stack.shift]
|
72
|
+
push [:assign, @buf.strip, self.class.new(@io, @sentinel, to_semicolon = true, @stack_depth + 1).stack.shift]
|
61
73
|
@buf = ''
|
62
74
|
else
|
63
75
|
@buf << c
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# This middleware adds linearly interpolated keyframes BETWEEN the keyframes passing through the exporter
|
2
|
+
class Tracksperanto::Middleware::Lerp < Tracksperanto::Middleware::Base
|
3
|
+
attr_accessor :enabled
|
4
|
+
|
5
|
+
def initialize(*whatever)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def end_tracker_segment
|
10
|
+
@last_f, @last_x, @last_y, @last_res = nil, nil, nil, nil
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def export_point(frame, float_x, float_y, float_residual)
|
15
|
+
|
16
|
+
if @enabled && @last_f && (frame - @last_f > 1) # Interpolate!
|
17
|
+
interpolated_frames = []
|
18
|
+
interpolated_x = []
|
19
|
+
lerp(@last_f, @last_x, frame, float_x) do | interp_f, interp_x |
|
20
|
+
interpolated_frames << interp_f
|
21
|
+
interpolated_x << interp_x
|
22
|
+
end
|
23
|
+
|
24
|
+
interpolated_y = []
|
25
|
+
lerp(@last_f, @last_y, frame, float_y) do | interp_f, interp_y |
|
26
|
+
interpolated_y << interp_y
|
27
|
+
end
|
28
|
+
|
29
|
+
interpolated_res = []
|
30
|
+
lerp(@last_f, @last_res, frame, float_residual) do | interp_f, interp_res |
|
31
|
+
interpolated_res << interp_res
|
32
|
+
end
|
33
|
+
|
34
|
+
tuples = interpolated_frames.zip(interpolated_x).zip(interpolated_y).zip(interpolated_res).map{|e| e.flatten }
|
35
|
+
tuples.each do | f, x, y, r |
|
36
|
+
super(f.to_i, x, y, r)
|
37
|
+
end
|
38
|
+
else
|
39
|
+
super(frame, float_x + (@x_shift || 0), float_y + (@y_shift || 0), float_residual)
|
40
|
+
end
|
41
|
+
|
42
|
+
@last_f, @last_x, @last_y, @last_res = frame, float_x, float_y, float_residual
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
# Do a simple linear interpolxion. The function will yield
|
47
|
+
# the interim X and Y, one tuple per whole value between the set points,
|
48
|
+
# and return the last tuple (so you can return-assign from it in a loop)
|
49
|
+
def lerp(last_x, last_y, x, y) #:yields: interp_x, interp_y
|
50
|
+
if last_x.nil?
|
51
|
+
yield(x, y)
|
52
|
+
else
|
53
|
+
gap_size = x - last_x
|
54
|
+
increment = (y.to_f - last_y) / gap_size.to_f
|
55
|
+
(1..gap_size).each do | index |
|
56
|
+
yield(last_x + index, last_y + (increment * index))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
return [x, y]
|
61
|
+
end
|
62
|
+
end
|
data/lib/pipeline/base.rb
CHANGED
@@ -148,7 +148,8 @@ class Tracksperanto::Pipeline::Base
|
|
148
148
|
reformat = Tracksperanto::Middleware::Reformat.new(golden)
|
149
149
|
shift = Tracksperanto::Middleware::Shift.new(reformat)
|
150
150
|
prefix = Tracksperanto::Middleware::Prefix.new(shift)
|
151
|
-
|
151
|
+
lerp = Tracksperanto::Middleware::Lerp.new(prefix)
|
152
|
+
[scaler, slipper, golden, reformat, shift, prefix, lerp]
|
152
153
|
end
|
153
154
|
|
154
155
|
# Open the file for writing and register it to be closed automatically
|
data/lib/tracksperanto.rb
CHANGED
@@ -3,7 +3,21 @@ require File.dirname(__FILE__) + '/../helper'
|
|
3
3
|
class NukeExportTest < Test::Unit::TestCase
|
4
4
|
include ParabolicTracks
|
5
5
|
P = File.dirname(__FILE__) + "/samples/ref_NukeScript.nk"
|
6
|
-
|
6
|
+
PREAMBLE = 'version 5.1200
|
7
|
+
Root {
|
8
|
+
inputs 0
|
9
|
+
frame 1
|
10
|
+
last_frame 1
|
11
|
+
}
|
12
|
+
Constant {
|
13
|
+
inputs 0
|
14
|
+
channels rgb
|
15
|
+
format "1080 720 0 0 1080 720 1"
|
16
|
+
name CompSize_1080x720
|
17
|
+
postage_stamp false
|
18
|
+
xpos 0
|
19
|
+
ypos -60
|
20
|
+
}'
|
7
21
|
def test_export_output_written
|
8
22
|
ensure_same_output Tracksperanto::Export::NukeScript, P
|
9
23
|
end
|
@@ -19,4 +33,13 @@ class NukeExportTest < Test::Unit::TestCase
|
|
19
33
|
curves = x.send(:curves_from_tuples, tuples)
|
20
34
|
assert_equal "{curve i x6 234.0000 x8 144.0000 x9 231.0000 232.0000} {curve i x6 145.0000 x8 223.0000 x9 189.0000 190.0000}", curves
|
21
35
|
end
|
36
|
+
|
37
|
+
def test_compsize_not_overridden
|
38
|
+
o = StringIO.new
|
39
|
+
x = Tracksperanto::Export::NukeScript.new(o)
|
40
|
+
x.start_export(1080, 720)
|
41
|
+
x.end_export
|
42
|
+
assert_equal PREAMBLE, o.string.strip
|
43
|
+
end
|
44
|
+
|
22
45
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Tracker1 1 0.534170 0.262748 15
|
2
|
+
Tracker1 2 0.529106 0.271534 15
|
3
|
+
Tracker1 3 0.519590 0.276720 15
|
4
|
+
Tracker1 4 0.505941 0.279593 15
|
5
|
+
Tracker1 5 0.492117 0.282147 15
|
6
|
+
Tracker1 6 0.473923 0.286924 15
|
7
|
+
Tracker1 7 0.448403 0.286272 15
|
8
|
+
Tracker1 8 0.417549 0.284215 7
|
9
|
+
Tracker1 9 0.384929 0.282190 7
|
10
|
+
Tracker1 10 0.353343 0.276352 7
|
11
|
+
Tracker1 11 0.326983 0.261854 7
|
12
|
+
Tracker1 12 0.307420 0.241051 7
|
13
|
+
Tracker1 13 0.294273 0.216698 15
|
14
|
+
Tracker1 14 0.284551 0.179775 7
|
15
|
+
Tracker1 15 0.275643 0.139854 7
|
16
|
+
Tracker1 16 0.269627 0.097185 7
|
17
|
+
Tracker1 17 0.265121 0.055921 7
|
18
|
+
Tracker1 18 0.261474 0.016123 7
|
19
|
+
Tracker1 19 0.259958 -0.017824 15
|
20
|
+
Tracker1 20 0.259865 -0.050091 7
|
21
|
+
Tracker1 21 0.261076 -0.079522 7
|
22
|
+
Tracker1 22 0.266876 -0.106130 7
|
23
|
+
Tracker1 23 0.278061 -0.127863 7
|
24
|
+
Tracker1 24 0.292528 -0.147697 7
|
25
|
+
Tracker1 25 0.309343 -0.165303 15
|
26
|
+
Tracker1 26 0.326480 -0.180183 7
|
27
|
+
Tracker1 27 0.344691 -0.193969 7
|
28
|
+
Tracker1 28 0.365476 -0.204905 7
|
29
|
+
Tracker1 29 0.388225 -0.211803 7
|
30
|
+
Tracker1 30 0.412228 -0.216392 7
|
31
|
+
Tracker1 31 0.435676 -0.219055 15
|
32
|
+
Tracker1 32 0.459568 -0.218204 7
|
33
|
+
Tracker1 33 0.482528 -0.213783 7
|
34
|
+
Tracker1 34 0.505475 -0.210264 7
|
35
|
+
Tracker1 35 0.527886 -0.209445 7
|
36
|
+
Tracker1 36 0.549428 -0.207653 7
|
37
|
+
Tracker1 37 0.570387 -0.205963 15
|
38
|
+
Tracker1 38 0.590096 -0.203837 7
|
39
|
+
Tracker1 39 0.609588 -0.200976 7
|
40
|
+
Tracker1 40 0.629251 -0.195805 7
|
41
|
+
Tracker1 41 0.648441 -0.190597 7
|
42
|
+
Tracker1 42 0.666821 -0.184932 7
|
43
|
+
Tracker1 43 0.683569 -0.180815 15
|
44
|
+
Tracker1 44 0.700128 -0.178974 7
|
45
|
+
Tracker1 45 0.716387 -0.179853 7
|
46
|
+
Tracker1 46 0.733495 -0.181219 7
|
47
|
+
Tracker1 47 0.750154 -0.182144 7
|
48
|
+
Tracker1 48 0.766540 -0.183834 23
|
49
|
+
Tracker1 49 0.782901 -0.186439 15
|
@@ -3,6 +3,20 @@ require File.dirname(__FILE__) + '/../helper'
|
|
3
3
|
class ShakeLexerTest < Test::Unit::TestCase
|
4
4
|
P = File.dirname(__FILE__) + "/samples/shake_script/shake_tracker_nodes.shk"
|
5
5
|
L = Tracksperanto::ShakeGrammar::Lexer
|
6
|
+
WRONG = File.dirname(__FILE__) + "/samples/flame_stabilizer/hugeFlameSetup.stabilizer"
|
7
|
+
|
8
|
+
def test_raises_wrong_input_when_buffer_gets_too_large
|
9
|
+
assert_raise(Tracksperanto::ShakeGrammar::WrongInput) do
|
10
|
+
parse(File.open(WRONG), L)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_raises_wrong_input_on_stack_size
|
15
|
+
huge_stack = "(" * 345
|
16
|
+
assert_raise(Tracksperanto::ShakeGrammar::WrongInput) do
|
17
|
+
parse(StringIO.new(huge_stack), L)
|
18
|
+
end
|
19
|
+
end
|
6
20
|
|
7
21
|
def test_parse_single_cmt
|
8
22
|
cmt = " // Mary had a little lamb"
|
@@ -94,7 +108,7 @@ class ShakeLexerTest < Test::Unit::TestCase
|
|
94
108
|
|
95
109
|
def test_parse_varassign
|
96
110
|
s = parse 'Foo = Blur(Foo, 1, 2, 3); 1'
|
97
|
-
assert_equal [[:assign, "Foo", [:funcall, "Blur", [:atom, "Foo"], 1, 2, 3]]], s
|
111
|
+
assert_equal [[:assign, "Foo", [:funcall, "Blur", [:atom, "Foo"], 1, 2, 3]], 1], s
|
98
112
|
end
|
99
113
|
|
100
114
|
def test_parse_whole_file_does_not_raise
|
@@ -9,7 +9,7 @@ class ShakeScriptImportTest < Test::Unit::TestCase
|
|
9
9
|
trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
|
10
10
|
assert_equal 50, trackers.length
|
11
11
|
|
12
|
-
t = trackers[
|
12
|
+
t = trackers[-1]
|
13
13
|
assert_equal "Tracker8_track1", t.name
|
14
14
|
|
15
15
|
first_kf = t.keyframes[0]
|
@@ -101,7 +101,7 @@ class ShakeScriptImportTest < Test::Unit::TestCase
|
|
101
101
|
fixture = File.open(File.dirname(__FILE__) + "/samples/shake_script/stabilize_nodes_with_hermite.shk")
|
102
102
|
trackers = Tracksperanto::Import::ShakeScript.new.parse(fixture)
|
103
103
|
assert_equal 3, trackers.length
|
104
|
-
last_t = trackers[
|
104
|
+
last_t = trackers[0]
|
105
105
|
assert_equal "Stabilize1_track1", last_t.name
|
106
106
|
assert_equal 73, last_t.length
|
107
107
|
|
@@ -37,4 +37,15 @@ class SyntheyesImportTest < Test::Unit::TestCase
|
|
37
37
|
trackers = parser.parse(fixture)
|
38
38
|
assert_equal 6, trackers.length
|
39
39
|
end
|
40
|
+
|
41
|
+
def test_parsing_with_one_tracker
|
42
|
+
fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/one_tracker.txt')
|
43
|
+
parser = Tracksperanto::Import::Syntheyes.new
|
44
|
+
parser.width = 1920
|
45
|
+
parser.height = 1080
|
46
|
+
trackers = parser.parse(fixture)
|
47
|
+
assert_equal 1, trackers.length
|
48
|
+
assert_equal 49, trackers[0].length
|
49
|
+
end
|
50
|
+
|
40
51
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../helper'
|
2
|
+
|
3
|
+
class LerpMiddlewareTest < Test::Unit::TestCase
|
4
|
+
def test_lerp
|
5
|
+
receiver = flexmock
|
6
|
+
m = Tracksperanto::Middleware::Lerp.new(receiver, :enabled => true)
|
7
|
+
receiver.should_receive(:start_export).with(720, 576).once
|
8
|
+
receiver.should_receive(:start_tracker_segment).with("Foo").once
|
9
|
+
receiver.should_receive(:export_point).with(1, 1.0, 2.0, 0).once
|
10
|
+
receiver.should_receive(:export_point).with(2, 2.0, 3.0, 0).once
|
11
|
+
receiver.should_receive(:export_point).with(3, 3.0, 4.0, 0).once
|
12
|
+
receiver.should_receive(:export_point).with(4, 4.0, 5.0, 0).once
|
13
|
+
receiver.should_receive(:end_tracker_segment).once
|
14
|
+
receiver.should_receive(:end_export).once
|
15
|
+
|
16
|
+
m.start_export(720, 576)
|
17
|
+
m.start_tracker_segment("Foo")
|
18
|
+
m.export_point(1, 1.0, 2.0, 0)
|
19
|
+
m.export_point(4, 4.0, 5.0, 0)
|
20
|
+
m.end_tracker_segment
|
21
|
+
m.end_export
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_lerp_should_react_to_enabled_flag
|
25
|
+
receiver = flexmock
|
26
|
+
m = Tracksperanto::Middleware::Lerp.new(receiver, :enabled => false)
|
27
|
+
receiver.should_receive(:start_export).with(720, 576).once
|
28
|
+
receiver.should_receive(:start_tracker_segment).with("Foo").once
|
29
|
+
receiver.should_receive(:export_point).with(1, 1.0, 2.0, 0).once
|
30
|
+
receiver.should_receive(:export_point).with(4, 4.0, 5.0, 0).once
|
31
|
+
receiver.should_receive(:end_tracker_segment).once
|
32
|
+
receiver.should_receive(:end_export).once
|
33
|
+
|
34
|
+
m.start_export(720, 576)
|
35
|
+
m.start_tracker_segment("Foo")
|
36
|
+
m.export_point(1, 1.0, 2.0, 0)
|
37
|
+
m.export_point(4, 4.0, 5.0, 0)
|
38
|
+
m.end_tracker_segment
|
39
|
+
m.end_export
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracksperanto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-31 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- lib/import/syntheyes.rb
|
79
79
|
- lib/middleware/base.rb
|
80
80
|
- lib/middleware/golden.rb
|
81
|
+
- lib/middleware/lerp.rb
|
81
82
|
- lib/middleware/prefix.rb
|
82
83
|
- lib/middleware/reformat.rb
|
83
84
|
- lib/middleware/scaler.rb
|
@@ -147,6 +148,7 @@ files:
|
|
147
148
|
- test/import/samples/shake_text/two_shake_trackers.txt
|
148
149
|
- test/import/samples/syntheyes_2d_paths/cola_plate.txt
|
149
150
|
- test/import/samples/syntheyes_2d_paths/flyover2DP_syntheyes.txt
|
151
|
+
- test/import/samples/syntheyes_2d_paths/one_tracker.txt
|
150
152
|
- test/import/samples/syntheyes_2d_paths/shake_tracker_nodes_to_syntheyes.txt
|
151
153
|
- test/import/test_3de_import.rb
|
152
154
|
- test/import/test_3de_import3.rb
|
@@ -162,6 +164,7 @@ files:
|
|
162
164
|
- test/import/test_shake_text_import.rb
|
163
165
|
- test/import/test_syntheyes_import.rb
|
164
166
|
- test/middleware/test_golden_middleware.rb
|
167
|
+
- test/middleware/test_lerp_middleware.rb
|
165
168
|
- test/middleware/test_prefix.rb
|
166
169
|
- test/middleware/test_reformat_middleware.rb
|
167
170
|
- test/middleware/test_scaler_middleware.rb
|
@@ -173,6 +176,7 @@ files:
|
|
173
176
|
- test/test_keyframe.rb
|
174
177
|
- test/test_simple_export.rb
|
175
178
|
- test/test_tracker.rb
|
179
|
+
- test/test_tracksperanto.rb
|
176
180
|
has_rdoc: true
|
177
181
|
homepage: http://guerilla-di.org/tracksperanto
|
178
182
|
licenses: []
|
@@ -227,6 +231,7 @@ test_files:
|
|
227
231
|
- test/import/test_shake_text_import.rb
|
228
232
|
- test/import/test_syntheyes_import.rb
|
229
233
|
- test/middleware/test_golden_middleware.rb
|
234
|
+
- test/middleware/test_lerp_middleware.rb
|
230
235
|
- test/middleware/test_prefix.rb
|
231
236
|
- test/middleware/test_reformat_middleware.rb
|
232
237
|
- test/middleware/test_scaler_middleware.rb
|