tracksperanto 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.DS_Store ADDED
Binary file
data/Manifest.txt CHANGED
@@ -1,3 +1,4 @@
1
+ .DS_Store
1
2
  History.txt
2
3
  Manifest.txt
3
4
  README.txt
@@ -20,9 +21,9 @@ lib/middleware/close.rb
20
21
  lib/middleware/golden.rb
21
22
  lib/middleware/scaler.rb
22
23
  lib/middleware/slipper.rb
23
- lib/pipeline.rb
24
24
  lib/pipeline/base.rb
25
25
  lib/tracksperanto.rb
26
+ test/.DS_Store
26
27
  test/helper.rb
27
28
  test/samples/.DS_Store
28
29
  test/samples/].txt
data/bin/tracksperanto CHANGED
@@ -64,6 +64,8 @@ if !input_file
64
64
  end
65
65
 
66
66
  pipe = Tracksperanto::Pipeline::Base.new
67
+ pipe.progress_block = lambda{|percent, msg| puts("#{msg}..#{percent.to_i}% complete") }
68
+
67
69
  pipe.run(input_file, width, height, reader_klass) do | scaler, slipper, golden |
68
70
  slipper.slip = slip
69
71
  scaler.x_factor = scale_x
data/lib/pipeline/base.rb CHANGED
@@ -3,6 +3,7 @@ module Tracksperanto::Pipeline
3
3
  class Base
4
4
  attr_accessor :converted_points
5
5
  attr_accessor :converted_keyframes
6
+ attr_accessor :progress_block
6
7
 
7
8
  def run(from_input_file_path, pix_w, pix_h, parser_class)
8
9
  # Read the input file
@@ -22,26 +23,43 @@ class Base
22
23
  # Yield middlewares to the block
23
24
  yield(scaler, slipper, golden) if block_given?
24
25
 
25
- # Run the export
26
- @converted_points, @converted_keyframes = run_export(read_data, parser, golden)
27
-
26
+ @converted_points, @converted_keyframes = run_export(read_data, parser, golden) do | p, m |
27
+ @progress_block.call(p, m) if @progress_block
28
+ end
28
29
  end
29
30
 
30
- # Runs the export and returns the number of points and keyframes processed
31
+ # Runs the export and returns the number of points and keyframes processed.
32
+ # If a block is passed, the block will receive the percent complete and the last
33
+ # status message that you can pass back to the UI
34
+ # # :yields: percent_complete, status_message
31
35
  def run_export(tracker_data_blob, parser, processor)
32
- points, keyframes = 0, 0
36
+ points, keyframes, percent_complete = 0, 0, 0.0
33
37
 
38
+ yield(percent_complete, "Starting the parse routine") if block_given?
34
39
  trackers = parser.parse(tracker_data_blob)
40
+
41
+ yield(percent_complete = 20.0, "Starting export for #{trackers.length} trackers") if block_given?
42
+
43
+ percent_per_tracker = 80.0 / trackers.length
44
+
35
45
  processor.start_export(parser.width, parser.height)
46
+
47
+ yield(percent_complete, "Starting export") if block_given?
48
+
36
49
  trackers.each do | t |
50
+ kf_weight = percent_per_tracker / t.keyframes.length
37
51
  points += 1
38
52
  processor.start_tracker_segment(t.name)
39
53
  t.keyframes.each do | kf |
40
54
  keyframes += 1
41
55
  processor.export_point(kf.frame, kf.abs_x, kf.abs_y, kf.residual)
56
+ yield(percent_complete += kf_weight, "Writing keyframe") if block_given?
42
57
  end
43
58
  end
44
59
  processor.end_export
60
+
61
+ yield(100.0, "Wrote #{points} points and #{keyframes} keyframes") if block_given?
62
+
45
63
  [points, keyframes]
46
64
  end
47
65
 
data/lib/tracksperanto.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Tracksperanto
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.4'
3
3
 
4
4
  module Import; end
5
5
  module Export; end
