tracksperanto 1.9.0 → 1.9.1

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 CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.9.1 / 2010-03-21
2
+
3
+ * Fix a Pipeline bug introduced with the last version
4
+
1
5
  === 1.9.0 / 2010-03-21
2
6
 
3
7
  * Use proper progress bars
data/Manifest.txt CHANGED
@@ -4,6 +4,7 @@ Manifest.txt
4
4
  README.txt
5
5
  Rakefile
6
6
  bin/tracksperanto
7
+ coverage.info
7
8
  lib/export/base.rb
8
9
  lib/export/equalizer3.rb
9
10
  lib/export/equalizer4.rb
@@ -84,6 +85,7 @@ test/import/samples/3de_v3/3de_export_v3.txt
84
85
  test/import/samples/3de_v4/3de_export_cube.txt
85
86
  test/import/samples/boujou_features_text/boujou_txt_export.txt
86
87
  test/import/samples/flame_stabilizer/fromCombustion_fromMidClip_wSnap.stabilizer
88
+ test/import/samples/flame_stabilizer/fromTracksperanto.stabilizer
87
89
  test/import/samples/flame_stabilizer/hugeFlameSetup.stabilizer
88
90
  test/import/samples/flame_stabilizer/megaTrack.action.3dtrack.stabilizer
89
91
  test/import/samples/match_mover/kipPointsMatchmover.rz2
@@ -139,6 +141,7 @@ test/test_extio.rb
139
141
  test/test_flame_builder.rb
140
142
  test/test_format_detector.rb
141
143
  test/test_keyframe.rb
144
+ test/test_pipeline.rb
142
145
  test/test_progressive_io.rb
143
146
  test/test_simple_export.rb
144
147
  test/test_tracker.rb
data/coverage.info ADDED
Binary file
@@ -30,8 +30,6 @@ class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
30
30
  keyframe_count_matcher = /Size (\d+)/
31
31
  indent = nil
32
32
 
33
- keyframes = []
34
-
35
33
  while line = io.gets
36
34
 
37
35
  unless indent
@@ -47,7 +45,6 @@ class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
47
45
  break
48
46
  end
49
47
  end
50
-
51
48
  raise "Parsed a channel #{@name} with no keyframes" if (empty? && !base_value)
52
49
  end
53
50
 
data/lib/pipeline/base.rb CHANGED
@@ -13,6 +13,7 @@
13
13
  # and setup outputs for all supported export formats.
14
14
  class Tracksperanto::Pipeline::Base
15
15
  EXTENSION = /\.([^\.]+)$/ #:nodoc:
16
+ PERMITTED_OPTIONS = [:importer, :width, :height]
16
17
 
17
18
  include Tracksperanto::BlockInit
18
19
 
@@ -32,8 +33,6 @@ class Tracksperanto::Pipeline::Base
32
33
  # Assign an array of exporters to use them instead of the standard ones
33
34
  attr_accessor :exporters
34
35
 
35
- DEFAULT_OPTIONS = {:width => 720, :height => 576, :parser => Tracksperanto::Import::ShakeScript }
36
-
37
36
  # Contains arrays of the form ["MiddewareName", {:param => value}]
38
37
  attr_accessor :middleware_tuples
39
38
 
@@ -50,13 +49,12 @@ class Tracksperanto::Pipeline::Base
50
49
  # * height - The comp height, for the case that the format does not support auto size
51
50
  # * parser - The parser class, for the case that it can't be autodetected from the file name
52
51
  def run(from_input_file_path, passed_options = {}) #:yields: *all_middlewares
53
- o = DEFAULT_OPTIONS.merge(passed_options)
54
52
 
55
53
  # Reset stats
56
54
  @converted_keyframes, @converted_points = 0, 0
57
55
 
58
56
  # Assign the parser
59
- importer = initialize_importer_with_path_and_options(from_input_file_path, o)
57
+ importer = initialize_importer_with_path_and_options(from_input_file_path, passed_options)
60
58
 
61
59
  # Open the file
62
60
  read_data = File.open(from_input_file_path, "rb")
@@ -74,17 +72,20 @@ class Tracksperanto::Pipeline::Base
74
72
  end
75
73
 
76
74
  def initialize_importer_with_path_and_options(from_input_file_path, options)
75
+
77
76
  d = Tracksperanto::FormatDetector.new(from_input_file_path)
