tracksperanto 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,8 @@ class Tracksperanto::Import::Base
4
4
  include Tracksperanto::Safety
5
5
  include Tracksperanto::Casts
6
6
 
7
+ attr_accessor :progress_block
8
+
7
9
  # The original width of the tracked image
8
10
  # Some importers need it
9
11
  cast_to_int :width
@@ -20,6 +22,11 @@ class Tracksperanto::Import::Base
20
22
  super
21
23
  end
22
24
 
25
+ # Call this method to tell what you are doing. This gets propagated to the caller
26
+ def report_progress(message)
27
+ @progress_block.call(message) if @progress_block
28
+ end
29
+
23
30
  # Should return an array of Tracksperanto::Tracker objects
24
31
  def parse(track_file_content)
25
32
  []
@@ -149,10 +149,7 @@ Channel tracker1/ref/x
149
149
  ChannelBlock.new(io, channel_name)
150
150
  end
151
151
 
152
- def report_progress(msg)
153
- end
154
-
155
- REF_CHANNEL = "ref"
152
+ REF_CHANNEL = "ref" # or "track" - sometimes works sometimes don't
156
153
 
157
154
  def scavenge_trackers_from_channels(channels)
158
155
  trackers = []
@@ -166,6 +163,8 @@ Channel tracker1/ref/x
166
163
  def grab_tracker(channels, track_x)
167
164
  t = T.new(:name => track_x.name.split('/').shift)
168
165
 
166
+ report_progress("Extracting tracker #{t.name}")
167
+
169
168
  track_y = channels.find{|e| e.name == "#{t.name}/#{REF_CHANNEL}/y" }
170
169
  shift_x = channels.find{|e| e.name == "#{t.name}/shift/x" }
171
170
  shift_y = channels.find{|e| e.name == "#{t.name}/shift/y" }
@@ -179,19 +178,19 @@ Channel tracker1/ref/x
179
178
  [track_x.base_value, track_y.base_value]
180
179
  end
181
180
 
181
+ total_kf = 1
182
182
  t.keyframes = shift_tuples.map do | (at, x, y) |
183
183
  # Flame keyframes are sort of minus-one based, so to start at frame 0
184
184
  # we need to decrement one frame, always. Also, the shift value is inverted!
185
- K.new(:frame => (at - 1), :abs_x => (base_x - x.to_f), :abs_y => (base_y - y.to_f))
185
+ kf_x, kf_y = base_x - x.to_f, base_y - y.to_f
186
+
187
+ report_progress("Extracting keyframe #{total_kf += 1} of #{t.name}")
188
+ K.new(:frame => (at - 1), :abs_x => kf_x, :abs_y => kf_y)
186
189
  end
187
190
 
188
191
  return t
189
192
  end
190
193
 
191
- def cornerize(from_dimension, value_from_center)
192
- (from_dimension / 2.0) + (value_from_center * -1)
193
- end
194
-
195
194
  UseBase = RuntimeError
196
195
 
197
196
  def find_base_x_and_y(track_tuples, shift_tuples)
@@ -8,6 +8,7 @@ class Tracksperanto::Import::PFTrack < Tracksperanto::Import::Base
8
8
 
9
9
  if line =~ /[AZaz]/ # Tracker with a name
10
10
  t = Tracksperanto::Tracker.new{|t| t.name = line.strip.gsub(/"/, '') }
11
+ report_progress("Reading tracker #{t.name}")
11
12
  parse_tracker(t, io)
12
13
  trackers << t
13
14
  end
@@ -20,6 +21,7 @@ class Tracksperanto::Import::PFTrack < Tracksperanto::Import::Base
20
21
  def parse_tracker(t, io)
21
22
  num_of_keyframes = io.gets.chomp.to_i
22
23
  t.keyframes = (1..num_of_keyframes).map do
24
+ report_progress("Reading keyframe")
23
25
  Tracksperanto::Keyframe.new do |k|
24
26
  k.frame, k.abs_x, k.abs_y, k.residual = io.gets.chomp.split
25
27
  end
@@ -57,7 +57,7 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
57
57
 
58
58
  # Name me!
59
59
  @name = scan_until(/(\w+) /).strip
60
-
60
+
61
61
  # All the tracker arguments
62
62
  17.times { skip_until ',' } # input data
63
63
 
@@ -96,6 +96,8 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
96
96
 
97
97
  tracker = Tracksperanto::Tracker.new{|t| t.name = parser.name }
98
98
 
99
+ report_progress("Reading tracker #{tracker.name}")
100
+
99
101
  x_keyframes, y_keyframes, residual_keyframes = TrackerParser.new(tracker_text_block.to_s).curves
100
102
  x_keyframes.each_with_index do | value_at, kf_index |
101
103
 
@@ -37,6 +37,10 @@ class Base
37
37
  points, keyframes, percent_complete = 0, 0, 0.0
38
38
 
39
39
  yield(percent_complete, "Starting the parse routine") if block_given?
40
+ parser.progress_block = lambda do | message |
41
+ yield(percent_complete, message) if block_given?
42
+ end
43
+
40
44
  trackers = parser.parse(tracker_data_blob)
41
45
 
42
46
  yield(percent_complete = 20.0, "Starting export for #{trackers.length} trackers") if block_given?
@@ -1,5 +1,5 @@
1
1
  module Tracksperanto
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
 
4
4
  module Import; end
5
5
  module Export; end
@@ -122,21 +122,21 @@ module Tracksperanto
122
122
  end
123
123
 
124
124
  # Load importers
125
- Dir.glob(File.dirname(__FILE__) + '/import/*.rb').each do | i |
125
+ Dir.glob(File.dirname(__FILE__) + '/import/*.rb').sort.each do | i |
126
126
  require i
127
127
  end
128
128
 
129
129
  # Load exporters
130
- Dir.glob(File.dirname(__FILE__) + '/export/*.rb').each do | i |
130
+ Dir.glob(File.dirname(__FILE__) + '/export/*.rb').sort.each do | i |
131
131
  require i
132
132
  end
133
133
 
134
134
  # Load middleware
135
- Dir.glob(File.dirname(__FILE__) + '/middleware/*.rb').each do | i |
135
+ Dir.glob(File.dirname(__FILE__) + '/middleware/*.rb').sort.each do | i |
136
136
  require i
137
137
  end
138
138
 
139
139
  # Load pipelines
140
- Dir.glob(File.dirname(__FILE__) + '/pipeline/*.rb').each do | i |
140
+ Dir.glob(File.dirname(__FILE__) + '/pipeline/*.rb').sort.each do | i |
141
141
  require i
142
142
  end
@@ -3,11 +3,11 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{tracksperanto}
6
- s.version = "1.1.0"
6
+ s.version = "1.1.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.authors = ["Julik Tarkhanov"]
10
- s.date = %q{2009-09-07}
10
+ s.date = %q{2009-09-08}
11
11
  s.default_executable = %q{tracksperanto}
12
12
  s.description = %q{Tracksperanto is a universal 2D-track translator between many apps. Import support: * Shake script (one tracker node per tracker) * Shake tracker node export (textfile with many tracks per file), also exported by Boujou and others * PFTrack 2dt files * Syntheyes 2D tracking data exports (UV coordinates) Export support: * Shake text file (many trackers per file), also accepted by Boujou * PFTrack 2dt file (with residuals) * Syntheyes 2D tracking data import (UV coordinates) The main way to use Tracksperanto is to use the supplied "tracksperanto" binary, like so: tracksperanto -f ShakeScript -w 1920 -h 1080 /Films/Blockbuster/Shots/001/script.shk ShakeScript is the name of the translator that will be used to read the file (many apps export tracks as .txt files so there is no way for us to autodetect them all). -w and -h stand for Width and Height and define the size of your comp (different tracking apps use different coordinate systems and we need to know the size of the comp to properly convert these). You also have additional options like -xs, -ys and --slip - consult the usage info for the tracksperanto binary. The converted files will be saved in the same directory as the source, if resulting converted files already exist ++they will be overwritten without warning++.}
13
13
  s.email = ["me@julik.nl"]
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.1.0
4
+ version: 1.1.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: 2009-09-07 00:00:00 +02:00
12
+ date: 2009-09-08 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency