tracksperanto 2.6.3 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +3 -5
- data/Rakefile +2 -0
- data/lib/export/shake_text.rb +1 -1
- data/lib/import/shake_grammar/lexer.rb +7 -2
- data/lib/import/shake_text.rb +1 -1
- data/lib/pipeline/base.rb +7 -7
- data/lib/tracksperanto/buffering_reader.rb +40 -0
- data/lib/tracksperanto.rb +13 -3
- data/test/export/test_shake_export.rb +1 -1
- data/test/import/samples/shake_text/nuke_camtracker.txt +11240 -0
- data/test/import/test_pftrack_import.rb +1 -1
- data/test/import/test_shake_text_import.rb +21 -1
- data/test/test_bufferingreader.rb +47 -0
- data/test/test_pipeline.rb +2 -2
- metadata +40 -21
- data/lib/tracksperanto/accumulator.rb +0 -103
- data/lib/tracksperanto/progressive_io.rb +0 -78
- data/test/fixtures/processing_log.txt +0 -50
- data/test/test_accumulator.rb +0 -74
- data/test/test_progressive_io.rb +0 -128
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 2.7.0 / 2011-13-10
|
2
|
+
|
3
|
+
* Speedup Shake script parsing by using a buffering reader
|
4
|
+
|
5
|
+
=== 2.6.4 / 2011-29-08
|
6
|
+
|
7
|
+
* Use various external dependencies that we extracted
|
8
|
+
* Note that Nuke now supports import and export of camera tracker features!
|
9
|
+
|
1
10
|
=== 2.6.3 / 2011-31-07
|
2
11
|
|
3
12
|
* Report progress from the parser for Flame, like it has been before
|
data/Manifest.txt
CHANGED
@@ -51,16 +51,15 @@ lib/middleware/slipper.rb
|
|
51
51
|
lib/middleware/start_trim.rb
|
52
52
|
lib/pipeline/base.rb
|
53
53
|
lib/tracksperanto.rb
|
54
|
-
lib/tracksperanto/accumulator.rb
|
55
54
|
lib/tracksperanto/block_init.rb
|
56
55
|
lib/tracksperanto/buffer_io.rb
|
56
|
+
lib/tracksperanto/buffering_reader.rb
|
57
57
|
lib/tracksperanto/casts.rb
|
58
58
|
lib/tracksperanto/const_name.rb
|
59
59
|
lib/tracksperanto/ext_io.rb
|
60
60
|
lib/tracksperanto/flame_builder.rb
|
61
61
|
lib/tracksperanto/format_detector.rb
|
62
62
|
lib/tracksperanto/keyframe.rb
|
63
|
-
lib/tracksperanto/progressive_io.rb
|
64
63
|
lib/tracksperanto/returning.rb
|
65
64
|
lib/tracksperanto/safety.rb
|
66
65
|
lib/tracksperanto/simple_export.rb
|
@@ -94,7 +93,6 @@ test/export/test_pftrack5_export.rb
|
|
94
93
|
test/export/test_pftrack_export.rb
|
95
94
|
test/export/test_shake_export.rb
|
96
95
|
test/export/test_syntheyes_export.rb
|
97
|
-
test/fixtures/processing_log.txt
|
98
96
|
test/helper.rb
|
99
97
|
test/import/samples/3de_v3/3de_export_v3.txt
|
100
98
|
test/import/samples/3de_v4/3de_export_cube.txt
|
@@ -135,6 +133,7 @@ test/import/samples/shake_script/stabilize_nodes_with_hermite.shk
|
|
135
133
|
test/import/samples/shake_script/three_tracks_in_one_stabilizer.shk
|
136
134
|
test/import/samples/shake_script/track.shk
|
137
135
|
test/import/samples/shake_script/two_tracks_in_one_tracker.shk
|
136
|
+
test/import/samples/shake_text/nuke_camtracker.txt
|
138
137
|
test/import/samples/shake_text/one_shake_tracker.txt
|
139
138
|
test/import/samples/shake_text/one_shake_tracker_from_first.txt
|
140
139
|
test/import/samples/shake_text/two_shake_trackers.txt
|
@@ -168,8 +167,8 @@ test/middleware/test_scaler_middleware.rb
|
|
168
167
|
test/middleware/test_shift_middleware.rb
|
169
168
|
test/middleware/test_slip_middleware.rb
|
170
169
|
test/middleware/test_start_trim_middleware.rb
|
171
|
-
test/test_accumulator.rb
|
172
170
|
test/test_buffer_io.rb
|
171
|
+
test/test_bufferingreader.rb
|
173
172
|
test/test_cli.rb
|
174
173
|
test/test_const_name.rb
|
175
174
|
test/test_extio.rb
|
@@ -177,7 +176,6 @@ test/test_flame_builder.rb
|
|
177
176
|
test/test_format_detector.rb
|
178
177
|
test/test_keyframe.rb
|
179
178
|
test/test_pipeline.rb
|
180
|
-
test/test_progressive_io.rb
|
181
179
|
test/test_simple_export.rb
|
182
180
|
test/test_tracker.rb
|
183
181
|
test/test_tracksperanto.rb
|
data/Rakefile
CHANGED
data/lib/export/shake_text.rb
CHANGED
@@ -9,7 +9,7 @@ class Tracksperanto::Export::ShakeText < Tracksperanto::Export::Base
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.human_name
|
12
|
-
"Shake trackers in a .txt file"
|
12
|
+
"Shake trackers in a .txt file (also usable with Nuke's CameraTracker)"
|
13
13
|
end
|
14
14
|
|
15
15
|
def start_tracker_segment(tracker_name)
|
@@ -20,8 +20,13 @@ module Tracksperanto::ShakeGrammar
|
|
20
20
|
# to the downstream lexers instantiated for nested data structures.
|
21
21
|
# You can use the sentinel to collect data from child nodes for example.
|
22
22
|
def initialize(with_io, sentinel = nil, limit_to_one_stmt = false, stack_depth = 0)
|
23
|
+
# We parse byte by byte, but reading byte by byte is very slow. We therefore use a buffering reader
|
24
|
+
# that will cache in chunks, and then read from there byte by byte. This yields a substantial speedup (4.9 seconds for the test
|
25
|
+
# as opposed to 7.9 without this). We do check for the proper class only once so that when we use nested lexers
|
26
|
+
# we only wrap the passed IO once, and only if necessary.
|
27
|
+
with_io = Tracksperanto::BufferingReader.new(with_io) unless with_io.respond_to?(:read_one_byte)
|
23
28
|
@io, @stack, @buf, @sentinel, @limit_to_one_stmt, @stack_depth = with_io, [], '', sentinel, limit_to_one_stmt, stack_depth
|
24
|
-
catch(STOP_TOKEN) { parse until @io.
|
29
|
+
catch(STOP_TOKEN) { parse until @io.data_exhausted? }
|
25
30
|
@in_comment ? consume_comment! : consume_atom!
|
26
31
|
end
|
27
32
|
|
@@ -38,7 +43,7 @@ module Tracksperanto::ShakeGrammar
|
|
38
43
|
|
39
44
|
def parse
|
40
45
|
|
41
|
-
c = @io.
|
46
|
+
c = @io.read_one_byte
|
42
47
|
|
43
48
|
if @buf.length > MAX_BUFFER_SIZE # Wrong format and the buffer is filled up, bail
|
44
49
|
raise WrongInputError, "Atom buffer overflow at #{MAX_BUFFER_SIZE} bytes, this is definitely not a Shake script"
|
data/lib/import/shake_text.rb
CHANGED
data/lib/pipeline/base.rb
CHANGED
@@ -20,7 +20,8 @@ module Tracksperanto::Pipeline
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
# The base pipeline is the whole process of track conversion from start to finish.
|
23
|
+
# The base pipeline is the whole process of track conversion from start to finish.
|
24
|
+
# The pipeline object organizes the import formats, scans them,
|
24
25
|
# applies the middlewares. Here's how a calling sequence for a pipeline looks like:
|
25
26
|
#
|
26
27
|
# pipe = Tracksperanto::Pipeline::Base.new
|
@@ -157,18 +158,17 @@ module Tracksperanto::Pipeline
|
|
157
158
|
|
158
159
|
@ios.push(io_with_progress)
|
159
160
|
|
160
|
-
@accumulator =
|
161
|
+
@accumulator = Obuf.new
|
161
162
|
|
162
163
|
begin
|
163
164
|
|
164
|
-
|
165
|
-
|
165
|
+
if importer.respond_to?(:each)
|
166
|
+
importer.io = io_with_progress
|
167
|
+
importer.each {|t| @accumulator.push(t) unless t.empty? }
|
168
|
+
else # OBSOLETE - for this version we are going to permit it.
|
166
169
|
STDERR.puts "Import::Base#stream_parse(io) is obsolete, please rewrite your importer to use each instead"
|
167
170
|
importer.receiver = @accumulator
|
168
171
|
importer.stream_parse(io_with_progress)
|
169
|
-
else
|
170
|
-
importer.io = io_with_progress
|
171
|
-
importer.each {|t| @accumulator.push(t) unless t.empty? }
|
172
172
|
end
|
173
173
|
|
174
174
|
report_progress(percent_complete = 50.0, "Validating #{@accumulator.size} imported trackers")
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Shake uses this reader to parse byte by byte without having to read byte by byte.
|
2
|
+
# Reading byte by byte is very inefficient, but we want to parse byte by byte since
|
3
|
+
# this makes parser construction much easier. So what we do is cache some chunk of the
|
4
|
+
# passed buffer and read from that. Once exhausted there will be some caching again,
|
5
|
+
# and ad infinitum until the passed buffer is exhausted
|
6
|
+
class Tracksperanto::BufferingReader
|
7
|
+
|
8
|
+
# By default will read in chunks of 4K
|
9
|
+
DEFAULT_BUFFER_SIZE = 10240
|
10
|
+
|
11
|
+
def initialize(with_io, buffer_size = DEFAULT_BUFFER_SIZE)
|
12
|
+
@io = with_io
|
13
|
+
@bufsize = buffer_size
|
14
|
+
@buf = StringIO.new
|
15
|
+
end
|
16
|
+
|
17
|
+
# Will transparently read one byte off the contained IO, maintaining the internal cache.
|
18
|
+
# If the cache has been depleted it will read a big chunk from the IO and cache it and then
|
19
|
+
# return the byte
|
20
|
+
def read_one_byte
|
21
|
+
cache if @buf.pos == @buf.size
|
22
|
+
|
23
|
+
return nil if @buf.size.zero?
|
24
|
+
return @buf.read(1)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Tells whether all the data has been both read from the passed buffer
|
28
|
+
# and from the internal cache buffer (checks whether there is anything that
|
29
|
+
# can be retreived using read_one_byte)
|
30
|
+
def data_exhausted?
|
31
|
+
@buf.eof? && @io.eof?
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def cache
|
37
|
+
data = @io.read(@bufsize)
|
38
|
+
@buf = StringIO.new(data.to_s) # Make nil become ""
|
39
|
+
end
|
40
|
+
end
|
data/lib/tracksperanto.rb
CHANGED
@@ -2,10 +2,12 @@ require 'stringio'
|
|
2
2
|
require 'delegate'
|
3
3
|
require 'tempfile'
|
4
4
|
require 'flame_channel_parser'
|
5
|
+
require "obuf"
|
6
|
+
require "progressive_io"
|
5
7
|
|
6
8
|
module Tracksperanto
|
7
9
|
PATH = File.expand_path(File.dirname(__FILE__))
|
8
|
-
VERSION = '2.
|
10
|
+
VERSION = '2.7.0'
|
9
11
|
|
10
12
|
module Import; end
|
11
13
|
module Export; end
|
@@ -70,6 +72,15 @@ module Tracksperanto
|
|
70
72
|
|
71
73
|
raise UnknownImporterError, "Unknown importer #{name.inspect}"
|
72
74
|
end
|
75
|
+
|
76
|
+
# DEPRECATED, will be removed in Tracksperanto 3
|
77
|
+
class Accumulator < Obuf
|
78
|
+
end
|
79
|
+
|
80
|
+
# DEPRECATED, will be removed in Tracksperanto 3
|
81
|
+
class Tracksperanto::ProgressiveIO < ProgressiveIO
|
82
|
+
end
|
83
|
+
|
73
84
|
end
|
74
85
|
|
75
86
|
%w(
|
@@ -83,12 +94,11 @@ end
|
|
83
94
|
tracker
|
84
95
|
format_detector
|
85
96
|
ext_io
|
86
|
-
progressive_io
|
87
97
|
buffer_io
|
88
98
|
simple_export
|
89
99
|
uv_coordinates
|
90
100
|
flame_builder
|
91
|
-
|
101
|
+
buffering_reader
|
92
102
|
).each do | submodule |
|
93
103
|
require File.join(Tracksperanto::PATH, "tracksperanto", submodule)
|
94
104
|
end
|
@@ -10,6 +10,6 @@ class ShakeTextExportTest < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_exporter_meta
|
12
12
|
assert_equal "shake_trackers.txt", Tracksperanto::Export::ShakeText.desc_and_extension
|
13
|
-
assert_equal "Shake trackers in a .txt file", Tracksperanto::Export::ShakeText.human_name
|
13
|
+
assert_equal "Shake trackers in a .txt file (also usable with Nuke's CameraTracker)", Tracksperanto::Export::ShakeText.human_name
|
14
14
|
end
|
15
15
|
end
|