78
- if d.match? && d.auto_size?
77
+
78
+ if options[:importer]
79
+ imp = Tracksperanto.get_importer(options[:importer])
80
+ require_dimensions_in!(options) unless imp.autodetects_size?
81
+ imp.new(:width => options[:width], :height => options[:height])
82
+ elsif d.match? && d.auto_size?
79
83
  d.importer_klass.new
80
84
  elsif d.match?
81
- require_dimensions_in!(opts)
82
- d.importer_klass.new(:width => opts[:width], :height => opts[:height])
85
+ require_dimensions_in!(options)
86
+ d.importer_klass.new(:width => options[:width], :height => options[:height])
83
87
  else
84
- raise "Cannot autodetect the file format - please specify the importer explicitly" unless opts[:parser]
85
- klass = Tracksperanto.get_exporter(opts[:parser])
86
- require_dimensions_in!(opts) unless klass.autodetects_size?
87
- klass.new(:width => opts[:width], :height => opts[:height])
88
+ raise "Unknown input format"
88
89
  end
89
90
  end
90
91
 
@@ -95,13 +96,13 @@ class Tracksperanto::Pipeline::Base
95
96
  # Runs the export and returns the number of points and keyframes processed.
96
97
  # If a block is passed, the block will receive the percent complete and the last
97
98
  # status message that you can pass back to the UI
98
- def run_export(tracker_data_io, parser, exporter)
99
+ def run_export(tracker_data_io, importer, exporter)
99
100
  points, keyframes, percent_complete = 0, 0, 0.0
100
101
 
101
102
  report_progress(percent_complete, "Starting the parser")
102
103
 
103
104
  # Report progress from the parser
104
- parser.progress_block = lambda { | m | report_progress(percent_complete, m) }
105
+ importer.progress_block = lambda { | m | report_progress(percent_complete, m) }
105
106
 
106
107
  # Wrap the input in a progressive IO, setup a lambda that will spy on the reader and
107
108
  # update the percentage. We will only broadcast messages that come from the parser
@@ -110,9 +111,8 @@ class Tracksperanto::Pipeline::Base
110
111
  percent_complete = (50.0 / of_total) * offset
111
112
  end
112
113
  @ios << io_with_progress
113
-
114
- trackers = parser.parse(io_with_progress)
115
-
114
+
115
+ trackers = importer.parse(io_with_progress)
116
116
  report_progress(percent_complete = 50.0, "Validating #{trackers.length} imported trackers")
117
117
 
118
118
  validate_trackers!(trackers)
@@ -122,7 +122,7 @@ class Tracksperanto::Pipeline::Base
122
122
  percent_per_tracker = (100.0 - percent_complete) / trackers.length
123
123
 
124
124
  # Use the width and height provided by the parser itself
125
- exporter.start_export(parser.width, parser.height)
125
+ exporter.start_export(importer.width, importer.height)
126
126
  trackers.each_with_index do | t, tracker_idx |
127
127
  kf_weight = percent_per_tracker / t.keyframes.length
128
128
  points += 1
@@ -160,9 +160,7 @@ class Tracksperanto::Pipeline::Base
160
160
  # Open the file for writing and register it to be closed automatically
161
161
  def open_owned_export_file(path_to_file)
162
162
  @ios ||= []
163
- handle = File.open(path_to_file, "wb")
164
- @ios << handle
165
- handle
163
+ @ios.push(File.open(path_to_file, "wb"))[-1]
166
164
  end
167
165
 
168
166
  # Check that the trackers made by the parser are A-OK
@@ -1,5 +1,5 @@
1
1
  module Tracksperanto::Returning
2
- # The "returning" idiomn copied from ActiveSupport
2
+ # The "returning" idiom copied from ActiveSupport
3
3
  def returning(r)
4
4
  yield(r); r
5
5
  end
data/lib/tracksperanto.rb CHANGED
@@ -4,7 +4,7 @@ require 'tempfile'
4
4
 
5
5
  module Tracksperanto
6
6
  PATH = File.expand_path(File.dirname(__FILE__))
7
- VERSION = '1.9.0'
7
+ VERSION = '1.9.1'
8
8
 
9
9
  module Import; end
10
10
  module Export; end
