tracksperanto 2.8.6 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/DEVELOPER_DOCS.rdoc +17 -5
  2. data/History.txt +8 -0
  3. data/README.rdoc +2 -0
  4. data/lib/export/base.rb +1 -0
  5. data/lib/export/boujou.rb +2 -1
  6. data/lib/export/equalizer3.rb +1 -0
  7. data/lib/export/equalizer4.rb +1 -0
  8. data/lib/export/flame_stabilizer.rb +1 -0
  9. data/lib/export/flame_stabilizer_cornerpin.rb +1 -0
  10. data/lib/export/match_mover.rb +2 -1
  11. data/lib/export/maya_live.rb +2 -1
  12. data/lib/export/mux.rb +1 -0
  13. data/lib/export/nuke_script.rb +2 -1
  14. data/lib/export/pfmatchit.rb +2 -1
  15. data/lib/export/pftrack.rb +2 -1
  16. data/lib/export/pftrack_5.rb +2 -1
  17. data/lib/export/ruby.rb +38 -0
  18. data/lib/export/shake_text.rb +2 -1
  19. data/lib/export/syntheyes.rb +1 -0
  20. data/lib/import/base.rb +2 -1
  21. data/lib/import/boujou.rb +2 -1
  22. data/lib/import/equalizer3.rb +2 -1
  23. data/lib/import/equalizer4.rb +2 -1
  24. data/lib/import/flame_stabilizer.rb +2 -1
  25. data/lib/import/match_mover.rb +3 -2
  26. data/lib/import/maya_live.rb +2 -1
  27. data/lib/import/nuke_grammar/utils.rb +2 -1
  28. data/lib/import/nuke_script.rb +2 -1
  29. data/lib/import/pftrack.rb +2 -1
  30. data/lib/import/shake_grammar/catcher.rb +2 -1
  31. data/lib/import/shake_grammar/lexer.rb +2 -1
  32. data/lib/import/shake_script.rb +2 -1
  33. data/lib/import/shake_text.rb +1 -0
  34. data/lib/import/syntheyes.rb +2 -1
  35. data/lib/middleware/base.rb +1 -0
  36. data/lib/middleware/crop.rb +2 -1
  37. data/lib/middleware/flip.rb +2 -1
  38. data/lib/middleware/flop.rb +2 -1
  39. data/lib/middleware/golden.rb +2 -1
  40. data/lib/middleware/length_cutoff.rb +2 -1
  41. data/lib/middleware/lerp.rb +2 -1
  42. data/lib/middleware/lint.rb +2 -1
  43. data/lib/middleware/pad.rb +2 -1
  44. data/lib/middleware/prefix.rb +2 -1
  45. data/lib/middleware/reformat.rb +2 -1
  46. data/lib/middleware/scaler.rb +2 -1
  47. data/lib/middleware/shift.rb +2 -1
  48. data/lib/middleware/slipper.rb +2 -1
  49. data/lib/middleware/start_trim.rb +2 -1
  50. data/lib/pipeline/base.rb +2 -1
  51. data/lib/tracksperanto/block_init.rb +1 -0
  52. data/lib/tracksperanto/buffer_io.rb +2 -1
  53. data/lib/tracksperanto/buffering_reader.rb +2 -1
  54. data/lib/tracksperanto/casts.rb +2 -1
  55. data/lib/tracksperanto/const_name.rb +2 -1
  56. data/lib/tracksperanto/ext_io.rb +2 -1
  57. data/lib/tracksperanto/format_detector.rb +2 -1
  58. data/lib/tracksperanto/keyframe.rb +4 -4
  59. data/lib/tracksperanto/returning.rb +2 -1
  60. data/lib/tracksperanto/safety.rb +2 -1
  61. data/lib/tracksperanto/simple_export.rb +1 -0
  62. data/lib/tracksperanto/tracker.rb +99 -15
  63. data/lib/tracksperanto/uv_coordinates.rb +2 -1
  64. data/lib/tracksperanto/zip_tuples.rb +2 -1
  65. data/lib/tracksperanto.rb +2 -1
  66. data/test/export/samples/ref_Mayalive.txt +36 -36
  67. data/test/export/samples/ref_Mayalive_CustomAspect.txt +36 -36
  68. data/test/export/samples/ref_Ruby.rb +54 -0
  69. data/test/export/samples/ref_boujou.txt +1 -0
  70. data/test/export/samples/ref_equalizer.txt +20 -20
  71. data/test/export/samples/ref_matchmover.rz2 +36 -36
  72. data/test/export/test_boujou_export.rb +2 -1
  73. data/test/export/test_equalizer3_export.rb +2 -1
  74. data/test/export/test_equalizer_export.rb +2 -3
  75. data/test/export/test_flame_stabilizer_cornerpin_export.rb +2 -1
  76. data/test/export/test_flame_stabilizer_export.rb +2 -1
  77. data/test/export/test_match_mover_export.rb +2 -1
  78. data/test/export/test_maya_live_export.rb +2 -1
  79. data/test/export/test_mux.rb +1 -0
  80. data/test/export/test_nuke_export.rb +2 -1
  81. data/test/export/test_pfmatchit_export.rb +2 -1
  82. data/test/export/test_pftrack5_export.rb +2 -1
  83. data/test/export/test_pftrack_export.rb +2 -1
  84. data/test/export/test_ruby_export.rb +17 -0
  85. data/test/export/test_shake_export.rb +2 -1
  86. data/test/export/test_syntheyes_export.rb +1 -0
  87. data/test/helper.rb +48 -54
  88. data/test/import/test_3de_import.rb +2 -1
  89. data/test/import/test_3de_import3.rb +2 -1
  90. data/test/import/test_boujou_import.rb +2 -1
  91. data/test/import/test_flame_import.rb +2 -1
  92. data/test/import/test_match_mover_import.rb +3 -1
  93. data/test/import/test_maya_live_import.rb +2 -1
  94. data/test/import/test_nuke_import.rb +2 -1
  95. data/test/import/test_pftrack_import.rb +2 -1
  96. data/test/import/test_shake_catcher.rb +2 -1
  97. data/test/import/test_shake_lexer.rb +2 -1
  98. data/test/import/test_shake_script_import.rb +2 -1
  99. data/test/import/test_shake_text_import.rb +2 -1
  100. data/test/import/test_syntheyes_import.rb +2 -1
  101. data/test/middleware/test_crop_middleware.rb +2 -1
  102. data/test/middleware/test_flip_middleware.rb +2 -1
  103. data/test/middleware/test_flop_middleware.rb +1 -0
  104. data/test/middleware/test_golden_middleware.rb +2 -1
  105. data/test/middleware/test_length_cutoff_middleware.rb +2 -1
  106. data/test/middleware/test_lerp_middleware.rb +2 -1
  107. data/test/middleware/test_lint_middleware.rb +2 -1
  108. data/test/middleware/test_pad_middleware.rb +2 -1
  109. data/test/middleware/test_prefix.rb +2 -1
  110. data/test/middleware/test_reformat_middleware.rb +2 -1
  111. data/test/middleware/test_scaler_middleware.rb +2 -1
  112. data/test/middleware/test_shift_middleware.rb +2 -1
  113. data/test/middleware/test_slip_middleware.rb +2 -1
  114. data/test/middleware/test_start_trim_middleware.rb +2 -1
  115. data/test/test_buffer_io.rb +2 -1
  116. data/test/test_bufferingreader.rb +2 -1
  117. data/test/test_cli.rb +4 -2
  118. data/test/test_const_name.rb +2 -1
  119. data/test/test_extio.rb +2 -1
  120. data/test/test_format_detector.rb +2 -1
  121. data/test/test_keyframe.rb +15 -1
  122. data/test/test_pipeline.rb +2 -1
  123. data/test/test_simple_export.rb +2 -1
  124. data/test/test_tracker.rb +86 -12
  125. data/test/test_tracksperanto.rb +2 -1
  126. data/tracksperanto.gemspec +5 -2
  127. metadata +23 -20
