flame_channel_parser 1.1.2 → 1.2.0

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.
@@ -1,3 +1,11 @@
1
+ === 1.2.0 / 2011-05-20
2
+
3
+ * Ensure single-key channels interpolate correctly
4
+
5
+ === 1.1.1 / 2011-05-17
6
+
7
+ * Added support for 2012 Bezier splines
8
+
1
9
  === 1.1.1 / 2011-05-17
2
10
 
3
11
  * Added support for 2012 Bezier splines
@@ -20,6 +20,7 @@ test/snaps/FLEM_curves_example.action
20
20
  test/snaps/FLEM_curves_example_migrated_to_2012.action
21
21
  test/snaps/FLEM_std_curve.png
22
22
  test/snaps/TW.timewarp
23
+ test/snaps/TW_SingleFrameExtrapolated_from2011.timewarp
23
24
  test/test_flame_channel_parser.rb
24
25
  test/test_interpolator.rb
25
26
  test/test_segments.rb
@@ -1,7 +1,7 @@
1
1
  require "delegate"
2
2
 
3
3
  module FlameChannelParser
4
- VERSION = '1.1.2'
4
+ VERSION = '1.2.0'
5
5
 
6
6
  # Parse a Flame setup into an array of ChannelBlock objects
7
7
  def self.parse(io)
@@ -18,10 +18,8 @@ class FlameChannelParser::Interpolator
18
18
  @segments = []
19
19
 
20
20
  # Edge case - channel has no anim at all
21
- if (channel.length == 0)
22
- @segments << [ConstantFunction.new(channel.base_value)]
23
- elsif (channel.length == 1)
24
- @segments << [ConstantFunction.new(channel[0].value)]
21
+ if channel.length.zero?
22
+ @segments << ConstantFunction.new(channel.base_value)
25
23
  else
26
24
 
27
25
  # First the prepolating segment
@@ -77,7 +77,7 @@ class FlameChannelParser::Parser2011
77
77
 
78
78
  # Get an Interpolator from this channel
79
79
  def to_interpolator
80
- FlameChannelParser::Inteprolator.new(self)
80
+ FlameChannelParser::Interpolator.new(self)
81
81
  end
82
82
 
83
83
  private
@@ -0,0 +1,64 @@
1
+ TimewarpFileVersion 1.0
2
+ CreationDate Tue May 3 18:11:03 2011
3
+
4
+
5
+ Fields 0
6
+ Frames 236
7
+ Origin 1
8
+ RenderType yes
9
+ SamplingStep 0
10
+ Interpolation 0
11
+ FlowQuality 0
12
+ Animation
13
+ Channel Speed
14
+ Extrapolation constant
15
+ Value 125
16
+ Size 1
17
+ KeyVersion 1
18
+ Key 0
19
+ Frame 1
20
+ Value 125
21
+ Interpolation hermite
22
+ RightAutomaticSlope no
23
+ LeftAutomaticSlope no
24
+ BreakSlope yes
25
+ End
26
+ Uncollapsed
27
+ End
28
+ Channel Timing/Timing
29
+ Extrapolation linear
30
+ Value 1
31
+ Size 1
32
+ KeyVersion 1
33
+ Key 0
34
+ Frame 1
35
+ Value 1
36
+ Interpolation hermite
37
+ RightSlope 1.25
38
+ RightAutomaticSlope no
39
+ LeftAutomaticSlope no
40
+ End
41
+ Uncollapsed
42
+ End
43
+ Channel Mix/Mix
44
+ Extrapolation constant
45
+ Value 0
46
+ End
47
+ Channel Trail/Pre_Trail
48
+ Extrapolation constant
49
+ Value 1
50
+ End
51
+ Channel Trail/Pre_Weight
52
+ Extrapolation constant
53
+ Value 100
54
+ End
55
+ Channel Trail/Post_Trail
56
+ Extrapolation constant
57
+ Value 1
58
+ End
59
+ Channel Trail/Post_Weight
60
+ Extrapolation constant
61
+ Value 100
62
+ End
63
+ ChannelEnd
64
+ End
@@ -41,6 +41,8 @@ class TestFlameChannelParser < Test::Unit::TestCase
41
41
  last_chan = channels[-1]
42
42
  assert_equal "position/y", last_chan.name
43
43
  assert_equal 6, last_chan.length
44
+ i = last_chan.to_interpolator
45
+ assert_kind_of FlameChannelParser::Interpolator, i
44
46
  end
45
47
 
46
48
  def test_action_from_2012
@@ -94,4 +94,15 @@ class TestInterpolator < Test::Unit::TestCase
94
94
  sampled = channels_in_action.find{|c| c.name == "position/y" && c.length > 2 }
95
95
  assert_same_interpolation(-10..300, reference, sampled)
96
96
  end
97
+
98
+ def test_tw_with_constant
99
+ data = File.open(File.dirname(__FILE__) + "/snaps/TW_SingleFrameExtrapolated_from2011.timewarp")
100
+ channels_in_tw = FlameChannelParser.parse(data)
101
+ chan = channels_in_tw.find{|c| c.name == "Timing/Timing"}
102
+
103
+ interp = chan.to_interpolator
104
+ assert_in_delta 1, interp.sample_at(1), DELTA
105
+ assert_in_delta 374.75, interp.sample_at(300), DELTA
106
+ end
107
+
97
108
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flame_channel_parser
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
9
8
  - 2
10
- version: 1.1.2
9
+ - 0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Julik Tarkhanov
@@ -70,6 +70,7 @@ files:
70
70
  - test/snaps/FLEM_curves_example_migrated_to_2012.action
71
71
  - test/snaps/FLEM_std_curve.png
72
72
  - test/snaps/TW.timewarp
73
+ - test/snaps/TW_SingleFrameExtrapolated_from2011.timewarp
73
74
  - test/test_flame_channel_parser.rb
74
75
  - test/test_interpolator.rb
75
76
  - test/test_segments.rb