@@ -0,0 +1,541 @@
1
+ StabilizerFileVersion 5.0
2
+ CreationDate Sun Mar 21 16:46:25 2010
3
+
4
+
5
+ NbTrackers 3
6
+ Selected 0
7
+ FrameWidth 720
8
+ FrameHeight 576
9
+ AutoKey yes
10
+ MotionPath yes
11
+ Icons yes
12
+ AutoPan no
13
+ EditMode 0
14
+ Format 0
15
+ Padding
16
+ Red 0
17
+ Green 100
18
+ Blue 0
19
+ Oversampling no
20
+ Opacity 50
21
+ Zoom 3
22
+ Field no
23
+ Backward no
24
+ Anim
25
+ Channel tracker1/track/x
26
+ Extrapolation constant
27
+ Value 360
28
+ Colour 50 50 50
29
+ End
30
+ Channel tracker1/track/y
31
+ Extrapolation constant
32
+ Value 288
33
+ Colour 50 50 50
34
+ End
35
+ Channel tracker1/track/width
36
+ Extrapolation linear
37
+ Value 15
38
+ Colour 50 50 50
39
+ End
40
+ Channel tracker1/track/height
41
+ Extrapolation linear
42
+ Value 15
43
+ Colour 50 50 50
44
+ End
45
+ Channel tracker1/ref/width
46
+ Extrapolation linear
47
+ Value 10
48
+ Colour 50 50 50
49
+ End
50
+ Channel tracker1/ref/height
51
+ Extrapolation linear
52
+ Value 10
53
+ Colour 50 50 50
54
+ End
55
+ Channel tracker1/ref/x
56
+ Extrapolation constant
57
+ Value 100.000
58
+ Colour 50 50 50
59
+ KeyVersion 1
60
+ Size 1
61
+ Key 0
62
+ Frame 1
63
+ Value 100.000
64
+ Interpolation constant
65
+ LeftSlope 2.400
66
+ RightSlope 2.400
67
+ End
68
+ End
69
+ Channel tracker1/ref/y
70
+ Extrapolation constant
71
+ Value 200.000
72
+ Colour 50 50 50
73
+ KeyVersion 1
74
+ Size 1
75
+ Key 0
76
+ Frame 1
77
+ Value 200.000
78
+ Interpolation constant
79
+ LeftSlope 2.400
80
+ RightSlope 2.400
81
+ End
82
+ End
83
+ Channel tracker1/ref/dx
84
+ Extrapolation constant
85
+ Value 0
86
+ Colour 50 50 50
87
+ Size 2
88
+ KeyVersion 1
89
+ Key 0
90
+ Frame 0
91
+ Value 0
92
+ ValueLock yes
93
+ DeleteLock yes
94
+ Interpolation constant
95
+ End
96
+ Key 1
97
+ Frame 1
98
+ Value 0
99
+ ValueLock yes
100
+ DeleteLock yes
101
+ Interpolation constant
102
+ End
103
+ End
104
+ Channel tracker1/ref/dy
105
+ Extrapolation constant
106
+ Value 0
107
+ Colour 50 50 50
108
+ Size 2
109
+ KeyVersion 1
110
+ Key 0
111
+ Frame 0
112
+ Value 0
113
+ ValueLock yes
114
+ DeleteLock yes
115
+ Interpolation constant
116
+ End
117
+ Key 1
118
+ Frame 1
119
+ Value 0
120
+ ValueLock yes
121
+ DeleteLock yes
122
+ Interpolation constant
123
+ End
124
+ End
125
+ Channel tracker1/offset/x
126
+ Extrapolation constant
127
+ Value 0
128
+ End
129
+ Channel tracker1/offset/y
130
+ Extrapolation constant
131
+ Value 0
132
+ End
133
+ Channel tracker1/shift/x
134
+ Extrapolation constant
135
+ Value 0
136
+ KeyVersion 1
137
+ Size 3
138
+ Key 0
139
+ Frame 4
140
+ Value 0
141
+ Interpolation linear
142
+ LeftSlope 2.400
143
+ RightSlope 2.400
144
+ End
145
+ Key 1
146
+ Frame 5
147
+ Value -100.000
148
+ Interpolation linear
149
+ LeftSlope 2.400
150
+ RightSlope 2.400
151
+ End
152
+ Key 2
153
+ Frame 6
154
+ Value -110.000
155
+ Interpolation linear
156
+ LeftSlope 2.400
157
+ RightSlope 2.400
158
+ End
159
+ End
160
+ Channel tracker1/shift/y
161
+ Extrapolation constant
162
+ Value 0
163
+ KeyVersion 1
164
+ Size 3
165
+ Key 0
166
+ Frame 4
167
+ Value 0
168
+ Interpolation linear
169
+ LeftSlope 2.400
170
+ RightSlope 2.400
171
+ End
172
+ Key 1
173
+ Frame 5
174
+ Value 80.000
175
+ Interpolation linear
176
+ LeftSlope 2.400
177
+ RightSlope 2.400
178
+ End
179
+ Key 2
180
+ Frame 6
181
+ Value 55.000
182
+ Interpolation linear
183
+ LeftSlope 2.400
184
+ RightSlope 2.400
185
+ End
186
+ End
187
+ Channel tracker2/track/x
188
+ Extrapolation constant
189
+ Value 360
190
+ Colour 50 50 50
191
+ End
192
+ Channel tracker2/track/y
193
+ Extrapolation constant
194
+ Value 288
195
+ Colour 50 50 50
196
+ End
197
+ Channel tracker2/track/width
198
+ Extrapolation linear
199
+ Value 15
200
+ Colour 50 50 50
201
+ End
202
+ Channel tracker2/track/height
203
+ Extrapolation linear
204
+ Value 15
205
+ Colour 50 50 50
206
+ End
207
+ Channel tracker2/ref/width
208
+ Extrapolation linear
209
+ Value 10
210
+ Colour 50 50 50
211
+ End
212
+ Channel tracker2/ref/height
213
+ Extrapolation linear
214
+ Value 10
215
+ Colour 50 50 50
216
+ End
217
+ Channel tracker2/ref/x
218
+ Extrapolation constant
219
+ Value 100.000
220
+ Colour 50 50 50
221
+ KeyVersion 1
222
+ Size 1
223
+ Key 0
224
+ Frame 1
225
+ Value 100.000
226
+ Interpolation constant
227
+ LeftSlope 2.400
228
+ RightSlope 2.400
229
+ End
230
+ End
231
+ Channel tracker2/ref/y
232
+ Extrapolation constant
233
+ Value 200.000
234
+ Colour 50 50 50
235
+ KeyVersion 1
236
+ Size 1
237
+ Key 0
238
+ Frame 1
239
+ Value 200.000
240
+ Interpolation constant
241
+ LeftSlope 2.400
242
+ RightSlope 2.400
243
+ End
244
+ End
245
+ Channel tracker2/ref/dx
246
+ Extrapolation constant
247
+ Value 0
248
+ Colour 50 50 50
249
+ Size 2
250
+ KeyVersion 1
251
+ Key 0
252
+ Frame 0
253
+ Value 0
254
+ ValueLock yes
255
+ DeleteLock yes
256
+ Interpolation constant
257
+ End
258
+ Key 1
259
+ Frame 1
260
+ Value 0
261
+ ValueLock yes
262
+ DeleteLock yes
263
+ Interpolation constant
264
+ End
265
+ End
266
+ Channel tracker2/ref/dy
267
+ Extrapolation constant
268
+ Value 0
269
+ Colour 50 50 50
270
+ Size 2
271
+ KeyVersion 1
272
+ Key 0
273
+ Frame 0
274
+ Value 0
275
+ ValueLock yes
276
+ DeleteLock yes
277
+ Interpolation constant
278
+ End
279
+ Key 1
280
+ Frame 1
281
+ Value 0
282
+ ValueLock yes
283
+ DeleteLock yes
284
+ Interpolation constant
285
+ End
286
+ End
287
+ Channel tracker2/offset/x
288
+ Extrapolation constant
289
+ Value 0
290
+ End
291
+ Channel tracker2/offset/y
292
+ Extrapolation constant
293
+ Value 0
294
+ End
295
+ Channel tracker2/shift/x
296
+ Extrapolation constant
297
+ Value 0
298
+ KeyVersion 1
299
+ Size 3
300
+ Key 0
301
+ Frame 4
302
+ Value 0
303
+ Interpolation linear
304
+ LeftSlope 2.400
305
+ RightSlope 2.400
306
+ End
307
+ Key 1
308
+ Frame 5
309
+ Value -100.000
310
+ Interpolation linear
311
+ LeftSlope 2.400
312
+ RightSlope 2.400
313
+ End
314
+ Key 2
315
+ Frame 6
316
+ Value -110.000
317
+ Interpolation linear
318
+ LeftSlope 2.400
319
+ RightSlope 2.400
320
+ End
321
+ End
322
+ Channel tracker2/shift/y
323
+ Extrapolation constant
324
+ Value 0
325
+ KeyVersion 1
326
+ Size 3
327
+ Key 0
328
+ Frame 4
329
+ Value 0
330
+ Interpolation linear
331
+ LeftSlope 2.400
332
+ RightSlope 2.400
333
+ End
334
+ Key 1
335
+ Frame 5
336
+ Value 80.000
337
+ Interpolation linear
338
+ LeftSlope 2.400
339
+ RightSlope 2.400
340
+ End
341
+ Key 2
342
+ Frame 6
343
+ Value 55.000
344
+ Interpolation linear
345
+ LeftSlope 2.400
346
+ RightSlope 2.400
347
+ End
348
+ End
349
+ Channel tracker3/track/x
350
+ Extrapolation constant
351
+ Value 360
352
+ Colour 50 50 50
353
+ End
354
+ Channel tracker3/track/y
355
+ Extrapolation constant
356
+ Value 288
357
+ Colour 50 50 50
358
+ End
359
+ Channel tracker3/track/width
360
+ Extrapolation linear
361
+ Value 15
362
+ Colour 50 50 50
363
+ End
364
+ Channel tracker3/track/height
365
+ Extrapolation linear
366
+ Value 15
367
+ Colour 50 50 50
368
+ End
369
+ Channel tracker3/ref/width
370
+ Extrapolation linear
371
+ Value 10
372
+ Colour 50 50 50
373
+ End
374
+ Channel tracker3/ref/height
375
+ Extrapolation linear
376
+ Value 10
377
+ Colour 50 50 50
378
+ End
379
+ Channel tracker3/ref/x
380
+ Extrapolation constant
381
+ Value 100.000
382
+ Colour 50 50 50
383
+ KeyVersion 1
384
+ Size 1
385
+ Key 0
386
+ Frame 1
387
+ Value 100.000
388
+ Interpolation constant
389
+ LeftSlope 2.400
390
+ RightSlope 2.400
391
+ End
392
+ End
393
+ Channel tracker3/ref/y
394
+ Extrapolation constant
395
+ Value 200.000
396
+ Colour 50 50 50
397
+ KeyVersion 1
398
+ Size 1
399
+ Key 0
400
+ Frame 1
401
+ Value 200.000
402
+ Interpolation constant
403
+ LeftSlope 2.400
404
+ RightSlope 2.400
405
+ End
406
+ End
407
+ Channel tracker3/ref/dx
408
+ Extrapolation constant
409
+ Value 0
410
+ Colour 50 50 50
411
+ Size 2
412
+ KeyVersion 1
413
+ Key 0
414
+ Frame 0
415
+ Value 0
416
+ ValueLock yes
417
+ DeleteLock yes
418
+ Interpolation constant
419
+ End
420
+ Key 1
421
+ Frame 1
422
+ Value 0
423
+ ValueLock yes
424
+ DeleteLock yes
425
+ Interpolation constant
426
+ End
427
+ End
428
+ Channel tracker3/ref/dy
429
+ Extrapolation constant
430
+ Value 0
431
+ Colour 50 50 50
432
+ Size 2
433
+ KeyVersion 1
434
+ Key 0
435
+ Frame 0
436
+ Value 0
437
+ ValueLock yes
438
+ DeleteLock yes
439
+ Interpolation constant
440
+ End
441
+ Key 1
442
+ Frame 1
443
+ Value 0
444
+ ValueLock yes
445
+ DeleteLock yes
446
+ Interpolation constant
447
+ End
448
+ End
449
+ Channel tracker3/offset/x
450
+ Extrapolation constant
451
+ Value 0
452
+ End
453
+ Channel tracker3/offset/y
454
+ Extrapolation constant
455
+ Value 0
456
+ End
457
+ Channel tracker3/shift/x
458
+ Extrapolation constant
459
+ Value 0
460
+ KeyVersion 1
461
+ Size 3
462
+ Key 0
463
+ Frame 4
464
+ Value 0
465
+ Interpolation linear
466
+ LeftSlope 2.400
467
+ RightSlope 2.400
468
+ End
469
+ Key 1
470
+ Frame 5
471
+ Value -100.000
472
+ Interpolation linear
473
+ LeftSlope 2.400
474
+ RightSlope 2.400
475
+ End
476
+ Key 2
477
+ Frame 6
478
+ Value -110.000
479
+ Interpolation linear
480
+ LeftSlope 2.400
481
+ RightSlope 2.400
482
+ End
483
+ End
484
+ Channel tracker3/shift/y
485
+ Extrapolation constant
486
+ Value 0
487
+ KeyVersion 1
488
+ Size 3
489
+ Key 0
490
+ Frame 4
491
+ Value 0
492
+ Interpolation linear
493
+ LeftSlope 2.400
494
+ RightSlope 2.400
495
+ End
496
+ Key 1
497
+ Frame 5
498
+ Value 80.000
499
+ Interpolation linear
500
+ LeftSlope 2.400
501
+ RightSlope 2.400
502
+ End
503
+ Key 2
504
+ Frame 6
505
+ Value 55.000
506
+ Interpolation linear
507
+ LeftSlope 2.400
508
+ RightSlope 2.400
509
+ End
510
+ End
511
+ ChannelEnd
512
+ Tracker 0
513
+ Active yes
514
+ Colour
515
+ Red 0
516
+ Green 100
517
+ Blue 0
518
+ FixedRef yes
519
+ FixedX no
520
+ FixedY no
521
+ Tolerance 100
522
+ Tracker 1
523
+ Active yes
524
+ Colour
525
+ Red 0
526
+ Green 100
527
+ Blue 0
528
+ FixedRef yes
529
+ FixedX no
530
+ FixedY no
531
+ Tolerance 100
532
+ Tracker 2
533
+ Active yes
534
+ Colour
535
+ Red 0
536
+ Green 100
537
+ Blue 0
538
+ FixedRef yes
539
+ FixedX no
540
+ FixedY no
541
+ Tolerance 100
@@ -148,4 +148,12 @@ class FlameImportTest < Test::Unit::TestCase
148
148
  assert_in_delta 390.267, frame_149.abs_x, DELTA
