tracksperanto 2.5.0 → 2.6.0
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/Gemfile +14 -0
- data/History.txt +5 -0
- data/Manifest.txt +3 -0
- data/Rakefile +6 -6
- data/bin/tracksperanto +5 -2
- data/lib/export/match_mover.rb +1 -1
- data/lib/import/flame_stabilizer.rb +0 -1
- data/lib/import/match_mover.rb +1 -1
- data/lib/middleware/start_trim.rb +16 -0
- data/lib/tracksperanto/buffer_io.rb +2 -0
- data/lib/tracksperanto.rb +1 -1
- data/test/export/test_match_mover_export.rb +1 -1
- data/test/helper.rb +9 -1
- data/test/import/test_match_mover_import.rb +1 -1
- data/test/middleware/test_start_trim_middleware.rb +42 -0
- data/test/test_cli.rb +11 -17
- metadata +27 -12
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.
|
4
|
+
|
5
|
+
source :gemcutter
|
6
|
+
|
7
|
+
gem "progressbar", "~>0.9"
|
8
|
+
gem "update_hints", "~>1.0"
|
9
|
+
|
10
|
+
gem "flexmock", "~>0.8", :group => [:development, :test]
|
11
|
+
gem "cli_test", "~>1.0", :group => [:development, :test]
|
12
|
+
gem "hoe", ">=2.9.4", :group => [:development, :test]
|
13
|
+
|
14
|
+
# vim: syntax=ruby
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
.yardopts
|
2
2
|
DEVELOPER_DOCS.rdoc
|
3
|
+
Gemfile
|
3
4
|
History.txt
|
4
5
|
MIT_LICENSE.txt
|
5
6
|
Manifest.txt
|
@@ -47,6 +48,7 @@ lib/middleware/reformat.rb
|
|
47
48
|
lib/middleware/scaler.rb
|
48
49
|
lib/middleware/shift.rb
|
49
50
|
lib/middleware/slipper.rb
|
51
|
+
lib/middleware/start_trim.rb
|
50
52
|
lib/pipeline/base.rb
|
51
53
|
lib/tracksperanto.rb
|
52
54
|
lib/tracksperanto/accumulator.rb
|
@@ -163,6 +165,7 @@ test/middleware/test_reformat_middleware.rb
|
|
163
165
|
test/middleware/test_scaler_middleware.rb
|
164
166
|
test/middleware/test_shift_middleware.rb
|
165
167
|
test/middleware/test_slip_middleware.rb
|
168
|
+
test/middleware/test_start_trim_middleware.rb
|
166
169
|
test/test_accumulator.rb
|
167
170
|
test/test_buffer_io.rb
|
168
171
|
test/test_cli.rb
|
data/Rakefile
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require './lib/tracksperanto'
|
3
|
-
|
4
2
|
begin
|
5
3
|
require 'hoe'
|
6
4
|
|
5
|
+
Hoe::RUBY_FLAGS.gsub!(/^\-w/, '') # No thanks undefined ivar warnings
|
6
|
+
Hoe.plugin :bundler
|
7
7
|
Hoe.spec('tracksperanto') do | p |
|
8
8
|
p.readme_file = 'README.rdoc'
|
9
9
|
p.extra_rdoc_files = FileList['*.rdoc'] + FileList['*.txt']
|
10
10
|
p.version = Tracksperanto::VERSION
|
11
11
|
|
12
|
-
p.extra_deps = {"progressbar" => "
|
13
|
-
p.extra_dev_deps = {"flexmock" => "
|
14
|
-
|
12
|
+
p.extra_deps = {"progressbar" => "~> 0.9", "update_hints" => "~> 1.0" }
|
13
|
+
p.extra_dev_deps = {"flexmock" => "~> 0.8", "cli_test" => "~>1.0"}
|
14
|
+
|
15
15
|
p.developer('Julik Tarkhanov', 'me@julik.nl')
|
16
|
-
p.clean_globs =
|
16
|
+
p.clean_globs = File.read(File.dirname(__FILE__) + "/.gitignore").split(/\s/).to_a
|
17
17
|
end
|
18
18
|
rescue LoadError
|
19
19
|
|
data/bin/tracksperanto
CHANGED
@@ -60,6 +60,7 @@ op.on("--code PATH_TO_SCRIPT", String, "Load custom Ruby code into tracksperanto
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
|
63
64
|
op.on(" -f", "--from TRANSLATOR", String, "Use the specific import translator") { |f| options[:importer] = f }
|
64
65
|
op.on(" -w", "--width WIDTH_IN_PIXELS", Integer, "Absolute input comp width in pixels (will try to autodetect)") { |w| options[:width] = w }
|
65
66
|
op.on(" -h", "--height HEIGHT_IN_PIXELS", Integer, "Absolute input comp height in pixels (will try to autodetect)") {|w| options[:height] = w }
|
@@ -67,7 +68,9 @@ op.on(" -o", "--only EXPORTER_NAME", String, "Only export the selected format, f
|
|
67
68
|
|
68
69
|
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))
|
69
70
|
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))
|
71
|
+
op.on(" -t", "--trim", "Trim the start frames (do not allow negative frame values)", &mw("StartTrim", :enabled, true)) # Before slip!
|
70
72
|
op.on(" -s", "--slip FRAMES", Integer, "Slip the result by this number of frames, positive is 'later'", &mw("Slipper", :slip))
|
73
|
+
|
71
74
|
op.on(" -g", "--golden", "Reset the residuals of all trackers to 0 (ignore correlation)", &mw("Golden", :enabled, true))
|
72
75
|
op.on(" -rx", "--reformat-x NEW_PIX_WIDTH", Integer, "Reformat the comp to this width and scale all tracks to it", &mw("Reformat", :width))
|
73
76
|
op.on(" -ry", "--reformat-y NEW_PIX_HEIGHT", Integer, "Reformat the comp to this height and scale all tracks to it", &mw("Reformat", :height))
|
@@ -102,12 +105,12 @@ end
|
|
102
105
|
input_file = ARGV.pop
|
103
106
|
unless input_file
|
104
107
|
$stderr.puts "No input file provided - should be the last argument. Also use the --help option."
|
105
|
-
exit(
|
108
|
+
exit(1)
|
106
109
|
end
|
107
110
|
|
108
111
|
unless File.exist?(input_file)
|
109
112
|
$stderr.puts "Input file #{input_file} does not exist"
|
110
|
-
exit(
|
113
|
+
exit(1)
|
111
114
|
end
|
112
115
|
|
113
116
|
pbar = ProgressBar.new("Converting", 100, $stderr)
|
data/lib/export/match_mover.rb
CHANGED
@@ -6,7 +6,7 @@ class Tracksperanto::Export::MatchMover < Tracksperanto::Export::Base
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.human_name
|
9
|
-
"
|
9
|
+
"MatchMover REALVIZ Ascii Point Tracks .rz2 file"
|
10
10
|
end
|
11
11
|
|
12
12
|
PREAMBLE = %[imageSequence "Sequence 01"\n{\n\t%d\t%d\tf( "D:/temp/sequence.%%04d.dpx" )\tb( 1 211 1 )\t\n}\n]
|
@@ -77,7 +77,6 @@ class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
|
|
77
77
|
report_progress("Extracting all animation channels")
|
78
78
|
channels, names = extract_channels_from_stream(@io)
|
79
79
|
|
80
|
-
raise "The setup contained no channels that we could process" if channels.empty?
|
81
80
|
raise "A channel was nil" if channels.find{|e| e.nil? }
|
82
81
|
|
83
82
|
report_progress("Assembling tracker curves from channels")
|
data/lib/import/match_mover.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# This middleware removes all keyframes before frame 0, and skips trackers entirely if they are all before frame 0
|
2
|
+
class Tracksperanto::Middleware::StartTrim < Tracksperanto::Middleware::Base
|
3
|
+
attr_accessor :enabled
|
4
|
+
|
5
|
+
def start_export( img_width, img_height)
|
6
|
+
if @enabled
|
7
|
+
@exporter = Tracksperanto::Middleware::LengthCutoff.new(@exporter, :min_length => 1) # Ensure at least one keyframe
|
8
|
+
end
|
9
|
+
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def export_point(frame, float_x, float_y, float_residual)
|
14
|
+
return super unless (@enabled && frame < 0)
|
15
|
+
end
|
16
|
+
end
|
@@ -48,6 +48,8 @@ class Tracksperanto::BufferIO < DelegateClass(IO)
|
|
48
48
|
def replace_with_tempfile
|
49
49
|
sio = __getobj__
|
50
50
|
tf = Tempfile.new("tracksperanto-xbuf")
|
51
|
+
tf.set_encoding(Encoding::BINARY) if @rewindable_io.respond_to?(:set_encoding)
|
52
|
+
tf.binmode
|
51
53
|
tf.write(sio.string)
|
52
54
|
tf.flush # Needed of we will reopen this file soon from another thread/loop
|
53
55
|
sio.string = ""
|
data/lib/tracksperanto.rb
CHANGED
@@ -10,7 +10,7 @@ class MatchmoverExportTest < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_exporter_meta
|
12
12
|
assert_equal "matchmover.rz2", Tracksperanto::Export::MatchMover.desc_and_extension
|
13
|
-
assert_equal "
|
13
|
+
assert_equal "MatchMover REALVIZ Ascii Point Tracks .rz2 file", Tracksperanto::Export::MatchMover.human_name
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_width_and_height_not_stepping_on_each_other_in_preamble
|
data/test/helper.rb
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../lib/tracksperanto' unless defined?(Tracksperanto)
|
2
2
|
require 'test/unit'
|
3
|
-
require 'rubygems'
|
4
3
|
require 'flexmock'
|
5
4
|
require 'flexmock/test_unit'
|
6
5
|
require 'fileutils'
|
7
6
|
|
7
|
+
# http://redmine.ruby-lang.org/issues/4882
|
8
|
+
# https://github.com/jimweirich/flexmock/issues/4
|
9
|
+
# https://github.com/julik/flexmock/commit/4acea00677e7b558bd564ec7c7630f0b27d368ca
|
10
|
+
class FlexMock::PartialMockProxy
|
11
|
+
def singleton?(method_name)
|
12
|
+
@obj.singleton_methods.include?(method_name.to_s)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
# This module creates ideal parabolic tracks for testing exporters. The two trackers
|
9
17
|
# will start at opposite corners of the image and traverse two parabolic curves, touching
|
10
18
|
# the bounds of the image at the and and in the middle. On the middle frame they will vertically
|
@@ -7,7 +7,7 @@ class MatchMoverImportTest < Test::Unit::TestCase
|
|
7
7
|
|
8
8
|
def test_introspects_properly
|
9
9
|
i = Tracksperanto::Import::MatchMover
|
10
|
-
assert_equal "MatchMover .rz2 file", i.human_name
|
10
|
+
assert_equal "MatchMover REALVIZ Ascii Point Tracks .rz2 file", i.human_name
|
11
11
|
assert i.autodetects_size?
|
12
12
|
end
|
13
13
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
2
|
+
|
3
|
+
class StartTrimMiddlewareTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_default_set_to_false
|
6
|
+
m = Tracksperanto::Middleware::StartTrim.new(nil)
|
7
|
+
assert_nil m.enabled
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_start_trim_supports_hash_init
|
11
|
+
m = Tracksperanto::Middleware::StartTrim.new(nil, :enabled => true)
|
12
|
+
assert_equal true, m.enabled
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_start_mw_works
|
16
|
+
x = flexmock(:exporter)
|
17
|
+
|
18
|
+
x.should_receive(:start_export).once.with(720, 576)
|
19
|
+
x.should_receive(:start_tracker_segment).once.with("TrackerBehind")
|
20
|
+
x.should_receive(:export_point).once.with(0, 100, 100, 0.56)
|
21
|
+
x.should_receive(:end_tracker_segment).once
|
22
|
+
x.should_receive(:end_export).once
|
23
|
+
|
24
|
+
m = Tracksperanto::Middleware::StartTrim.new(x, :enabled => true)
|
25
|
+
|
26
|
+
m.start_export(720, 576)
|
27
|
+
m.start_tracker_segment("TrackerBehind")
|
28
|
+
m.export_point(-2, 120, 87, 0.56)
|
29
|
+
m.export_point(-1, 110, 92, 0.56)
|
30
|
+
m.export_point(0, 100, 100, 0.56)
|
31
|
+
m.end_tracker_segment
|
32
|
+
|
33
|
+
# This tracker should be skipped since it's now entirely behind the 0 frame mark
|
34
|
+
m.start_tracker_segment("SecondTracker")
|
35
|
+
m.export_point(-567, 120, 87, 0.56)
|
36
|
+
m.export_point(-566, 110, 92, 0.56)
|
37
|
+
m.export_point(-564, 100, 100, 0.56)
|
38
|
+
m.end_tracker_segment
|
39
|
+
|
40
|
+
m.end_export
|
41
|
+
end
|
42
|
+
end
|
data/test/test_cli.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
2
2
|
require "set"
|
3
|
+
require "cli_test"
|
3
4
|
|
4
5
|
class CliTest < Test::Unit::TestCase
|
5
6
|
TEMP_DIR = File.expand_path(File.dirname(__FILE__) + "/tmp")
|
@@ -16,32 +17,18 @@ class CliTest < Test::Unit::TestCase
|
|
16
17
|
|
17
18
|
# Run the tracksperanto binary with passed options, and return [exit_code, stdout_content, stderr_content]
|
18
19
|
def cli(commandline_arguments)
|
19
|
-
|
20
|
-
os, es = StringIO.new, StringIO.new
|
21
|
-
begin
|
22
|
-
$stdout, $stderr, verbosity = os, es, $VERBOSE
|
23
|
-
ARGV.replace(commandline_arguments.split)
|
24
|
-
$VERBOSE = false
|
25
|
-
load(BIN_P)
|
26
|
-
return [0, os.string, es.string]
|
27
|
-
rescue SystemExit => boom # The binary uses exit(), we use that to preserve the output code
|
28
|
-
return [boom.status, os.string, es.string]
|
29
|
-
ensure
|
30
|
-
$VERBOSE = verbosity
|
31
|
-
ARGV.replace(old_argv)
|
32
|
-
$stdout, $stderr = old_stdout, old_stderr
|
33
|
-
end
|
20
|
+
CLITest.new(BIN_P).run(commandline_arguments)
|
34
21
|
end
|
35
22
|
|
36
23
|
def test_cli_with_no_args_produces_usage
|
37
24
|
status, o, e = cli('')
|
38
|
-
assert_equal
|
25
|
+
assert_equal 1, status
|
39
26
|
assert_match /Also use the --help option/, e
|
40
27
|
end
|
41
28
|
|
42
29
|
def test_cli_with_nonexisting_file
|
43
30
|
status, o, e = cli(TEMP_DIR + "/nonexisting.file")
|
44
|
-
assert_equal
|
31
|
+
assert_equal 1, status
|
45
32
|
assert_equal "Input file #{TEMP_DIR + "/nonexisting.file"} does not exist\n", e
|
46
33
|
end
|
47
34
|
|
@@ -74,6 +61,13 @@ class CliTest < Test::Unit::TestCase
|
|
74
61
|
assert_equal 340, p.height, "The height of the converted setup should be that"
|
75
62
|
end
|
76
63
|
|
64
|
+
def test_cli_trim
|
65
|
+
FileUtils.cp(File.dirname(__FILE__) + "/import/samples/flame_stabilizer/fromCombustion_fromMidClip_wSnap.stabilizer", TEMP_DIR + "/flm.stabilizer")
|
66
|
+
results = cli("--slip -8000 --trim --only flamestabilizer #{TEMP_DIR}/flm.stabilizer")
|
67
|
+
assert_not_equal 0, results[0] # status
|
68
|
+
assert_match /There were no trackers exported /, results[-1] # STDERR
|
69
|
+
end
|
70
|
+
|
77
71
|
# We use this instead of assert_equals for arrays since different filesystems
|
78
72
|
# return files in different order
|
79
73
|
def assert_same_set(expected_enum, enum, message = "Should be the same set")
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tracksperanto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.
|
5
|
+
version: 2.6.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Julik Tarkhanov
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-07-11 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: progressbar
|
@@ -18,9 +18,9 @@ dependencies:
|
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
23
|
+
version: "0.9"
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|
@@ -29,9 +29,9 @@ dependencies:
|
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: "0"
|
34
|
+
version: "1.0"
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -40,22 +40,33 @@ dependencies:
|
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: "0"
|
45
|
+
version: "0.8"
|
46
46
|
type: :development
|
47
47
|
version_requirements: *id003
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: cli_test
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ~>
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: "1.0"
|
57
57
|
type: :development
|
58
58
|
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: hoe
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "2.10"
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id005
|
59
70
|
description: Tracksperanto is a universal 2D-track translator between many apps.
|
60
71
|
email:
|
61
72
|
- me@julik.nl
|
@@ -72,6 +83,7 @@ extra_rdoc_files:
|
|
72
83
|
files:
|
73
84
|
- .yardopts
|
74
85
|
- DEVELOPER_DOCS.rdoc
|
86
|
+
- Gemfile
|
75
87
|
- History.txt
|
76
88
|
- MIT_LICENSE.txt
|
77
89
|
- Manifest.txt
|
@@ -119,6 +131,7 @@ files:
|
|
119
131
|
- lib/middleware/scaler.rb
|
120
132
|
- lib/middleware/shift.rb
|
121
133
|
- lib/middleware/slipper.rb
|
134
|
+
- lib/middleware/start_trim.rb
|
122
135
|
- lib/pipeline/base.rb
|
123
136
|
- lib/tracksperanto.rb
|
124
137
|
- lib/tracksperanto/accumulator.rb
|
@@ -235,6 +248,7 @@ files:
|
|
235
248
|
- test/middleware/test_scaler_middleware.rb
|
236
249
|
- test/middleware/test_shift_middleware.rb
|
237
250
|
- test/middleware/test_slip_middleware.rb
|
251
|
+
- test/middleware/test_start_trim_middleware.rb
|
238
252
|
- test/test_accumulator.rb
|
239
253
|
- test/test_buffer_io.rb
|
240
254
|
- test/test_cli.rb
|
@@ -272,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
286
|
version: "0"
|
273
287
|
requirements: []
|
274
288
|
|
275
|
-
rubyforge_project:
|
289
|
+
rubyforge_project: tracksperanto
|
276
290
|
rubygems_version: 1.8.5
|
277
291
|
signing_key:
|
278
292
|
specification_version: 3
|
@@ -315,6 +329,7 @@ test_files:
|
|
315
329
|
- test/middleware/test_scaler_middleware.rb
|
316
330
|
- test/middleware/test_shift_middleware.rb
|
317
331
|
- test/middleware/test_slip_middleware.rb
|
332
|
+
- test/middleware/test_start_trim_middleware.rb
|
318
333
|
- test/test_accumulator.rb
|
319
334
|
- test/test_buffer_io.rb
|
320
335
|
- test/test_cli.rb
|