tracksperanto 3.5.4 → 3.5.5
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/History.txt +4 -0
 - data/lib/tracksperanto.rb +1 -1
 - data/lib/tracksperanto/zip_tuples.rb +12 -6
 - data/test/import/test_nuke_import.rb +11 -0
 - data/test/test_zip_tuples.rb +10 -3
 - data/tracksperanto.gemspec +2 -2
 - metadata +4 -4
 
    
        data/History.txt
    CHANGED
    
    
    
        data/lib/tracksperanto.rb
    CHANGED
    
    
| 
         @@ -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(* 
     | 
| 
       14 
     | 
    
         
            -
                tuples =  
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 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. 
     | 
| 
      
 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]]
         
     | 
    
        data/test/test_zip_tuples.rb
    CHANGED
    
    | 
         @@ -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,  
     | 
| 
      
 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
         
     | 
    
        data/tracksperanto.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{tracksperanto}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "3.5. 
     | 
| 
      
 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- 
     | 
| 
      
 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:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 25
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 3
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 5
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 3.5. 
     | 
| 
      
 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- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2014-11-24 00:00:00 +01:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: tracksperanto
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     |