data/test/.DS_Store ADDED
Binary file
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class SyntheyesImportTest < Test::Unit::TestCase
4
+ DELTA = 0.1
5
+
6
+ def test_parsing_from_importable
7
+ fixture = File.read(File.dirname(__FILE__) + '/samples/sourcefile_pftrack.2dt')
8
+
9
+ parser = Tracksperanto::Import::PFTrack.new
10
+ parser.width = 2560
11
+ parser.height = 1080
12
+
13
+ trackers = parser.parse(fixture)
14
+ assert_equal 43, trackers.length
15
+
16
+ first_kf = trackers[0].keyframes[0]
17
+ last_kf = trackers[0].keyframes[-1]
18
+
19
+ assert_equal "Tracker1", trackers[0].name
20
+ assert_equal 341, trackers[0].keyframes.length
21
+
22
+ assert_equal 41, first_kf.frame
23
+ assert_in_delta 984.611, first_kf.abs_x, DELTA
24
+ assert_in_delta 30.220, first_kf.abs_y, DELTA
25
+ assert_in_delta 0.0, first_kf.residual, DELTA
26
+
27
+ last_kf = trackers[0].keyframes[-1]
28
+ assert_in_delta 729.330, last_kf.abs_x, DELTA
29
+
30
+ assert_equal "Tracker41", trackers[-1].name
31
+ assert_equal 467, tracker[-1].name
32
+ end
33
+ end
@@ -3,25 +3,25 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{tracksperanto}
6
- s.version = "1.0.0"
6
+ s.version = "1.0.4"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.authors = ["Julik"]
10
- s.date = %q{2009-04-19}
9
+ s.authors = ["Julik Tarkhanov"]
10
+ s.date = %q{2009-09-06}
11
11
  s.default_executable = %q{tracksperanto}
12
- s.description = %q{}
12
+ s.description = %q{Tracksperanto is a universal 2D-track translator between many apps. Import support: * Shake script (one tracker node per tracker) * Shake tracker node export (textfile with many tracks per file), also exported by Boujou and others * PFTrack 2dt files * Syntheyes 2D tracking data exports (UV coordinates) Export support: * Shake text file (many trackers per file), also accepted by Boujou * PFTrack 2dt file (with residuals) * Syntheyes 2D tracking data import (UV coordinates) The main way to use Tracksperanto is to use the supplied "tracksperanto" binary, like so: tracksperanto -f ShakeScript -w 1920 -h 1080 /Films/Blockbuster/Shots/001/script.shk ShakeScript is the name of the translator that will be used to read the file (many apps export tracks as .txt files so there is no way for us to autodetect them all). -w and -h stand for Width and Height and define the size of your comp (different tracking apps use different coordinate systems and we need to know the size of the comp to properly convert these). You also have additional options like -xs, -ys and --slip - consult the usage info for the tracksperanto binary. The converted files will be saved in the same directory as the source, if resulting converted files already exist ++they will be overwritten without warning++.}
13
13
  s.email = ["me@julik.nl"]
14
14
  s.executables = ["tracksperanto"]