149
149
  assert_in_delta 280.248, frame_149.abs_y, DELTA
150
150
  end
151
+
152
+ def test_from_tracksperanto
153
+ fixture = File.open(File.dirname(__FILE__) + '/samples/flame_stabilizer/fromTracksperanto.stabilizer')
154
+ parser = Tracksperanto::Import::FlameStabilizer.new
155
+ trackers = parser.parse(fixture)
156
+ assert_equal 3, trackers.length
157
+ assert_equal 3, trackers[0].length
158
+ end
151
159
  end
@@ -0,0 +1,84 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class PipelineTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @old_dir = Dir.pwd
7
+ Dir.chdir(File.dirname(__FILE__))
8
+ end
9
+
10
+ def create_stabilizer_file
11
+ @stabilizer = "./input.stabilizer"
12
+ trackers = %w( Foo Bar Baz).map do | name |
13
+ t = Tracksperanto::Tracker.new(:name => name)
14
+ t.keyframe!(:frame => 3, :abs_x => 100, :abs_y => 200)
15
+ t.keyframe!(:frame => 4, :abs_x => 200, :abs_y => 120)
16
+ t.keyframe!(:frame => 5, :abs_x => 210, :abs_y => 145)
17
+ t
18
+ end
19
+
20
+ File.open(@stabilizer, "wb") do | f |
21
+ exporter = Tracksperanto::Export::FlameStabilizer.new(f)
22
+ exporter.just_export(trackers, 720, 576)
23
+ end
24
+ end
25
+
26
+ def teardown
27
+ Dir.glob("./input*.*").each(&File.method(:unlink))
28
+ Dir.chdir(@old_dir)
29
+ end
30
+
31
+ def test_supports_block_init
32
+ pipeline = Tracksperanto::Pipeline::Base.new(:middleware_tuples => [:a, :b])
33
+ assert_equal [:a, :b], pipeline.middleware_tuples
34
+ end
35
+
36
+ def test_run_with_autodetected_importer_and_size
37
+ create_stabilizer_file
38
+ pipeline = Tracksperanto::Pipeline::Base.new
39
+ assert_nothing_raised { pipeline.run(@stabilizer) }
40
+ assert_equal 3, pipeline.converted_points
41
+ assert_equal 9, pipeline.converted_keyframes, "Should report conversion of 9 keyframes"
42
+ end
43
+
44
+ def test_run_with_autodetected_importer_that_requires_size
45
+ FileUtils.cp("./import/samples/shake_script/four_tracks_in_one_stabilizer.shk", "./input.shk")
46
+ pipeline = Tracksperanto::Pipeline::Base.new
47
+ assert_raise(RuntimeError) { pipeline.run("./input.shk") }
48
+ end
49
+
50
+ def test_run_with_autodetected_importer_that_requires_size_when_size_supplied
51
+ FileUtils.cp("./import/samples/shake_script/four_tracks_in_one_stabilizer.shk", "./input.shk")
52
+ pipeline = Tracksperanto::Pipeline::Base.new
53
+ assert_nothing_raised { pipeline.run("./input.shk", :width => 720, :height => 576) }
54
+ end
55
+
56
+ def test_run_with_overridden_importer_and_no_size
57
+ FileUtils.cp("./import/samples/shake_script/four_tracks_in_one_stabilizer.shk", "./input.shk")
58
+ pipeline = Tracksperanto::Pipeline::Base.new
59
+ assert_nothing_raised { pipeline.run("./input.shk", :importer => "Syntheyes", :width => 720, :height => 576) }
60
+ assert_equal 11, Dir.glob("./input*").length, "Eleven files should be present for the input and outputs"
61
+ end
62
+
63
+ def test_run_with_overridden_importer_and_size_for_file_that_would_be_recognized_differently
64
+ FileUtils.cp("./import/samples/shake_script/four_tracks_in_one_stabilizer.shk", "./input.stabilizer")
65
+ pipeline = Tracksperanto::Pipeline::Base.new
66
+ assert_nothing_raised { pipeline.run("./input.stabilizer", :importer => "ShakeScript", :width => 720, :height => 576) }
67
+ end
68
+
69
+ def test_run_with_unknown_format_raises
70
+ FileUtils.touch("./input.txt")
71
+ pipeline = Tracksperanto::Pipeline::Base.new
72
+ assert_raise(RuntimeError) { pipeline.run("./input.txt") }
73
+ assert_raise(RuntimeError) { pipeline.run("./input.txt", :width => 100, :height => 100) }
74
+ assert_raise(RuntimeError) { pipeline.run("./input.txt", :importer => "Syntheyes") }
75
+ end
76
+
77
+ def test_run_with_overridden_importer_and_size
78
+ FileUtils.cp("./import/samples/3de_v4/3de_export_cube.txt", "./input.txt")
79
+ pipeline = Tracksperanto::Pipeline::Base.new
80
+ assert_raise(RuntimeError) { pipeline.run("./input.txt", :importer => "Equalizer4") }
81
+ assert_nothing_raised { pipeline.run("./input.txt", :importer => "Equalizer4", :width => 720, :height => 576) }
82
+ end
83
+
84
+ 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.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -61,6 +61,7 @@ files:
61
61
  - README.txt
