tracksperanto 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/bin/tracksperanto +4 -2
- data/lib/import/flame_stabilizer.rb +12 -4
- data/lib/import/match_mover.rb +1 -1
- data/lib/import/shake_grammar/catcher.rb +3 -2
- data/lib/pipeline/base.rb +1 -1
- data/lib/tracksperanto.rb +20 -1
- data/test/export/test_equalizer_export.rb +3 -1
- data/test/test_tracksperanto.rb +62 -0
- metadata +3 -2
data/History.txt
CHANGED
data/bin/tracksperanto
CHANGED
@@ -62,6 +62,8 @@ parser = OptionParser.new do | p |
|
|
62
62
|
p.on(" -ym", "--yshift Y_IN_PIXELS", Float, "Move the points up or down") {|sx| y_shift = sx }
|
63
63
|
p.on("--version", "Show the version and exit") {|v|
|
64
64
|
puts "#{Tracksperanto::VERSION} running on Ruby #{RUBY_VERSION} on #{RUBY_PLATFORM}"
|
65
|
+
puts "Copyright 2008-#{Time.now.year} by Guerilla-DI (Julik Tarkhanov and contributors)"
|
66
|
+
puts "For questions and support contact info at guerilla-di.org"
|
65
67
|
exit(0)
|
66
68
|
}
|
67
69
|
end
|
@@ -75,7 +77,7 @@ rescue OptionParser::MissingArgument => e
|
|
75
77
|
end
|
76
78
|
|
77
79
|
begin
|
78
|
-
reader_klass = Tracksperanto
|
80
|
+
reader_klass = Tracksperanto.get_importer(reader_name)
|
79
81
|
rescue NameError => e
|
80
82
|
STDERR.puts "Unknown reader #{reader_name}, available readers: #{readers.join(', ')}"
|
81
83
|
exit(-1)
|
@@ -109,7 +111,7 @@ pipe.progress_block = Spinner.new.method(:spin).to_proc
|
|
109
111
|
|
110
112
|
if sole_format
|
111
113
|
begin
|
112
|
-
pipe.exporters = [Tracksperanto::Export.
|
114
|
+
pipe.exporters = [Tracksperanto::Export.get_exporter(sole_format)]
|
113
115
|
rescue NameError
|
114
116
|
STDERR.puts "Unknown exporter #{sole_format}. Available exporters: #{writers.join(", ")}"
|
115
117
|
exit(-1)
|
@@ -36,13 +36,17 @@ class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
|
|
36
36
|
keyframes = []
|
37
37
|
|
38
38
|
while line = io.gets
|
39
|
-
|
39
|
+
|
40
|
+
unless indent
|
41
|
+
indent = line.scan(/^(\s+)/)[1]
|
42
|
+
end_mark = "#{indent}End"
|
43
|
+
end
|
40
44
|
|
41
45
|
if line =~ keyframe_count_matcher
|
42
46
|
$1.to_i.times { push(extract_key_from(io)) }
|
43
47
|
elsif line =~ base_value_matcher && empty?
|
44
48
|
self.base_value = $1
|
45
|
-
elsif line.strip ==
|
49
|
+
elsif line.strip == end_mark
|
46
50
|
break
|
47
51
|
end
|
48
52
|
end
|
@@ -60,13 +64,17 @@ class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
|
|
60
64
|
if line =~ frame_matcher
|
61
65
|
frame = $1.to_i
|
62
66
|
elsif line =~ value_matcher
|
63
|
-
|
64
|
-
return [frame,value]
|
67
|
+
return [frame, $1.to_f]
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
68
71
|
raise "Did not detect any keyframes!"
|
69
72
|
end
|
73
|
+
|
74
|
+
# Hack - prevents the channel to be flattened into keyframes
|
75
|
+
# when it gets Array#flatten'ed
|
76
|
+
def to_ary; end
|
77
|
+
private :to_ary
|
70
78
|
end
|
71
79
|
|
72
80
|
def parse(io)
|
data/lib/import/match_mover.rb
CHANGED
@@ -36,7 +36,7 @@ class Tracksperanto::Import::MatchMover < Tracksperanto::Import::Base
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def extract_track(start_line, io)
|
39
|
-
tracker_name = start_line.scan(/\"([^\"]+)\"/).
|
39
|
+
tracker_name = start_line.scan(/\"([^\"]+)\"/).flatten[0]
|
40
40
|
t = Tracksperanto::Tracker.new(:name => tracker_name)
|
41
41
|
while(line = io.gets) do
|
42
42
|
return t if line =~ /\}/
|
@@ -35,8 +35,9 @@ module Tracksperanto::ShakeGrammar
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def can_handle_meth?(m)
|
38
|
-
|
39
|
-
@meths.
|
38
|
+
# Ruby 1.9 - match on stringified methname
|
39
|
+
@meths ||= self.class.public_instance_methods(false).map{|mn| mn.to_s }
|
40
|
+
@meths.include?(m.to_s)
|
40
41
|
end
|
41
42
|
|
42
43
|
def exec_funcall(methname, args)
|
data/lib/pipeline/base.rb
CHANGED
@@ -111,7 +111,7 @@ class Tracksperanto::Pipeline::Base
|
|
111
111
|
t.each_with_index do | kf, idx |
|
112
112
|
keyframes += 1
|
113
113
|
processor.export_point(kf.frame, kf.abs_x, kf.abs_y, kf.residual)
|
114
|
-
yield(percent_complete += kf_weight, "Writing keyframe #{idx+1} of #{t.
|
114
|
+
yield(percent_complete += kf_weight, "Writing keyframe #{idx+1} of #{t.name.inspect}") if block_given?
|
115
115
|
end
|
116
116
|
processor.end_tracker_segment
|
117
117
|
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.7.
|
7
|
+
VERSION = '1.7.1'
|
8
8
|
|
9
9
|
module Import; end
|
10
10
|
module Export; end
|
@@ -39,6 +39,25 @@ module Tracksperanto
|
|
39
39
|
|
40
40
|
self.exporters, self.importers, self.middlewares = [], [], []
|
41
41
|
|
42
|
+
# Case-insensitive search for an export module by name
|
43
|
+
def self.get_exporter(name)
|
44
|
+
exporters.each do | x |
|
45
|
+
normalized_name = x.to_s.split("::")[-1].downcase
|
46
|
+
return x if normalized_name == name.downcase
|
47
|
+
end
|
48
|
+
|
49
|
+
raise NameError, "Unknown exporter #{name}"
|
50
|
+
end
|
51
|
+
|
52
|
+
# Case-insensitive search for an export module by name
|
53
|
+
def self.get_importer(name)
|
54
|
+
importers.each do | x |
|
55
|
+
normalized_name = x.to_s.split("::")[-1].downcase
|
56
|
+
return x if normalized_name == name.downcase
|
57
|
+
end
|
58
|
+
|
59
|
+
raise NameError, "Unknown importer #{name}"
|
60
|
+
end
|
42
61
|
end
|
43
62
|
|
44
63
|
%w(
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class Equalizer4ExportTest < Test::Unit::TestCase
|
4
4
|
include ParabolicTracks
|
5
5
|
P = File.dirname(__FILE__) + "/samples/ref_equalizer.txt"
|
6
6
|
|
7
7
|
def test_export_output_written
|
8
|
+
# This test might be failing due to different float rounding between platforms
|
9
|
+
# (currently fails on win ruby and jruby)
|
8
10
|
ensure_same_output Tracksperanto::Export::Equalizer4, P
|
9
11
|
end
|
10
12
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/helper'
|
2
|
+
|
3
|
+
class TracksperantoTest < Test::Unit::TestCase
|
4
|
+
def test_middlewares
|
5
|
+
m = Tracksperanto.middlewares
|
6
|
+
m.each do | middleware_module |
|
7
|
+
assert_kind_of Module, middleware_module
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_exporters
|
12
|
+
m = Tracksperanto.exporters
|
13
|
+
m.each do | x |
|
14
|
+
assert_kind_of Class, x
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_importers
|
19
|
+
m = Tracksperanto.importers
|
20
|
+
m.each do | x |
|
21
|
+
assert_kind_of Class, x
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_middleware_names
|
26
|
+
m = Tracksperanto.middleware_names
|
27
|
+
assert m.include?("Golden")
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_importer_names
|
31
|
+
m = Tracksperanto.importer_names
|
32
|
+
assert m.include?("FlameStabilizer")
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_exporter_names
|
36
|
+
m = Tracksperanto.exporter_names
|
37
|
+
assert m.include?("PFTrack5")
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_get_importer
|
41
|
+
i1 = Tracksperanto.get_importer("syntheyes")
|
42
|
+
assert_equal i1, Tracksperanto::Import::Syntheyes
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_get_importer_multicase
|
46
|
+
i1 = Tracksperanto.get_importer("ShakeScript")
|
47
|
+
assert_equal i1, Tracksperanto::Import::ShakeScript
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_get_exporter
|
51
|
+
i1 = Tracksperanto.get_exporter("syntheyes")
|
52
|
+
assert_equal i1, Tracksperanto::Export::SynthEyes
|
53
|
+
|
54
|
+
i1 = Tracksperanto.get_exporter("SynThEyes")
|
55
|
+
assert_equal i1, Tracksperanto::Export::SynthEyes
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_get_unknown_exporter_should_raise
|
59
|
+
assert_raise(NameError) { Tracksperanto.get_exporter("foo") }
|
60
|
+
end
|
61
|
+
|
62
|
+
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.1
|
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-28 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -238,3 +238,4 @@ test_files:
|
|
238
238
|
- test/test_keyframe.rb
|
239
239
|
- test/test_simple_export.rb
|
240
240
|
- test/test_tracker.rb
|
241
|
+
- test/test_tracksperanto.rb
|