data/DEVELOPER_DOCS.rdoc CHANGED
@@ -8,6 +8,16 @@ here but we are sharing an essential pipeline tool that has to be robust day in
8
8
 
9
9
  So please do not underestimate tests.
10
10
 
11
+ === Development environment
12
+
13
+ Tracksperanto is currently being developed on Ruby 1.9.3 but it should also work fine on 1.8.7. What you will need is everything mentioned
14
+ in the Gemfile plus Bundler. Please develop against the git repo checkout since we no longer package the test fixtures with the gem.
15
+
16
+ * Checkout the repo at http://github.com/guerilla-di/tracksperanto
17
+ * Run `bundle install' and 'rake' to run the tests
18
+ * Carry your development, in your own branch or feature branch
19
+ * File a pull request or send a patch to info at guerilla-di.org
20
+
11
21
  === Importing your own formats
12
22
 
13
23
  You can easily write a Tracksperanto import module - refer to Tracksperanto::Import::Base
@@ -72,18 +82,20 @@ Play responsibly.
72
82
 
73
83
  # Now add some middlewares, for example a Scale
74
84
  scaler = Middleware::Scaler.new(some_exporter, :x_factor => 2)
75
- # ... and a slip
76
- slipper = Middleware::Slipper.new(scaler, :offset => 2)
77
- # Middlewares wrap exporters and other middlewares, so you can chain them
85
+ # ... and a slip. Middlewares wrap exporters and other middlewares, so you can chain them
78
86
  # ad nauseam
87
+ slipper = Middleware::Slipper.new(scaler, :offset => 2)
79
88
 
80
89
  # Now when we send export commands to the Slipper it will play them through
81
90
  # to the Scaler and the Scaler in turn will send commands to the exporter.
82
91
  slipper.start_export(1024, 576)
83
92
  trackers.each do | t |
84
93
  slipper.start_tracker_segment(t.name)
85
- t.each {|kf slipper.export_point(kf.frame, kf.abs_x, kf.abs_y, kf.residual) }
94
+ t.each do | keyframe |
95
+ slipper.export_point(keyframe.frame, keyframe.abs_x, keyframe.abs_y, keyframe.residual)
96
+ end
86
97
  slipper.end_tracker_segment
87
98
  end
88
-
99
+ slipper.end_export
100
+
89
101
  # And we are done!
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ === 2.9
2
+
3
+ * Tracker objects now use a Hash as internal storage model instead of being an Array delegate.
4
+ Note that due to that some stuff might have become broken since behavior differs in subtle ways.
5
+ * Adds a Ruby export format which exports a file you can play with in Ruby, with literal values
6
+ * Make test runs architecture-resilient by hardcoding floats
7
+ * Adds Tracker#to_ruby for people who like that sort of thing
8
+
1
9
  === 2.8.6
2
10
 
3
11
  * Ensure the Flame cornerpin export module always exports points in the proper Z-order
data/README.rdoc CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  * http://guerilla-di.org/tracksperanto
4
4
 
5
+ {<img src="https://secure.travis-ci.org/guerilla-di/tracksperanto.png" />}[http://travis-ci.org/guerilla-di/tracksperanto]
6
+
5
7
  == Description
6
8
 
7
9
  Tracksperanto is a universal 2D-track translator between many apps.
data/lib/export/base.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Base exporter. Inherit from this class to automatically register another export format.
2
3
  # The exporters in Tracksperanto are event-driven and follow the same conventions - your
3
4
  # exporter will be notified when a tracker will be exported and when a tracker has been passed
data/lib/export/boujou.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for 2d3d boujou
2
3
  class Tracksperanto::Export::Boujou < Tracksperanto::Export::Base
3
4
 
@@ -30,4 +31,4 @@ class Tracksperanto::Export::Boujou < Tracksperanto::Export::Base
30
31
  height_inv = @height - abs_float_y
31
32
  @io.puts(POINT_T % [@tracker_name, frame + 1, abs_float_x, height_inv])
32
33
  end
33
- end
34
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for 3DE v3 point files
2
3
  class Tracksperanto::Export::Equalizer3 < Tracksperanto::Export::Base
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for 3DE v4 point files
2
3
  class Tracksperanto::Export::Equalizer4 < Tracksperanto::Export::Base
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # TODO: this exporter is MAJORLY slow now
2
3
  class Tracksperanto::Export::FlameStabilizer < Tracksperanto::Export::Base
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Exports setups with tracker naming that works with the Action bilinears
2
3
  class Tracksperanto::Export::FlameStabilizerCornerpin < Tracksperanto::Export::FlameStabilizer
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for Autodesk MatchMover/Image Modeler
2
3
  class Tracksperanto::Export::MatchMover < Tracksperanto::Export::Base
3
4
 
@@ -37,4 +38,4 @@ class Tracksperanto::Export::MatchMover < Tracksperanto::Export::Base
37
38
  @at_first_point = false
38
39
  end
39
40
 
40
- end
41
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  class Tracksperanto::Export::MayaLive < Tracksperanto::Export::Base
2
3
 
3
4
  # Maya Live exports and imports tracks in "aspect units", so a point at 0,0
@@ -57,4 +58,4 @@ class Tracksperanto::Export::MayaLive < Tracksperanto::Export::Base
57
58
  def residual_with_reset(r)
58
59
  "%.10f" % (r/10)
59
60
  end
60
- end
61
+ end
data/lib/export/mux.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Multiplexor. Accepts a number of exporters and replays
2
3
  # the calls to all of them in succession.
3
4
  class Tracksperanto::Export::Mux
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export each tracker as a single Tracker3 node
2
3
  class Tracksperanto::Export::NukeScript < Tracksperanto::Export::Base
3
4
 
@@ -104,4 +105,4 @@ Constant {
104
105
  end
105
106
  st = [x_values.join(" "), y_values.join(" ")].map{|e| "{curve i %s}" % e }.join(" ")
106
107
  end
107
- end
108
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for PFMatchit
2
3
  class Tracksperanto::Export::PFMatchit < Tracksperanto::Export::Base
3
4
 
@@ -53,4 +54,4 @@ class Tracksperanto::Export::PFMatchit < Tracksperanto::Export::Base
53
54
  def camera_name
54
55
  "1"
55
56
  end
56
- end
57
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for PFTrack .2dt files
2
3
  class Tracksperanto::Export::PFTrack4 < Tracksperanto::Export::Base
3
4
 
@@ -39,4 +40,4 @@ class Tracksperanto::Export::PFTrack4 < Tracksperanto::Export::Base
39
40
  @tracker_io.write(line)
40
41
  @tracker_io.write(LINEBREAK)
41
42
  end
42
- end
43
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for PFTrack .2dt files for version 5
2
3
  class Tracksperanto::Export::PFTrack5 < Tracksperanto::Export::PFMatchit
3
4
 
@@ -24,4 +25,4 @@ class Tracksperanto::Export::PFTrack5 < Tracksperanto::Export::PFMatchit
24
25
  def linebreak
25
26
  "\r\n"
26
27
  end
27
- end
28
+ end
@@ -0,0 +1,38 @@
1
+ # -*- encoding : utf-8 -*-
2
+ # Exports the trackers to a script that is fit for massaging with Tracksperanto as is
3
+ class Tracksperanto::Export::Ruby < Tracksperanto::Export::Base
4
+
5
+ def self.desc_and_extension
6
+ "tracksperanto_ruby.rb"
7
+ end
8
+
9
+ def self.human_name
10
+ "Bare Ruby code"
11
+ end
12
+
13
+ def start_export(w,h)
14
+ @io.puts "require 'rubygems'"
15
+ @io.puts "require 'tracksperanto'"
16
+ @io.puts("width = %d" % w)
17
+ @io.puts("height = %d" % h)
18
+ @io.puts("trackers = []")
19
+ end
20
+
21
+ def start_tracker_segment(name)
22
+ @io.puts(" ")
23
+ @io.write("trackers << ")
24
+ @tracker = Tracksperanto::Tracker.new(:name => name)
25
+ end
26
+
27
+ def export_point(f, x, y, r)
28
+ @tracker.keyframe! :frame => f, :abs_x => x, :abs_y => y, :residual => r
29
+ end
30
+
31
+ def end_tracker_segment
32
+ @io.puts(@tracker.to_ruby)# Just leave that
33
+ end
34
+
35
+ def end_export
36
+ @io.puts(" ")
37
+ end
38
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for Shake .txt tracker blobs
2
3
  class Tracksperanto::Export::ShakeText < Tracksperanto::Export::Base
3
4
  PREAMBLE = "TrackName %s\n Frame X Y Correlation\n"
@@ -25,4 +26,4 @@ class Tracksperanto::Export::ShakeText < Tracksperanto::Export::Base
25
26
  line = TEMPLATE % [frame + 1, abs_float_x, abs_float_y, 1 - float_residual]
26
27
  @io.puts line
27
28
  end
28
- end
29
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Export for Syntheyes tracker UVs.
2
3
  class Tracksperanto::Export::SynthEyes < Tracksperanto::Export::Base
3
4
  include Tracksperanto::UVCoordinates
data/lib/import/base.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # The base class for all the import modules. By default, when you inherit from
2
3
  # this class the inherited class will be included in the list of supported
3
4
  # Tracksperanto importers. The API that an importer should present is very
@@ -77,4 +78,4 @@ class Tracksperanto::Import::Base
77
78
  STDERR.puts "Import::Base#send_tracker has been deprecated, please rewrite your importer to use yield(t) inside each instead"
78
79
  @receiver.push(tracker_obj)
79
80
  end
80
- end
81
+ end
data/lib/import/boujou.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  class Tracksperanto::Import::Boujou < Tracksperanto::Import::Base
2
3
 
3
4
  def self.human_name
@@ -63,4 +64,4 @@ class Tracksperanto::Import::Boujou < Tracksperanto::Import::Base
63
64
  def comment?(line)
64
65
  line =~ COMMENT
65
66
  end
66
- end
67
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Imports 3D Equalizer's text files, version 3
2
3
  class Tracksperanto::Import::Equalizer3 < Tracksperanto::Import::Base
3
4
 
@@ -41,4 +42,4 @@ class Tracksperanto::Import::Equalizer3 < Tracksperanto::Import::Base
41
42
  report_progress("Capturing keyframe #{frame}")
42
43
  {:frame => (frame.to_i - 1), :abs_x => x, :abs_y => y}
43
44
  end
44
- end
45
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Imports 3D Equalizer's text files
2
3
  class Tracksperanto::Import::Equalizer4 < Tracksperanto::Import::Base
3
4
 
@@ -38,4 +39,4 @@ class Tracksperanto::Import::Equalizer4 < Tracksperanto::Import::Base
38
39
  end
39
40
  t
40
41
  end
41
- end
42
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
2
3
 
3
4
  # Flame setups contain clear size indications
@@ -134,4 +135,4 @@ class Tracksperanto::Import::FlameStabilizer < Tracksperanto::Import::Base
134
135
  end || track_tuples[0]
135
136
  base_track_tuple[1..2]
136
137
  end
137
- end
138
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  class Tracksperanto::Import::MatchMover < Tracksperanto::Import::Base
2
3
 
3
4
  def self.autodetects_size?
@@ -42,7 +43,7 @@ class Tracksperanto::Import::MatchMover < Tracksperanto::Import::Base
42
43
  t = Tracksperanto::Tracker.new(:name => tracker_name)
43
44
  while(line = io.gets) do
44
45
  return t if line =~ /\}/
45
- t.keyframes.push(extract_key(line.strip)) if line =~ /^(\s+?)(\d)/
46
+ t.push(extract_key(line.strip)) if line =~ /^(\s+?)(\d)/
46
47
  report_progress("Extracting keyframe")
47
48
  end
48
49
  raise "Track didn't close"
@@ -65,4 +66,4 @@ class Tracksperanto::Import::MatchMover < Tracksperanto::Import::Base
65
66
  float_pat = /([\-\d\.]+)/
66
67
  1 - residual_segment.scan(float_pat).flatten.shift.to_f
67
68
  end
68
- end
69
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  class Tracksperanto::Import::MayaLive < Tracksperanto::Import::Base
2
3
 
3
4
  # Maya Live exports and imports tracks in "aspect units", so a point at 0,0
@@ -54,4 +55,4 @@ class Tracksperanto::Import::MayaLive < Tracksperanto::Import::Base
54
55
  def set_residual(residual)
55
56
  (residual == "-1" ? 0 : residual)
56
57
  end
57
- end
58
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  class Tracksperanto::NukeGrammarUtils
2
3
  SECTION_START = /^x(\d+)$/
3
4
  KEYFRAME = /^([-\d\.]+)$/
@@ -29,4 +30,4 @@ class Tracksperanto::NukeGrammarUtils
29
30
  end
30
31
  tuples
31
32
  end
32
- end
33
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'delegate'
2
3
  require File.expand_path(File.dirname(__FILE__)) + "/nuke_grammar/utils"
3
4
 
@@ -62,4 +63,4 @@ class Tracksperanto::Import::NukeScript < Tracksperanto::Import::Base
62
63
  end
63
64
  )
64
65
  end
65
- end
66
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # TODO: this should be rewritten as a proper state-machine parser
2
3
  class Tracksperanto::Import::PFTrack < Tracksperanto::Import::Base
3
4
  def self.human_name
@@ -74,4 +75,4 @@ class Tracksperanto::Import::PFTrack < Tracksperanto::Import::Base
74
75
  def unquote(s)
75
76
  s.gsub(/"/, '')
76
77
  end
77
- end
78
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Tracksperanto::ShakeGrammar
2
3
  # Will replay funcalls through to methods if such methods exist in the public insntance
3
4
  class Catcher < Lexer
@@ -66,4 +67,4 @@ module Tracksperanto::ShakeGrammar
66
67
  end
67
68
 
68
69
  end
69
- end
70
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Tracksperanto::ShakeGrammar
2
3
  class WrongInputError < RuntimeError; end
3
4
 
@@ -156,4 +157,4 @@ module Tracksperanto::ShakeGrammar
156
157
  @buf = ''
157
158
  end
158
159
  end
159
- end
160
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require File.expand_path(File.dirname(__FILE__)) + "/shake_grammar/lexer"
2
3
  require File.expand_path(File.dirname(__FILE__)) + "/shake_grammar/catcher"
3
4
 
@@ -297,4 +298,4 @@ class Tracksperanto::Import::ShakeScript < Tracksperanto::Import::Base
297
298
  end
298
299
 
299
300
  end
300
- end
301
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Import for Shake Text files
2
3
  class Tracksperanto::Import::ShakeText < Tracksperanto::Import::Base
3
4
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  class Tracksperanto::Import::Syntheyes < Tracksperanto::Import::Base
2
3
  include Tracksperanto::UVCoordinates
3
4
 
@@ -30,4 +31,4 @@ class Tracksperanto::Import::Syntheyes < Tracksperanto::Import::Base
30
31
  yield(@last_tracker) if @last_tracker && @last_tracker.any?
31
32
 
32
33
  end
33
- end
34
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # The base middleware class works just like a Tracksperanto::Export::Base, but it only wraps another exporting object and does not get registered on it's own
2
3
  # as an export format. Middleware can be used to massage the tracks being exported in various interesting ways - like moving the coordinates, clipping the keyframes,
3
4
  # scaling the whole export or even reversing the trackers to go backwards
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Does the same as the Pad middleware but with absolute pixel values instead of fractionals
2
3
  class Tracksperanto::Middleware::Crop < Tracksperanto::Middleware::Base
3
4
  attr_accessor :top, :left, :right, :bottom
@@ -13,4 +14,4 @@ class Tracksperanto::Middleware::Crop < Tracksperanto::Middleware::Base
13
14
  %w( start_tracker_segment end_tracker_segment export_point end_export).each do | m |
14
15
  define_method(m){|*a| @pad.send(m, *a)}
15
16
  end
16
- end
17
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Flips the comp being exported horizontally
2
3
  class Tracksperanto::Middleware::Flip < Tracksperanto::Middleware::Base
3
4
 
@@ -8,4 +9,4 @@ class Tracksperanto::Middleware::Flip < Tracksperanto::Middleware::Base
8
9
  @exporter = Tracksperanto::Middleware::Scaler.new(@exporter, :x_factor => factor)
9
10
  super
10
11
  end
11
- end
12
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Flips the comp being exported vertically
2
3
  class Tracksperanto::Middleware::Flop < Tracksperanto::Middleware::Base
3
4
 
@@ -8,4 +9,4 @@ class Tracksperanto::Middleware::Flop < Tracksperanto::Middleware::Base
8
9
  @exporter = Tracksperanto::Middleware::Scaler.new(@exporter, :y_factor => factor)
9
10
  super
10
11
  end
11
- end
12
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # This middleware marks all trackers as being 100% accurate
2
3
  class Tracksperanto::Middleware::Golden < Tracksperanto::Middleware::Base
3
4
  attr_accessor :enabled
@@ -6,4 +7,4 @@ class Tracksperanto::Middleware::Golden < Tracksperanto::Middleware::Base
6
7
  super(frame, float_x, float_y, (enabled ? 0.0 : float_residual))
7
8
  end
8
9
 
9
- end
10
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # This middleware removes trackers that contain less than min_length keyframes
2
3
  # from the exported batch
3
4
  class Tracksperanto::Middleware::LengthCutoff < Tracksperanto::Middleware::Base
@@ -21,4 +22,4 @@ class Tracksperanto::Middleware::LengthCutoff < Tracksperanto::Middleware::Base
21
22
  end
22
23
 
23
24
 
24
- end
25
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # This middleware adds linearly interpolated keyframes BETWEEN the keyframes passing through the exporter
2
3
  class Tracksperanto::Middleware::Lerp < Tracksperanto::Middleware::Base
3
4
  attr_accessor :enabled
@@ -55,4 +56,4 @@ class Tracksperanto::Middleware::Lerp < Tracksperanto::Middleware::Base
55
56
 
56
57
  return [x, y]
57
58
  end
58
- end
59
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Prevents you from exporting invalid trackers
2
3
  class Tracksperanto::Middleware::Lint < Tracksperanto::Middleware::Base
3
4
  class NoTrackersExportedError < RuntimeError
@@ -74,4 +75,4 @@ class Tracksperanto::Middleware::Lint < Tracksperanto::Middleware::Base
74
75
  raise NoTrackersExportedError if @trackers.zero?
75
76
  super
76
77
  end
77
- end
78
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # This middleware pads the comp or crops it if given negative values. Use it to say unpad
2
3
  # some fucked-up telecine transfers. The padding is in fractional units of the total width
3
4
  # and height
@@ -17,4 +18,4 @@ class Tracksperanto::Middleware::Pad < Tracksperanto::Middleware::Base
17
18
  super(frame, float_x - @shift_left, float_y - @shift_bottom, float_residual)
18
19
  end
19
20
 
20
- end
21
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # This middleware prepends the names of the trackers passing through it with a prefix
2
3
  # and an underscore
3
4
  class Tracksperanto::Middleware::Prefix < Tracksperanto::Middleware::Base
@@ -10,4 +11,4 @@ class Tracksperanto::Middleware::Prefix < Tracksperanto::Middleware::Base
10
11
  super(prefixed_name.join('_'))
11
12
  end
12
13
 
13
- end
14
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require File.dirname(__FILE__) + '/scaler'
2
3
 
3
4
  # This middleware reformats (scales) the track setup to a specific pixel resolution. Very useful for
@@ -19,4 +20,4 @@ class Tracksperanto::Middleware::Reformat < Tracksperanto::Middleware::Base
19
20
  @exporter = Tracksperanto::Middleware::Scaler.new(@exporter, :x_factor => x_factor, :y_factor => y_factor)
20
21
  super
21
22
  end
22
- end
23
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Scales the comp being exported by a specific factor, together with the tracker keyframes
2
3
  class Tracksperanto::Middleware::Scaler < Tracksperanto::Middleware::Base
3
4
  DEFAULT_FACTOR = 1
@@ -34,4 +35,4 @@ class Tracksperanto::Middleware::Scaler < Tracksperanto::Middleware::Base
34
35
  def set_residual_factor
35
36
  @residual_factor = Math.sqrt((x_factor ** 2) + (y_factor ** 2))
36
37
  end
37
- end
38
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # This middleware moves the keyframs by a preset number of pixels
2
3
  class Tracksperanto::Middleware::Shift < Tracksperanto::Middleware::Base
3
4
  attr_accessor :x_shift, :y_shift
@@ -7,4 +8,4 @@ class Tracksperanto::Middleware::Shift < Tracksperanto::Middleware::Base
7
8
  super(frame, float_x + @x_shift.to_f, float_y + @y_shift.to_f, float_residual)
8
9
  end
9
10
 
10
- end
11
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Slips the keyframe positions by a specific integer amount of frames, positive values slip forward (later in time). Useful if you just edited some stuff onto
2
3
  # the beginning if your sequence and need to extend your tracks.
3
4
  class Tracksperanto::Middleware::Slipper < Tracksperanto::Middleware::Base
@@ -7,4 +8,4 @@ class Tracksperanto::Middleware::Slipper < Tracksperanto::Middleware::Base
7
8
  def export_point(frame, float_x, float_y, float_residual)
8
9
  super(frame + @slip.to_i, float_x, float_y, float_residual)
9
10
  end
10
- end
11
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # This middleware removes all keyframes before frame 0, and skips trackers entirely if they are all before frame 0
2
3
  class Tracksperanto::Middleware::StartTrim < Tracksperanto::Middleware::Base
3
4
  attr_accessor :enabled
@@ -13,4 +14,4 @@ class Tracksperanto::Middleware::StartTrim < Tracksperanto::Middleware::Base
13
14
  def export_point(frame, float_x, float_y, float_residual)
14
15
  return super unless (@enabled && frame < 0)
15
16
  end
16
- end
17
+ end
data/lib/pipeline/base.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  module Tracksperanto::Pipeline
2
3
 
3
4
  class EmptySourceFileError < RuntimeError
@@ -227,4 +228,4 @@ module Tracksperanto::Pipeline
227
228
  @ios.push(File.open(path_to_file, "wb"))[-1]
228
229
  end
229
230
  end
230
- end
231
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Implements the conventional constructor with "hash of attributes" and block support
2
3
  module Tracksperanto::BlockInit
3
4
  def initialize(object_attribute_hash = {})
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require "tempfile"
2
3
 
3
4
  # BufferIO is used for writing big segments of text. It works like a StringIO, but when the size
@@ -62,4 +63,4 @@ class Tracksperanto::BufferIO < DelegateClass(IO)
62
63
  def replace_with_tempfile_if_needed
63
64
  replace_with_tempfile if !@tempfile_in && pos > MAX_IN_MEM_BYTES
64
65
  end
65
- end
66
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Shake uses this reader to parse byte by byte without having to read byte by byte.
2
3
  # Reading byte by byte is very inefficient, but we want to parse byte by byte since
3
4
  # this makes parser construction much easier. So what we do is cache some chunk of the
@@ -36,4 +37,4 @@ class Tracksperanto::BufferingReader
36
37
  data = @io.read(@bufsize)
37
38
  @buf = StringIO.new(data.to_s) # Make nil become ""
38
39
  end
39
- end
40
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  # Helps to define things that will forcibly become floats, integers or strings
2
3
  module Tracksperanto::Casts
3
4
  def self.included(into)
@@ -28,4 +29,4 @@ module Tracksperanto::Casts
28
29
  define_method("#{an_attr}=") { |to| instance_variable_set("@#{an_attr}", to.to_s) }
29
30
  end
30
31
  end
31
- end
32
+ end