62
62
  - Rakefile
63
63
  - bin/tracksperanto
64
+ - coverage.info
64
65
  - lib/export/base.rb
65
66
  - lib/export/equalizer3.rb
66
67
  - lib/export/equalizer4.rb
@@ -141,6 +142,7 @@ files:
141
142
  - test/import/samples/3de_v4/3de_export_cube.txt
142
143
  - test/import/samples/boujou_features_text/boujou_txt_export.txt
143
144
  - test/import/samples/flame_stabilizer/fromCombustion_fromMidClip_wSnap.stabilizer
145
+ - test/import/samples/flame_stabilizer/fromTracksperanto.stabilizer
144
146
  - test/import/samples/flame_stabilizer/hugeFlameSetup.stabilizer
145
147
  - test/import/samples/flame_stabilizer/megaTrack.action.3dtrack.stabilizer
146
148
  - test/import/samples/match_mover/kipPointsMatchmover.rz2
@@ -196,6 +198,7 @@ files:
196
198
  - test/test_flame_builder.rb
197
199
  - test/test_format_detector.rb
198
200
  - test/test_keyframe.rb
201
+ - test/test_pipeline.rb
199
202
  - test/test_progressive_io.rb
200
203
  - test/test_simple_export.rb
201
204
  - test/test_tracker.rb
@@ -268,6 +271,7 @@ test_files:
268
271
  - test/test_flame_builder.rb
269
272
  - test/test_format_detector.rb
270
273
  - test/test_keyframe.rb
274
+ - test/test_pipeline.rb
271
275
  - test/test_progressive_io.rb
272
276
  - test/test_simple_export.rb
273
277
  - test/test_tracker.rb