tracksperanto 3.5.4 → 3.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 3.5.5
2
+
3
+ * Fix joining animation curves that had negative frame numbers (might happen in Nuke scripts)
4
+
1
5
  === 3.5.4
2
6
 
3
7
  * Fix parsing Nuke scripts with Tracker4 where some tracks were expression-only
data/lib/tracksperanto.rb CHANGED
@@ -5,7 +5,7 @@ require 'tempfile'
5
5
 
6
6
  module Tracksperanto
7
7
  PATH = File.expand_path(File.dirname(__FILE__))
8
- VERSION = '3.5.4'
8
+ VERSION = '3.5.5'
9
9
 
10
10
  module Import; end
11
11
  module Export; end
@@ -10,14 +10,20 @@ module Tracksperanto::ZipTuples
10
10
  #
11
11
  # We make use of the fact that setting an offset index in an array fills it with nils up to
12
12
  # the index inserted
13
- def zip_curve_tuples(*curves)
14
- tuples = curves.inject([]) do | tuples, curve_of_at_and_value |
15
- curve_of_at_and_value.each do | frame, value |
16
- tuples[frame] = tuples[frame] ? (tuples[frame] << value) : [frame, value]
13
+ def zip_curve_tuples(*given_curves)
14
+ tuples = {}
15
+ given_curves.each_with_index do | curve, curve_i |
16
+ curve.each do | frame_value_tuple |
17
+ frame, value = frame_value_tuple
18
+ tuples[frame] ||= Array.new(given_curves.length)
19
+ tuples[frame][curve_i] = value
17
20
  end
18
- tuples
19
21
  end
20
22
 
21
- tuples.reject{|e| e.nil? || (e.length < (curves.length + 1)) }
23
+ tuples.delete_if {|k,v| v.include?(nil) } # If any of the positions is nil
24
+
25
+ tuples.keys.sort.map do | frame_in_order |
26
+ [frame_in_order] + tuples[frame_in_order]
27
+ end
22
28
  end
23
29
  end
@@ -279,6 +279,17 @@ class NukeImportTest < Test::Unit::TestCase
279
279
  assert_equal 5, trackers.length
280
280
  end
281
281
 
282
+ def test_no_failure_with_negative_frame_indices_in_curve
283
+ fixture = File.open(File.dirname(__FILE__) + '/samples/nuke/sh110_trackers_004_ipad1.nk')
284
+ parser = Tracksperanto::Import::NukeScript.new(:io => fixture)
285
+ parser.width = 2688
286
+ parser.height = 1512
287
+ trackers = parser.to_a
288
+ assert_equal 4, trackers.length
289
+ assert_equal 'Tracker1_track_1', trackers[0].name
290
+ assert_equal 99, trackers[0].length
291
+ end
292
+
282
293
  def test_zip_channels
283
294
  tuples_x = [[1, 125], [3, 234], [5, 456], [9,876]]
284
295
  tuples_y = [[2, 437], [3, 123], [6, 432], [9, 430]]
@@ -9,17 +9,24 @@ class TestZipTuples < Test::Unit::TestCase
9
9
  end
10
10
 
11
11
  def test_zip_with_standard_dataset
12
- assert_equal [[1, 123, 234]], zip_curve_tuples([[1, 123], [1,234]])
12
+ assert_equal [[1, 123, 234]], zip_curve_tuples([[1, 123]], [[1, 234]])
13
13
  end
14
14
 
15
15
  def test_zip_with_missing_step
16
- assert_equal [[1, 123, 345], [2, 234]], zip_curve_tuples([[1, 123], [1, 345], [2,234]])
16
+ assert_equal [[1, 123, 234]], zip_curve_tuples([[1, 123], [2, 456]], [[1, 234]])
17
17
  end
18
-
18
+
19
19
  def test_zip_with_two_curves
20
20
  curve_a = [[1, 123], [2, 345]]
21
21
  curve_b = [[1, 23.4], [2, 14.5]]
22
22
  result = [[1, 123, 23.4], [2, 345, 14.5]]
23
23
  assert_equal result, zip_curve_tuples(curve_a, curve_b)
24
24
  end
25
+
26
+ def test_zip_with_negative_frame_indices
27
+ curve_a = [[-100, 123], [24, 345]]
28
+ curve_b = [[-100, 23.4], [24, 14.5]]
29
+ result = [[-100, 123, 23.4], [24, 345, 14.5]]
30
+ assert_equal result, zip_curve_tuples(curve_a, curve_b)
31
+ end
25
32
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{tracksperanto}
8
- s.version = "3.5.4"
8
+ s.version = "3.5.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julik Tarkhanov"]
12
- s.date = %q{2014-11-08}
12
+ s.date = %q{2014-11-24}
13
13
  s.default_executable = %q{tracksperanto}
14
14
  s.description = %q{Converts 2D track exports between different apps like Flame, MatchMover, PFTrack...}
15
15
  s.email = %q{me@julik.nl}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracksperanto
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 5
9
- - 4
10
- version: 3.5.4
9
+ - 5
10
+ version: 3.5.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julik Tarkhanov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-11-08 00:00:00 +01:00
18
+ date: 2014-11-24 00:00:00 +01:00
19
19
  default_executable: tracksperanto
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency