tracksperanto 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.5.2 / 2009-10-09
2
+
3
+ * Fix Windows-specific issue (Tempfile-related) in the Equalizer4 exporter
4
+ * Add Export::Base#just_export and Middleware::Base#just_export
5
+
1
6
  === 1.5.0 / 2009-10-09
2
7
 
3
8
  * Implement support for older 3DE exports (in and out)
data/lib/export/base.rb CHANGED
@@ -13,18 +13,20 @@ class Tracksperanto::Export::Base
13
13
  super
14
14
  end
15
15
 
16
- # Should return the suffix and extension of this export file (like "flame.stabilizer"). It's a class
17
- # method because it gets requested before the exporter is instantiated
16
+ # Should return the suffix and extension of this export file (like "flame.stabilizer"), without
17
+ # the leading underscore. It's a class method because it gets requested before the exporter is instantiated
18
18
  def self.desc_and_extension
19
19
  "data.txt"
20
20
  end
21
21
 
22
- # Should return the human-readable (read: with spaces) name of the export module
22
+ # Should return the human-readable (read: properly capitalized and with spaces) name of the export module
23
23
  def self.human_name
24
24
  "Abstract export format"
25
25
  end
26
26
 
27
27
  # The constructor for an exporter should accept a handle to the IO object that you can write to.
28
+ # This gets assigned to @io ivar by default, but you can do whatever ypu wish
29
+ # By convention, the caller will close the IO when you are done so don't do it here
28
30
  def initialize(write_to_io)
29
31
  @io = write_to_io
30
32
  end
@@ -33,7 +35,7 @@ class Tracksperanto::Export::Base
33
35
  def start_export( img_width, img_height)
34
36
  end
35
37
 
36
- # Called on export end. No need to close the passed IO, it will be done for you afterwards
38
+ # Called on export end. By convention, the caller will close the IO when you are done so don't do it here
37
39
  def end_export
38
40
  end
39
41
 
@@ -3,7 +3,6 @@ class Tracksperanto::Export::Equalizer3 < Tracksperanto::Export::Base
3
3
 
4
4
  HEADER = '// 3DE Multiple Tracking Curves Export 2048 x 778 * 275 frames'
5
5
 
6
- # Should return the suffix and extension of this export file (like "_flame.stabilizer")
7
6
  def self.desc_and_extension
8
7
  "3de_v3.txt"
9
8
  end
@@ -1,7 +1,6 @@
1
1
  # Export for 3DE v4 point files
2
2
  class Tracksperanto::Export::Equalizer4 < Tracksperanto::Export::Base
3
3
 
4
- # Should return the suffix and extension of this export file (like "_flame.stabilizer")
5
4
  def self.desc_and_extension
6
5
  "3de_v4.txt"
7
6
  end
@@ -13,13 +12,13 @@ class Tracksperanto::Export::Equalizer4 < Tracksperanto::Export::Base
13
12
  def start_export( img_width, img_height)
14
13
  # 3DE needs to know the number of points in advance,
15
14
  # so we will just buffer to a StringIO
16
- @internal_io, @num_of_trackers = Tempfile.new(self.class.to_s), 0
15
+ @internal_io, @num_of_trackers = Tempfile.new("teq4x"), 0
17
16
  end
18
17
 
19
18
  def start_tracker_segment(tracker_name)
20
19
  @internal_io.puts(tracker_name)
21
20
  @num_of_trackers += 1
22
- @tracker_buffer, @num_of_kfs = Tempfile.new(self.class.to_s), 0
21
+ @tracker_buffer, @num_of_kfs = Tempfile.new("teq4x_p"), 0
23
22
  end
24
23
 
25
24
  def export_point(frame, abs_float_x, abs_float_y, float_residual)
@@ -26,7 +26,6 @@ Constant {
26
26
  include ::Tracksperanto::BlockInit
27
27
  end
28
28
 
29
- # Should return the suffix and extension of this export file (like "_flame.stabilizer")
30
29
  def self.desc_and_extension
31
30
  "nuke.nk"
32
31
  end
@@ -12,7 +12,7 @@ class Tracksperanto::Export::PFTrack5 < Tracksperanto::Export::PFTrack4
12
12
  def end_tracker_segment
13
13
  block = [ "\n",
14
14
  @tracker_name.inspect, # "autoquotes"
15
- "Primary".inspect,
15
+ "Primary".inspect, # For primary/secondary cam in stereo pair
16
16
  @prev_tracker.length,
17
17
  @prev_tracker.join("\n") ]
18
18
  @io.puts block.join("\n")
@@ -3,7 +3,6 @@ class Tracksperanto::Export::ShakeText < Tracksperanto::Export::Base
3
3
  PREAMBLE = "TrackName %s\n Frame X Y Correlation\n"
4
4
  POSTAMBLE = "\n"
5
5
 
6
- # Should return the suffix and extension of this export file (like "_flame.stabilizer")
7
6
  def self.desc_and_extension
8
7
  "shake_trackers.txt"
9
8
  end
@@ -1,7 +1,6 @@
1
1
  # Export for Syntheyes tracker UVs
2
2
  class Tracksperanto::Export::SynthEyes < Tracksperanto::Export::Base
3
3
 
4
- # Should return the suffix and extension of this export file (like "_flame.stabilizer")
5
4
  def self.desc_and_extension
6
5
  "syntheyes_2dt.txt"
7
6
  end
data/lib/import/base.rb CHANGED
@@ -38,7 +38,7 @@ class Tracksperanto::Import::Base
38
38
  end
39
39
 
40
40
  # Return an extension WITH DOT if this format has a typical extension that
41
- # you can detect
41
+ # you can detect (like ".nk" for Nuke)
42
42
  def self.distinct_file_ext
43
43
  nil
44
44
  end
@@ -54,15 +54,17 @@ class Tracksperanto::Import::Base
54
54
  false
55
55
  end
56
56
 
57
- # Call this method to tell what you are doing. This gets propagated to the caller automatically, or
58
- # gets ignored if the caller did not request any progress reports
57
+ # Call this method from the inside of your importer to tell what you are doing.
58
+ # This gets propagated to the caller automatically, or gets ignored if the caller did not request any progress reports
59
59
  def report_progress(message)
60
60
  @progress_block.call(message) if @progress_block
61
61
  end
62
62
 
63
63
  # The main method of the parser. Will receive an IO handle to the file being imported, and should
64
64
  # return an array of Tracksperanto::Tracker objects containing keyframes. If you have a problem
65
- # doing an import, raise from here.
65
+ # doing an import, raise from here. Note that in general it's a good idea to stream-parse a document
66
+ # instead of bulk-reading it into memory (since Tracksperanto tries to be mem-efficient when dealing
67
+ # with large files)
66
68
  def parse(track_file_io)
67
69
  []
68
70
  end
@@ -29,6 +29,7 @@ class Tracksperanto::Import::Equalizer3 < Tracksperanto::Import::Base
29
29
  if line =~ /^(\w+)/ # Tracker name
30
30
  discard_last_empty_tracker!(ts)
31
31
  ts.push(Tracksperanto::Tracker.new(:name => line.strip))
32
+ report_progress("Capturing tracker #{line.strip}")
32
33
  elsif line =~ /^\t/
33
34
  ts[-1].push(make_keyframe(line))
34
35
  end
@@ -39,11 +40,15 @@ class Tracksperanto::Import::Equalizer3 < Tracksperanto::Import::Base
39
40
  end
40
41
 
41
42
  def discard_last_empty_tracker!(in_array)
42
- in_array.delete_at(-1) if (in_array.any? && in_array[-1].empty?)
43
+ if (in_array.any? && in_array[-1].empty?)
44
+ in_array.delete_at(-1)
45
+ report_progress("Removing the last tracker since it had no keyframes")
46
+ end
43
47
  end
44
48
 
45
49
  def make_keyframe(from_line)
46
50
  frame, x, y = from_line.split
51
+ report_progress("Capturing keyframe #{frame}")
47
52
  Tracksperanto::Keyframe.new(:frame => (frame.to_i - 1), :abs_x => x, :abs_y => y)
48
53
  end
49
54
  end
@@ -26,6 +26,8 @@ class Tracksperanto::Import::Equalizer4 < Tracksperanto::Import::Base
26
26
  def extract_tracker(io)
27
27
  t = Tracksperanto::Tracker.new(:name => io.gets.strip)
28
28
 
29
+ report_progress("Capturing tracker #{t.name}")
30
+
29
31
  io.gets # Tracker color, internal 3DE repr and 0 is Red
30
32
 
31
33
  num_of_keyframes = io.gets.to_i
@@ -35,6 +37,7 @@ class Tracksperanto::Import::Equalizer4 < Tracksperanto::Import::Base
35
37
  throw :__emp unless line
36
38
 
37
39
  frame, x, y = line.scan(KF_PATTERN).flatten
40
+ report_progress("Capturing keyframe #{frame}")
38
41
  t.keyframe!(:frame => (frame.to_i - 1), :abs_x => x, :abs_y => y)
39
42
  end
40
43
  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.5.1'
7
+ VERSION = '1.5.2'
8
8
 
9
9
  module Import; end
10
10
  module Export; end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{tracksperanto}
5
- s.version = "1.5.1"
5
+ s.version = "1.5.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Julik Tarkhanov"]
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.5.1
4
+ version: 1.5.2
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-10-10 00:00:00 +02:00
12
+ date: 2009-10-11 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency