flame_channel_parser 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Manifest.txt +1 -0
- data/lib/flame_channel_parser.rb +1 -1
- data/lib/interpolator.rb +2 -4
- data/lib/parser_2011.rb +1 -1
- data/test/snaps/TW_SingleFrameExtrapolated_from2011.timewarp +64 -0
- data/test/test_flame_channel_parser.rb +2 -0
- data/test/test_interpolator.rb +11 -0
- metadata +4 -3
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -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
|
data/lib/flame_channel_parser.rb
CHANGED
data/lib/interpolator.rb
CHANGED
@@ -18,10 +18,8 @@ class FlameChannelParser::Interpolator
|
|
18
18
|
@segments = []
|
19
19
|
|
20
20
|
# Edge case - channel has no anim at all
|
21
|
-
if
|
22
|
-
@segments <<
|
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
|
data/lib/parser_2011.rb
CHANGED
@@ -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
|
data/test/test_interpolator.rb
CHANGED
@@ -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:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
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
|