tracksperanto 2.2.2 → 2.2.4
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/DEVELOPER_DOCS.rdoc +2 -2
- data/History.txt +14 -2
- data/Manifest.txt +2 -0
- data/Rakefile +1 -1
- data/lib/export/base.rb +1 -0
- data/lib/import/flame_stabilizer.rb +0 -4
- data/lib/import/shake_grammar/lexer.rb +2 -2
- data/lib/import/shake_script.rb +31 -5
- data/lib/middleware/shift.rb +1 -1
- data/lib/pipeline/base.rb +1 -2
- data/lib/tracksperanto.rb +1 -2
- data/test/import/samples/pftrack5/empty_trackers.2dt +30 -0
- data/test/import/samples/shake_script/designated_global_range_starting_at_negative_frame.shk +496 -0
- data/test/import/test_shake_lexer.rb +13 -0
- data/test/import/test_shake_script_import.rb +8 -0
- data/test/test_pipeline.rb +14 -0
- metadata +6 -4
data/DEVELOPER_DOCS.rdoc
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
|
5
5
|
You can easily write a Tracksperanto import module - refer to Tracksperanto::Import::Base
|
6
6
|
docs. Your importer will be configured with width and height of the comp that it is importing, and will get an IO
|
7
|
-
object with the file that you are processing.
|
8
|
-
|
7
|
+
object with the file that you are processing. You should then yield parsed trackers within the each method (tracker objects should
|
8
|
+
be Tracksperanto::Tracker objects or compatibles)
|
9
9
|
|
10
10
|
=== Exporting your own formats
|
11
11
|
|
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 2.2.4 / 2011-04-04
|
2
|
+
|
3
|
+
* Properly deal with negative frames happening in Shake scripts sometimes. We will now recognize a script starting at negative
|
4
|
+
frames and "bump" it's frames in curves so that everything neatly starts at frame 0. Granted this does not give us the same frame range
|
5
|
+
but most apps wil go bonkers anyway if we send them negative frame numbers.
|
6
|
+
|
7
|
+
=== 2.2.3 / 2011-04-03
|
8
|
+
|
9
|
+
* Prevent zero-length trackers (trackers having no position information) from being accumulated during import.
|
10
|
+
This had adverse effects on export modules that could not export trackers containing no information. As a sidenote we
|
11
|
+
will write down in the doco that an export module should not expect empty trackers with no keyframes to be sent
|
12
|
+
|
1
13
|
=== 2.2.2 / 2011-04-03
|
2
14
|
|
3
15
|
* The last change to PFMatchit exporter had adverse effects on pftrack files, now fixed.
|
@@ -13,8 +25,8 @@
|
|
13
25
|
|
14
26
|
* Improve documentation substantially
|
15
27
|
* Changed the Import::Base interface yo use enumeration instead of @receiver.
|
16
|
-
|
17
|
-
|
28
|
+
Upside: This allows us to convert importers to an array of trackers and other niceties.
|
29
|
+
Downside: stream_parse will be deprecated. It is however still available for backwards compatibility
|
18
30
|
|
19
31
|
=== 2.1.1 / 2011-02-14
|
20
32
|
|
data/Manifest.txt
CHANGED
@@ -109,7 +109,9 @@ test/import/samples/nuke/tracker_with_repeating_gaps.nk
|
|
109
109
|
test/import/samples/pfmatchit/pfmatchit_example.2dt
|
110
110
|
test/import/samples/pftrack4/sourcefile_pftrack.2dt
|
111
111
|
test/import/samples/pftrack5/apft.2dt
|
112
|
+
test/import/samples/pftrack5/empty_trackers.2dt
|
112
113
|
test/import/samples/pftrack5/garage.2dt
|
114
|
+
test/import/samples/shake_script/designated_global_range_starting_at_negative_frame.shk
|
113
115
|
test/import/samples/shake_script/four_tracks_in_one_matchmove.shk
|
114
116
|
test/import/samples/shake_script/four_tracks_in_one_stabilizer.shk
|
115
117
|
test/import/samples/shake_script/from_matchmover.shk
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ begin
|
|
16
16
|
p.extra_dev_deps = {"flexmock" => ">=0"}
|
17
17
|
p.rubyforge_name = 'guerilla-di'
|
18
18
|
p.developer('Julik Tarkhanov', 'me@julik.nl')
|
19
|
-
p.clean_globs = %w( **/.DS_Store coverage.info **/*.rbc .idea)
|
19
|
+
p.clean_globs = %w( **/.DS_Store coverage.info **/*.rbc .idea .yardoc)
|
20
20
|
end
|
21
21
|
rescue LoadError
|
22
22
|
$stderr.puts "Meta-operations on this package require Hoe"
|
data/lib/export/base.rb
CHANGED
@@ -21,6 +21,7 @@
|
|
21
21
|
# exporter.end_export
|
22
22
|
# end
|
23
23
|
#
|
24
|
+
# By contract export_point will be called at least once for each tracker being exported (no empty trackers will be sent)
|
24
25
|
class Tracksperanto::Export::Base
|
25
26
|
include Tracksperanto::ConstName
|
26
27
|
include Tracksperanto::SimpleExport
|
@@ -14,10 +14,6 @@ class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
|
|
14
14
|
"Flame .stabilizer file"
|
15
15
|
end
|
16
16
|
|
17
|
-
class Key
|
18
|
-
attr_accessor :at, :value, :extrap, :interp, :left_tangent, :right_tangent
|
19
|
-
end
|
20
|
-
|
21
17
|
class ChannelBlock < Array
|
22
18
|
include ::Tracksperanto::Casts
|
23
19
|
cast_to_string :name
|
@@ -78,10 +78,10 @@ module Tracksperanto::ShakeGrammar
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
INT_ATOM = /^(
|
81
|
+
INT_ATOM = /^(-?\d+)$/
|
82
82
|
FLOAT_ATOM = /^([\-\d\.]+)$/
|
83
83
|
STR_ATOM = /^\"/
|
84
|
-
AT_FRAME = /^@(
|
84
|
+
AT_FRAME = /^@(-?\d+)/
|
85
85
|
|
86
86
|
# Grab the minimum atomic value
|
87
87
|
def consume_atom!
|
data/lib/import/shake_script.rb
CHANGED
@@ -12,16 +12,33 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def each
|
15
|
-
|
16
|
-
|
15
|
+
s = Sentinel.new
|
16
|
+
s.progress_proc = method(:report_progress)
|
17
|
+
s.tracker_proc = Proc.new
|
18
|
+
TrackExtractor.new(@io, s)
|
17
19
|
end
|
18
20
|
|
19
21
|
private
|
20
22
|
|
23
|
+
#:nodoc:
|
24
|
+
|
25
|
+
class Sentinel
|
26
|
+
attr_accessor :start_frame, :tracker_proc, :progress_proc
|
27
|
+
def start_frame
|
28
|
+
@start_frame.to_i
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
21
32
|
# Extractor. Here we define copies of Shake's standard node creation functions.
|
22
33
|
class TrackExtractor < Tracksperanto::ShakeGrammar::Catcher
|
23
34
|
include Tracksperanto::ZipTuples
|
24
35
|
|
36
|
+
# SetTimeRange("-5-15") // sets time range of comp
|
37
|
+
# We use it to avoid producing keyframes which start at negative frames
|
38
|
+
def settimerange(str)
|
39
|
+
sentinel.start_frame = str.to_i if str.to_i < 0
|
40
|
+
end
|
41
|
+
|
25
42
|
# Normally, we wouldn't need to look for the variable name from inside of the funcall. However,
|
26
43
|
# in this case we DO want to take this shortcut so we know how the tracker node is called
|
27
44
|
def push(atom)
|
@@ -31,7 +48,8 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
|
|
31
48
|
trackers = atom[2][1][1..-1]
|
32
49
|
trackers.map do | tracker |
|
33
50
|
tracker.name = [node_name, tracker.name].join("_")
|
34
|
-
|
51
|
+
# THIS IS THE MOST IMPORTANT THINGO
|
52
|
+
sentinel.tracker_proc.call(tracker)
|
35
53
|
end
|
36
54
|
end
|
37
55
|
|
@@ -43,7 +61,8 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
|
|
43
61
|
# We put the frame number at the beginning since it works witih oru tuple zipper
|
44
62
|
def linear(extrapolation_type, *keyframes)
|
45
63
|
report_progress("Translating Linear animation")
|
46
|
-
keyframes
|
64
|
+
remap_keyframes_against_negative_at!(keyframes)
|
65
|
+
keyframes.map { |kf| [kf.at , kf.value] }
|
47
66
|
end
|
48
67
|
alias_method :nspline, :linear
|
49
68
|
alias_method :jspline, :linear
|
@@ -54,9 +73,16 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
|
|
54
73
|
# tangent positions (which we discard)
|
55
74
|
def hermite(extrapolation_type, *keyframes)
|
56
75
|
report_progress("Translating Hermite curve, removing tangents")
|
76
|
+
remap_keyframes_against_negative_at!(keyframes)
|
57
77
|
keyframes.map{ |kf| [kf.at, kf.value[0]] }
|
58
78
|
end
|
59
79
|
|
80
|
+
def remap_keyframes_against_negative_at!(kfs)
|
81
|
+
frame_start_of_script = sentinel.start_frame
|
82
|
+
kfs.each{|k| k.at = (k.at - frame_start_of_script) }
|
83
|
+
end
|
84
|
+
private :remap_keyframes_against_negative_at!
|
85
|
+
|
60
86
|
# image Tracker(
|
61
87
|
# image In,
|
62
88
|
# const char * trackRange,
|
@@ -199,7 +225,7 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
|
|
199
225
|
private
|
200
226
|
|
201
227
|
def report_progress(with_message)
|
202
|
-
sentinel
|
228
|
+
sentinel.progress_proc.call(with_message)
|
203
229
|
end
|
204
230
|
|
205
231
|
def collect_trackers_from(array)
|
data/lib/middleware/shift.rb
CHANGED
@@ -4,7 +4,7 @@ class Tracksperanto::Middleware::Shift < Tracksperanto::Middleware::Base
|
|
4
4
|
cast_to_float :x_shift, :y_shift
|
5
5
|
|
6
6
|
def export_point(frame, float_x, float_y, float_residual)
|
7
|
-
super(frame, float_x +
|
7
|
+
super(frame, float_x + @x_shift.to_f, float_y + @y_shift.to_f, float_residual)
|
8
8
|
end
|
9
9
|
|
10
10
|
end
|
data/lib/pipeline/base.rb
CHANGED
@@ -16,7 +16,6 @@ module Tracksperanto::Pipeline
|
|
16
16
|
def message; "Could not recover any non-empty trackers from this file. Wrong import format maybe?"; end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
19
|
# The base pipeline is the whole process of track conversion from start to finish. The pipeline object organizes the import formats, scans them,
|
21
20
|
# applies the middlewares. Here's how a calling sequence for a pipeline looks like:
|
22
21
|
#
|
@@ -149,7 +148,7 @@ module Tracksperanto::Pipeline
|
|
149
148
|
importer.stream_parse(io_with_progress)
|
150
149
|
else
|
151
150
|
importer.io = io_with_progress
|
152
|
-
importer.each {|t| @accumulator.push(t) }
|
151
|
+
importer.each {|t| @accumulator.push(t) unless t.empty? }
|
153
152
|
end
|
154
153
|
|
155
154
|
report_progress(percent_complete = 50.0, "Validating #{@accumulator.size} imported trackers")
|
data/lib/tracksperanto.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# 2D feature tracks generated by PFTrack 5.0r4-90106
|
2
|
+
#
|
3
|
+
# format:
|
4
|
+
# "name"
|
5
|
+
# "camera"
|
6
|
+
# <number of frames>
|
7
|
+
# <frame number> <x pixel> <y pixel> <residual>
|
8
|
+
#
|
9
|
+
|
10
|
+
"Feature2"
|
11
|
+
"Primary"
|
12
|
+
0
|
13
|
+
|
14
|
+
"Feature3"
|
15
|
+
"Primary"
|
16
|
+
10
|
17
|
+
9095 615.471 403.957 0.000
|
18
|
+
9105 643.794 405.318 0.000
|
19
|
+
9107 644.339 405.863 0.000
|
20
|
+
9115 632.084 424.110 0.000
|
21
|
+
9121 627.684 438.722 0.000
|
22
|
+
9125 709.070 452.946 0.000
|
23
|
+
9128 726.041 472.858 0.000
|
24
|
+
9131 668.577 480.211 0.000
|
25
|
+
9135 595.863 470.952 0.000
|
26
|
+
9138 527.778 467.956 0.000
|
27
|
+
|
28
|
+
"Feature4"
|
29
|
+
"Primary"
|
30
|
+
0
|