15
- s.extra_rdoc_files = ["Manifest.txt", "README.txt", "test/samples/flyover2DP_syntheyes.txt", "test/samples/one_shake_tracker.txt", "test/samples/one_shake_tracker_from_first.txt", "test/samples/shake_tracker_nodes_to_syntheyes.txt", "test/samples/two_shake_trackers.txt"]
16
- s.files = ["Manifest.txt", "README.txt", "Rakefile", "bin/tracksperanto", "lib/export/base.rb", "lib/export/flame_stabilizer.rb", "lib/export/mux.rb", "lib/export/pftrack.rb", "lib/export/shake_text.rb", "lib/export/syntheyes.rb", "lib/import/base.rb", "lib/import/flame_stabilizer.rb", "lib/import/shake_script.rb", "lib/import/shake_text.rb", "lib/import/syntheyes.rb", "lib/middleware/base.rb", "lib/middleware/scaler.rb", "lib/middleware/slipper.rb", "lib/pipeline.rb", "lib/tracksperanto.rb", "test/.DS_Store", "test/helper.rb", "test/samples/.DS_Store", "test/samples/flyover2DP_syntheyes.txt", "test/samples/megaTrack.action.3dtrack.stabilizer", "test/samples/one_shake_tracker.txt", "test/samples/one_shake_tracker_from_first.txt", "test/samples/shake_tracker_nodes.shk", "test/samples/shake_tracker_nodes_to_syntheyes.txt", "test/samples/three_tracks_in_one_stabilizer.shk", "test/samples/two_shake_trackers.txt", "test/samples/two_tracks_in_one_tracker.shk", "test/test_keyframe.rb", "test/test_shake_export.rb", "test/test_shake_script_import.rb", "test/test_shake_text_import.rb", "test/test_syntheyes_import.rb"]
15
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt", "test/samples/].txt", "test/samples/flyover2DP_syntheyes.txt", "test/samples/one_shake_tracker.txt", "test/samples/one_shake_tracker_from_first.txt", "test/samples/shake_tracker_nodes_to_syntheyes.txt", "test/samples/two_shake_trackers.txt"]
16
+ s.files = [".DS_Store", "History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/tracksperanto", "lib/.DS_Store", "lib/export/base.rb", "lib/export/flame_stabilizer.rb", "lib/export/mux.rb", "lib/export/pftrack.rb", "lib/export/shake_text.rb", "lib/export/syntheyes.rb", "lib/import/base.rb", "lib/import/flame_stabilizer.rb", "lib/import/shake_script.rb", "lib/import/shake_text.rb", "lib/import/syntheyes.rb", "lib/middleware/base.rb", "lib/middleware/close.rb", "lib/middleware/golden.rb", "lib/middleware/scaler.rb", "lib/middleware/slipper.rb", "lib/pipeline/base.rb", "lib/tracksperanto.rb", "test/.DS_Store", "test/helper.rb", "test/samples/.DS_Store", "test/samples/].txt", "test/samples/flyover2DP_syntheyes.txt", "test/samples/hugeFlameSetup.stabilizer", "test/samples/megaTrack.action.3dtrack.stabilizer", "test/samples/one_shake_tracker.txt", "test/samples/one_shake_tracker_from_first.txt", "test/samples/shake_tracker_nodes.shk", "test/samples/shake_tracker_nodes_to_syntheyes.txt", "test/samples/three_tracks_in_one_stabilizer.shk", "test/samples/two_shake_trackers.txt", "test/samples/two_tracks_in_one_tracker.shk", "test/test_flame_block.rb", "test/test_keyframe.rb", "test/test_shake_export.rb", "test/test_shake_script_import.rb", "test/test_shake_text_import.rb", "test/test_syntheyes_import.rb", "tracksperanto.gemspec", "test/test_pftrack_import.rb"]
17
17
  s.has_rdoc = true
18
- s.homepage = %q{Tracksperanto is a universal 2D-track translator between many apps.}
18
+ s.homepage = %q{http://guerilla-di.org/tracksperanto}
19
19
  s.rdoc_options = ["--main", "README.txt"]
20
20
  s.require_paths = ["lib"]
21
21
  s.rubyforge_project = %q{guerilla-di}
22
22
  s.rubygems_version = %q{1.3.1}
23
- s.summary = %q{}
24
- s.test_files = ["test/test_keyframe.rb", "test/test_shake_export.rb", "test/test_shake_script_import.rb", "test/test_shake_text_import.rb", "test/test_syntheyes_import.rb"]
23
+ s.summary = %q{Tracksperanto is a universal 2D-track translator between many apps}
24
+ s.test_files = ["test/test_flame_block.rb", "test/test_keyframe.rb", "test/test_pftrack_import.rb", "test/test_shake_export.rb", "test/test_shake_script_import.rb", "test/test_shake_text_import.rb", "test/test_syntheyes_import.rb"]
25
25
 
26
26
  if s.respond_to? :specification_version then
27
27
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
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.0.2
4
+ version: 1.0.4
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: 2009-09-02 00:00:00 +02:00
12
+ date: 2009-09-06 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,6 +40,7 @@ extra_rdoc_files:
40
40
  - test/samples/shake_tracker_nodes_to_syntheyes.txt
41
41
  - test/samples/two_shake_trackers.txt
42
42
  files:
43
+ - .DS_Store
43
44
  - History.txt
44
45
  - Manifest.txt
45
46
  - README.txt
@@ -62,9 +63,9 @@ files:
62
63
  - lib/middleware/golden.rb
63
64
  - lib/middleware/scaler.rb
64
65
  - lib/middleware/slipper.rb
65
- - lib/pipeline.rb
66
66
  - lib/pipeline/base.rb
67
67
  - lib/tracksperanto.rb
68
+ - test/.DS_Store
68
69
  - test/helper.rb
69
70
  - test/samples/.DS_Store
70
71
  - test/samples/].txt
@@ -115,6 +116,7 @@ summary: Tracksperanto is a universal 2D-track translator between many apps
115
116
  test_files:
116
117
  - test/test_flame_block.rb
117
118
  - test/test_keyframe.rb
119
+ - test/test_pftrack_import.rb
118
120
  - test/test_shake_export.rb
119
121
  - test/test_shake_script_import.rb
120
122
  - test/test_shake_text_import.rb
data/lib/pipeline.rb DELETED
File without changes