tracksperanto 1.9.1 → 1.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.9.2 / 2010-04-02
2
+
3
+ * Fix a crasher when the progress bar was being set higher than 100 percent
4
+
1
5
  === 1.9.1 / 2010-03-21
2
6
 
3
7
  * Fix a Pipeline bug introduced with the last version
data/Manifest.txt CHANGED
@@ -4,7 +4,6 @@ Manifest.txt
4
4
  README.txt
5
5
  Rakefile
6
6
  bin/tracksperanto
7
- coverage.info
8
7
  lib/export/base.rb
9
8
  lib/export/equalizer3.rb
10
9
  lib/export/equalizer4.rb
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ begin
8
8
  (Hoe::RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
9
9
 
10
10
  Hoe.spec('tracksperanto') do | p |
11
- p.clean_globs = %w( **/.DS_Store )
11
+ p.clean_globs = %w( **/.DS_Store coverage.info )
12
12
  p.version = Tracksperanto::VERSION
13
13
  p.extra_deps = {"progressbar" => ">=0"}
14
14
  p.extra_dev_deps = {"flexmock" => ">=0"}
data/bin/tracksperanto CHANGED
@@ -16,90 +16,57 @@ require 'rubygems'
16
16
  require 'progressbar'
17
17
 
18
18
  # Sane defaults
19
- reader_klass = nil
19
+ reader_klass_name = nil
20
20
  width = nil
21
21
  height = nil
22
22
 
23
- middlewares = []
24
- sole_format = nil
23
+ options = {}
24
+ $middlewares = []
25
+ writer_klass_name = nil
25
26
  reader_name = "ShakeScript"
26
27
  readers = Tracksperanto.importer_names
27
28
  writers = Tracksperanto.exporter_names
28
29
 
29
- parser = OptionParser.new do | p |
30
- p.banner = "Usage: tracksperanto -f ShakeScript -w 1920 -h 1080 /Films/Blockbuster/Shots/001/script.shk"
31
- p.on("--code PATH_TO_SCRIPT", String, "Load custom Ruby code into tracksperanto") {|c|
32
- require c
33
- }
34
- p.on(" -f", "--from TRANSLATOR", String,
35
- "Use the specific import translator (will try to autodetect, but can be #{Tracksperanto.importer_names.join(', ')})") do | f |
36
- reader_name = f
37
- end
38
- p.on(" -w", "--width WIDTH_IN_PIXELS", Integer, "Absolute input comp width in pixels (will try to autodetect)") { |w| width = w }
39
- p.on(" -h", "--height HEIGHT_IN_PIXELS", Integer, "Absolute input comp height in pixels (will try to autodetect)") {|w| height = w }
40
-
41
- p.on(" -xs", "--xscale X_SCALING_FACTOR", Float, "Scale the result in X by this factor (1.0 is the default)") do |sx|
42
- middlewares << ["Scaler", {:x_factor => sx}]
43
- end
44
- p.on(" -ys", "--yscale Y_SCALING_FACTOR", Float, "Scale the result in Y by this factor (1.0 is the default)") do |sy|
45
- middlewares << ["Scaler", {:y_factor => sx}]
46
- end
47
- p.on(" -s", "--slip FRAMES", Integer, "Slip the result by this number of frames, positive is 'later'") do |sy|
48
- middlewares << ["Slipper", {:slip => sx}]
49
- end
50
- p.on(" -g", "--golden", "Reset the residuals of all trackers to 0 (ignore correlation)") do |g_flag|
51
- middlewares << ["Golden", {:enabled => true}]
52
- end
53
- p.on(" -rx", "--reformat-x NEW_PIX_WIDTH", Integer, "Reformat the comp to this width and scale all tracks to it") do |rw|
54
- middlewares << ["Reformat", {:width => rw}]
55
- end
56
- p.on(" -ry", "--reformat-y NEW_PIX_HEIGHT", Integer, "Reformat the comp to this height and scale all tracks to it") do |rh|
57
- middlewares << ["Reformat", {:height => rh}]
58
- end
59
- p.on(" -m", "--min-length LENGTH_IN_FRAMES", Integer, "Only export trackers having more than X keyframes") do | min_kf |
60
- middlewares << ["LengthCutoff", {:min_length => min_kf}]
61
- end
62
- p.on(" -xm", "--xshift X_IN_PIXELS", Float, "Move the points left or right") do |sx|
63
- middlewares << ["Shift", {:x_shift => sx}]
64
- end
65
- p.on(" -ym", "--yshift Y_IN_PIXELS", Float, "Move the points up or down") do |sx|
66
- middlewares << ["Shift", {:y_shift => sx}]
67
- end
68
- p.on(" -p", "--prefix PREFIX", String, "A prefix to prepend to tracker names in bulk") do |w|
69
- middlewares << ["Prefix", {:prefix => w}]
70
- end
71
-
72
- p.on("--lerp", "Linearly interpolate missing keyframes") do
73
- middlewares << ["Lerp", {:enabled => true}]
74
- end
75
-
76
- p.on(" -o", "--only EXPORTER_NAME", String, "Only export the selected format, format must be one of #{writers.join(", ")}") do |f|
77
- sole_format = f
78
- end
30
+ op = OptionParser.new
79
31
 
80
- p.on("--version", "Show the version and exit") {|v|
32
+ def mw(name, option)
33
+ Proc.new { |value| $middlewares.push([name, {option => value}]) }
34
+ end
35
+
36
+ op.banner = "Usage: tracksperanto -f ShakeScript -w 1920 -h 1080 /Films/Blockbuster/Shots/001/script.shk"
37
+ op.on("--code PATH_TO_SCRIPT", String, "Load custom Ruby code into tracksperanto") {|c| require(c) }
38
+ op.on(" -f", "--from TRANSLATOR", String, "Use the specific import translator") { |f| options[:importer] = f }
39
+ op.on(" -w", "--width WIDTH_IN_PIXELS", Integer, "Absolute input comp width in pixels (will try to autodetect)") { |w| options[:width] = w }
40
+ op.on(" -h", "--height HEIGHT_IN_PIXELS", Integer, "Absolute input comp height in pixels (will try to autodetect)") {|w| options[:height] = w }
41
+ op.on(" -o", "--only EXPORTER_NAME", String, "Only export the selected format, format must be one of #{writers.join(", ")}") { |f| writer_klass_name = f }
42
+
43
+ op.on(" -xs", "--xscale X_SCALING_FACTOR", Float, "Scale the result in X by this factor (1.0 is the default)", &mw("Scaler", :x_factor))
44
+ op.on(" -ys", "--yscale Y_SCALING_FACTOR", Float, "Scale the result in Y by this factor (1.0 is the default)", &mw("Scaler", :y_factor))
45
+ op.on(" -s", "--slip FRAMES", Integer, "Slip the result by this number of frames, positive is 'later'", &mw("Slipper", :slip))
46
+ op.on(" -g", "--golden", "Reset the residuals of all trackers to 0 (ignore correlation)", &mw("Golden", :enabled))
47
+ op.on(" -rx", "--reformat-x NEW_PIX_WIDTH", Integer, "Reformat the comp to this width and scale all tracks to it", &mw("Reformat", :width))
48
+ op.on(" -ry", "--reformat-y NEW_PIX_HEIGHT", Integer, "Reformat the comp to this height and scale all tracks to it", &mw("Reformat", :height))
49
+ op.on(" -m", "--min-length LENGTH_IN_FRAMES", Integer, "Only export trackers having more than X keyframes", &mw("LengthCutoff", :min_length))
50
+ op.on(" -xm", "--xshift X_IN_PIXELS", Float, "Move the points left or right", &mw("Shift", :x_shift))
51
+ op.on(" -ym", "--yshift Y_IN_PIXELS", Float, "Move the points up or down", &mw("Shift", :y_shift))
52
+ op.on(" -p", "--prefix PREFIX", String, "A prefix to prepend to tracker names in bulk", &mw("Prefix", :prefix))
53
+ op.on("--lerp", "Linearly interpolate missing keyframes", &mw("Lerp", :enabled))
54
+
55
+ op.on("--version", "Show the version and exit") do |v|
81
56
  puts "Tracksperanto v.#{Tracksperanto::VERSION} running on Ruby #{RUBY_VERSION} on #{RUBY_PLATFORM}"
82
57
  puts "Copyright 2008-#{Time.now.year} by Guerilla-DI (Julik Tarkhanov and contributors)"
83
58
  puts "For questions and support contact info#{64.chr}guerilla-di.org"
84
59
  exit(0)
85
- }
86
60
  end
87
61
 
88
62
  begin
89
- parser.parse!
63
+ op.parse!
90
64
  rescue OptionParser::MissingArgument => e
91
65
  STDERR.puts "Unknown argument: #{e.message}"
92
66
  puts parser
93
67
  exit(-1)
94
68
  end
95
69
 
96
- begin
97
- reader_klass = Tracksperanto.get_importer(reader_name)
98
- rescue NameError => e
99
- STDERR.puts "Unknown reader #{reader_name}, available readers: #{readers.join(', ')}"
100
- exit(-1)
101
- end
102
-
103
70
  input_file = ARGV.pop
104
71
  if !input_file
105
72
  STDERR.puts "No input file provided - should be the last argument. Also use the --help option."
@@ -107,17 +74,17 @@ if !input_file
107
74
  end
108
75
 
109
76
  pbar = ProgressBar.new("Converting", 100)
110
- pipe = Tracksperanto::Pipeline::Base.new(:progress_block => lambda{|p,m| pbar.set(p) }, :middleware_tuples => middlewares)
77
+ pipe = Tracksperanto::Pipeline::Base.new(:progress_block => lambda{|p,m| pbar.set(p.to_i) }, :middleware_tuples => $middlewares)
111
78
 
112
- if sole_format
79
+ if writer_klass_name
113
80
  begin
114
- pipe.exporters = [Tracksperanto.get_exporter(sole_format)]
81
+ pipe.exporters = [Tracksperanto.get_exporter(writer_klass_name)]
115
82
  rescue NameError
116
- STDERR.puts "Unknown exporter #{sole_format}. Available exporters: #{writers.join(", ")}"
83
+ STDERR.puts "Unknown exporter #{writer_klass_name}. Available exporters: #{writers.join(", ")}"
117
84
  exit(-1)
118
85
  end
119
86
  end
120
87
 
121
- pipe.run(input_file, :width => width, :height => height, :parser => reader_klass)
88
+ pipe.run(input_file, options)
122
89
  pbar.finish
123
90
  puts ("Converted #{pipe.converted_points} trackers with #{pipe.converted_keyframes} keys")
data/lib/pipeline/base.rb CHANGED
@@ -114,13 +114,13 @@ class Tracksperanto::Pipeline::Base
114
114
 
115
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)
119
-
119
+
120
120
  report_progress(percent_complete, "Starting export")
121
-
121
+
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
125
  exporter.start_export(importer.width, importer.height)
126
126
  trackers.each_with_index do | t, tracker_idx |
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.1'
7
+ VERSION = '1.9.2'
8
8
 
9
9
  module Import; end
10
10
  module Export; end
@@ -6,8 +6,8 @@ class TestProgressiveIO < Test::Unit::TestCase
6
6
 
7
7
  # Make a mock File object from a string
8
8
  io = StringIO.new(s)
9
- mock_stat = flexmock(:size => s.length)
10
- flexmock(io).should_receive(:stat).and_return(mock_stat)
9
+ mock_stat = flexmock(:size => s.length)
10
+ flexmock(io).should_receive(:stat).and_return(mock_stat)
11
11
 
12
12
  Tracksperanto::ProgressiveIO.new(io)
13
13
  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.1
4
+ version: 1.9.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-03-21 00:00:00 +01:00
12
+ date: 2010-04-02 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -61,7 +61,6 @@ files:
61
61
  - README.txt
62
62
  - Rakefile
63
63
  - bin/tracksperanto
64
- - coverage.info
65
64
  - lib/export/base.rb
66
65
  - lib/export/equalizer3.rb
67
66
  - lib/export/equalizer4.rb
data/coverage.info DELETED
Binary file