flame_channel_parser 4.0.2 → 4.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.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +6 -1
- data/Gemfile +4 -8
- data/History.txt +12 -0
- data/{README.rdoc → README.md} +33 -14
- data/Rakefile +3 -21
- data/bin/bake_flame_channel +1 -1
- data/bin/flame_channel_inspect +26 -0
- data/flame_channel_parser.gemspec +14 -116
- data/lib/builder.rb +3 -2
- data/lib/extractor.rb +2 -2
- data/lib/flame_channel_parser/version.rb +3 -0
- data/lib/flame_channel_parser.rb +5 -9
- data/lib/framecurve_writers/base.rb +6 -4
- data/lib/framecurve_writers/batch_timewarp.rb +3 -2
- data/lib/framecurve_writers/kronos.rb +3 -2
- data/lib/framecurve_writers/softfx_timewarp.rb +2 -1
- data/lib/inspector.rb +74 -0
- data/lib/interpolator.rb +1 -0
- data/lib/parser.rb +1 -0
- data/lib/segments.rb +2 -1
- data/lib/timewarp_extractor.rb +1 -0
- data/lib/xml_parser.rb +13 -18
- data/test/stabilizer_examples/2014_cornerpin_points.stabilizer +16835 -0
- data/test/test_flame_channel_parser.rb +0 -1
- data/test/test_inspector.rb +39 -0
- data/test/test_inspector_ref_output_stabilizer.txt +76 -0
- data/test/test_inspector_ref_output_timewarp.txt +10 -0
- data/test/test_interpolator.rb +11 -3
- data/test/test_ractor.rb +30 -0
- metadata +94 -41
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 2f724511488b65ce62f27bdd5196fb18b0ab00559f6f3355c4ab156e009d3ae0
|
|
4
|
+
data.tar.gz: d12b7ffcee90ce9dfca4f09177dc42fa9664dd38d98282a4ed60d040699538bc
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8cb8446d91eb42275d8c295d9f06596c99928886c8e2b53ac8382d6e3738a377c97e31547d022840b9868366c0e0a26b0047818f5e8bde23be47fc37e0533562
|
|
7
|
+
data.tar.gz: 3d6c07df92674dea3df971a8a18449ce48e6256ee9d2dad4e1d36be11618cb11caa228bb567c825fb95998aa2aa4ceba707c6285b0c526075b6295fff2b70fa2
|
data/.gitignore
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
source
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
gem "framecurve", "~> 1.0.1"
|
|
3
|
+
gemspec
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
gem "rake"
|
|
9
|
-
gem "cli_test", "~>1.0"
|
|
10
|
-
end
|
|
5
|
+
# Until framecurve 2.2.4 is released
|
|
6
|
+
gem "framecurve", git: "https://github.com/guerilla-di/framecurve.git"
|
data/History.txt
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
=== 4.2.0 / 2026-10-02
|
|
2
|
+
|
|
3
|
+
* Make parsing, interpolation and Builder usable from within Ractors (Ruby 4.0+)
|
|
4
|
+
* Fix `FlameChannelParser.parse`, `XMLParser#parse` and the framecurve writers on Ruby 3+
|
|
5
|
+
(`Proc.new` without a block)
|
|
6
|
+
* Declare the dependencies on `matrix` and `rexml`, which are no longer default gems
|
|
7
|
+
* Require framecurve 2.2.4+
|
|
8
|
+
|
|
9
|
+
=== 4.1.0 / 2014-10-20
|
|
10
|
+
|
|
11
|
+
* Adds `flame_channel_inspect` for examining Flame setups
|
|
12
|
+
|
|
1
13
|
=== 4.0.2 / 2011-09-11
|
|
2
14
|
|
|
3
15
|
* Fix Batch timewarp parsing to framecurve
|
data/{README.rdoc → README.md}
RENAMED
|
@@ -1,29 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
# flame_channel_parser
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://travis-ci.org/guerilla-di/flame_channel_parser)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Flame is a compositing powerhouse, and it's animation tools are extremely good for quickly prototyping things in front of clients. However, once you want to pull your
|
|
6
|
+
animation into other packages it can get troublesome, since only Action nodes currently support any kind of export (and it's FBX, and it's only partial).
|
|
7
|
+
`flame_channel_parser` alleviates the problem - it can load **any** Flame setup file (an `.action` file, or a `.stabilizer` file, or any file created by one of your
|
|
8
|
+
Sparks - like Kronos timewarps for examople) and extract arbitrary animation curves as tables of frames and values.
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
This gem includes a small library for extracting, parsing and baking animation curves made on Discrodesk Floke/Inflinto, also known as flame.
|
|
8
11
|
Thanks to Marijn Eken, Philippe Soeiro and Andre Gagnon for their support and advice.
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
## Features:
|
|
11
14
|
|
|
12
15
|
* All extrapolation and interpolation methods are supported (yes two keyframes with tangents across 2000 frames will do!)
|
|
13
16
|
* Expressions on channels won't be evaluated (obviously!)
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
## Synopsis
|
|
19
|
+
|
|
20
|
+
To examing what channels your setup contains, use the flame_channel_inspect_binary
|
|
21
|
+
|
|
22
|
+
$flame_channel_inspect /usr/discreet/projects/BZO/timewarp/s02_tw.timewarp
|
|
16
23
|
|
|
17
24
|
To just bake a specific channel, use the bake_flame_channel binary.
|
|
18
25
|
|
|
19
26
|
$bake_flame_channel --channel Timing/Timing -e 123 /usr/discreet/projects/BZO/timewarp/s02_tw.timewarp > /mnt/3d/curves/shot2_tw.framecurve.txt
|
|
20
27
|
|
|
21
|
-
If you just need to
|
|
28
|
+
If you just need to extract a framecurve file (http://framecurve.org) from a timewarp, use the framecurve_from_flame which autodetects most of the settings by itself and gives you a nice .framecurve.txt file
|
|
22
29
|
|
|
23
30
|
$framecurve_from_flame /usr/discreet/projects/BZO/timewarp/s02_tw.timewarp
|
|
24
|
-
|
|
31
|
+
|
|
25
32
|
This will create a framecurve file called s02_tw.timewarp.framecurve.txt next to the setup
|
|
26
33
|
|
|
34
|
+
The reverse is true for framecurve_to_flame
|
|
35
|
+
|
|
36
|
+
$framecurve_from_flame /usr/discreet/projects/BZO/timewarp/s02_tw.framecurve.txt
|
|
37
|
+
|
|
38
|
+
will create setup files for use with both Timewarp modules and the Kronos spark.
|
|
39
|
+
|
|
40
|
+
The bonuses are of course in the details - **flame_channel_parser** is a meticulous
|
|
41
|
+
bitch and will faithfully replicate all the tricky things you can do to your animation curves to give them more _oomph_ - like broken tangents, two keyframes on
|
|
42
|
+
500 frames with wild oscillations, looping and linear extrapolations, constant interpolations for jumps and so on. In short, this will _interpolate_ your
|
|
43
|
+
animation channel and extract it frame by frame, so all the animation is intact. **No keyframe baking is necessary** for the Flame operator to do.
|
|
44
|
+
Of course it supports both varieties of Flame setups - the newer 2012 ones as good as the old 9.0 - 2011 ones.
|
|
45
|
+
|
|
27
46
|
To use the library:
|
|
28
47
|
|
|
29
48
|
require "flame_channel_parser"
|
|
@@ -46,19 +65,19 @@ To use the library:
|
|
|
46
65
|
p interpolator.value_at(frame_in_setup)
|
|
47
66
|
end
|
|
48
67
|
|
|
49
|
-
|
|
68
|
+
## Requirements
|
|
50
69
|
|
|
51
|
-
* Ruby 1.8.
|
|
70
|
+
* Ruby 1.8.7 and above
|
|
52
71
|
|
|
53
|
-
|
|
72
|
+
## Installation
|
|
54
73
|
|
|
55
|
-
|
|
74
|
+
$gem install flame_channel_parser
|
|
56
75
|
|
|
57
|
-
|
|
76
|
+
## License
|
|
58
77
|
|
|
59
78
|
(The MIT License)
|
|
60
79
|
|
|
61
|
-
Copyright (c) 2011 Julik Tarkhanov
|
|
80
|
+
Copyright (c) 2011-2015 Julik Tarkhanov
|
|
62
81
|
|
|
63
82
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
64
83
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require 'rubygems'
|
|
4
|
-
require 'jeweler'
|
|
5
|
-
require './lib/flame_channel_parser'
|
|
6
|
-
|
|
7
|
-
Jeweler::Tasks.new do |gem|
|
|
8
|
-
gem.version = FlameChannelParser::VERSION
|
|
9
|
-
gem.name = "flame_channel_parser"
|
|
10
|
-
gem.summary = "A parser/interpolator for Flame/Smoke animation curves"
|
|
11
|
-
gem.description = "Reads and interpolates animation channels in IFFS setups"
|
|
12
|
-
gem.email = "me@julik.nl"
|
|
13
|
-
gem.homepage = "http://guerilla-di.org/flame-channel-parser/"
|
|
14
|
-
gem.authors = ["Julik Tarkhanov"]
|
|
15
|
-
gem.license = 'MIT'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Jeweler::RubygemsDotOrgTasks.new
|
|
19
|
-
|
|
1
|
+
require "bundler/gem_tasks"
|
|
20
2
|
require 'rake/testtask'
|
|
3
|
+
|
|
21
4
|
desc "Run all tests"
|
|
22
5
|
Rake::TestTask.new("test") do |t|
|
|
23
6
|
t.libs << "test"
|
|
@@ -25,6 +8,5 @@ Rake::TestTask.new("test") do |t|
|
|
|
25
8
|
t.verbose = true
|
|
26
9
|
end
|
|
27
10
|
|
|
11
|
+
# Automatically update the LICENSE
|
|
28
12
|
task :default => [ :test ]
|
|
29
|
-
|
|
30
|
-
# vim: syntax=ruby
|
data/bin/bake_flame_channel
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# == Author
|
|
11
11
|
# Julik <me@julik.nl>
|
|
12
12
|
|
|
13
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../lib/flame_channel_parser'
|
|
13
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../lib/flame_channel_parser'
|
|
14
14
|
require 'optparse'
|
|
15
15
|
require 'rubygems'
|
|
16
16
|
require "update_hints"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# == Synopsis
|
|
3
|
+
#
|
|
4
|
+
# Shows a list of animation channels in the given Flame setup file
|
|
5
|
+
#
|
|
6
|
+
# == Usage
|
|
7
|
+
#
|
|
8
|
+
# flame_channel_inspect /usr/discreet/projects/Luxury/timewarp/shot2_tw.timewarp
|
|
9
|
+
#
|
|
10
|
+
# == Author
|
|
11
|
+
# Julik <me@julik.nl>
|
|
12
|
+
|
|
13
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../lib/flame_channel_parser'
|
|
14
|
+
require 'rubygems'
|
|
15
|
+
require "update_hints"
|
|
16
|
+
|
|
17
|
+
setup_path = ARGV.shift
|
|
18
|
+
fail "No input file path provided." unless setup_path
|
|
19
|
+
fail "File does not exist." unless File.exist?(setup_path)
|
|
20
|
+
|
|
21
|
+
parser = FlameChannelParser::Parser.new
|
|
22
|
+
File.open(setup_path, "r") do | f |
|
|
23
|
+
channels = parser.parse(f)
|
|
24
|
+
tree = FlameChannelParser::Inspector.new(channels)
|
|
25
|
+
tree.pretty_print
|
|
26
|
+
end
|
|
@@ -1,131 +1,29 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
1
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
|
|
2
|
+
require File.dirname(__FILE__) + '/lib/flame_channel_parser/version'
|
|
6
3
|
Gem::Specification.new do |s|
|
|
7
4
|
s.name = "flame_channel_parser"
|
|
8
|
-
s.version =
|
|
5
|
+
s.version = FlameChannelParser::VERSION
|
|
9
6
|
|
|
10
|
-
s.
|
|
7
|
+
s.required_ruby_version = ">= 2.6"
|
|
11
8
|
s.authors = ["Julik Tarkhanov"]
|
|
12
|
-
s.date = "
|
|
9
|
+
s.date = Time.now.utc.strftime("%Y-%m-%d")
|
|
13
10
|
s.description = "Reads and interpolates animation channels in IFFS setups"
|
|
14
11
|
s.email = "me@julik.nl"
|
|
15
|
-
s.executables = ["
|
|
12
|
+
s.executables = Dir["bin/*"].map { |f| File.basename(f) }
|
|
16
13
|
s.extra_rdoc_files = [
|
|
17
|
-
"README.
|
|
18
|
-
]
|
|
19
|
-
s.files = [
|
|
20
|
-
".autotest",
|
|
21
|
-
".travis.yml",
|
|
22
|
-
"Gemfile",
|
|
23
|
-
"History.txt",
|
|
24
|
-
"README.rdoc",
|
|
25
|
-
"Rakefile",
|
|
26
|
-
"bin/bake_flame_channel",
|
|
27
|
-
"bin/framecurve_from_flame",
|
|
28
|
-
"bin/framecurve_to_flame",
|
|
29
|
-
"flame_channel_parser.gemspec",
|
|
30
|
-
"lib/builder.rb",
|
|
31
|
-
"lib/channel.rb",
|
|
32
|
-
"lib/extractor.rb",
|
|
33
|
-
"lib/flame_channel_parser.rb",
|
|
34
|
-
"lib/framecurve_writers/base.rb",
|
|
35
|
-
"lib/framecurve_writers/batch_timewarp.rb",
|
|
36
|
-
"lib/framecurve_writers/kronos.rb",
|
|
37
|
-
"lib/framecurve_writers/softfx_timewarp.rb",
|
|
38
|
-
"lib/framecurve_writers/templates/BatchTW.xml",
|
|
39
|
-
"lib/framecurve_writers/templates/SampleKronos.F_Kronos",
|
|
40
|
-
"lib/framecurve_writers/templates/TW_Sample.timewarp",
|
|
41
|
-
"lib/framecurve_writers/templates/key.xml",
|
|
42
|
-
"lib/interpolator.rb",
|
|
43
|
-
"lib/key.rb",
|
|
44
|
-
"lib/parser.rb",
|
|
45
|
-
"lib/segments.rb",
|
|
46
|
-
"lib/timewarp_extractor.rb",
|
|
47
|
-
"lib/xml_parser.rb",
|
|
48
|
-
"test/channel_with_constants.dat",
|
|
49
|
-
"test/helper.rb",
|
|
50
|
-
"test/sample_channel.dat",
|
|
51
|
-
"test/snaps/BatchTimewar_proper.xml",
|
|
52
|
-
"test/snaps/BatchTimewarp_ext1.timewarp_node",
|
|
53
|
-
"test/snaps/Cycle_and_revcycle.action",
|
|
54
|
-
"test/snaps/FLEM_BrokenTangents.action",
|
|
55
|
-
"test/snaps/FLEM_advanced_curve.png",
|
|
56
|
-
"test/snaps/FLEM_advanced_curve_example_FL2012.action",
|
|
57
|
-
"test/snaps/FLEM_baked_curve.png",
|
|
58
|
-
"test/snaps/FLEM_curves_example.action",
|
|
59
|
-
"test/snaps/FLEM_curves_example_migrated_to_2012.action",
|
|
60
|
-
"test/snaps/FLEM_std_curve.png",
|
|
61
|
-
"test/snaps/RefT_Steadicam.timewarp",
|
|
62
|
-
"test/snaps/RefT_Steadicam_Baked.timewarp",
|
|
63
|
-
"test/snaps/RefT_Steadicam_Extraction.txt",
|
|
64
|
-
"test/snaps/RefT_Steadicam_Extraction_F19_to_347.txt",
|
|
65
|
-
"test/snaps/RefT_Steadicam_TwoKFs.timewarp",
|
|
66
|
-
"test/snaps/RefT_Steadicam_TwoKFs_AnotherSlope.timewarp",
|
|
67
|
-
"test/snaps/RefT_Steadicam_TwoKFs_HermiteAtBegin.timewarp",
|
|
68
|
-
"test/snaps/TW.timewarp",
|
|
69
|
-
"test/snaps/TW_015_010_v03.timewarp",
|
|
70
|
-
"test/snaps/TW_SingleFrameExtrapolated_from2011.timewarp",
|
|
71
|
-
"test/snaps/TW_TEST.F_Kronos",
|
|
72
|
-
"test/snaps/timewarp_where_interp_fails_at_end.timewarp",
|
|
73
|
-
"test/test_bake_flame_channel_binary.rb",
|
|
74
|
-
"test/test_base_timewarp_writer.rb",
|
|
75
|
-
"test/test_batch_timewarp_writer.rb",
|
|
76
|
-
"test/test_channel.rb",
|
|
77
|
-
"test/test_cli_framecurve_to_flame.rb",
|
|
78
|
-
"test/test_cli_timewarp_extractor.rb",
|
|
79
|
-
"test/test_extractor.rb",
|
|
80
|
-
"test/test_flame_builder.rb",
|
|
81
|
-
"test/test_flame_channel_parser.rb",
|
|
82
|
-
"test/test_interpolator.rb",
|
|
83
|
-
"test/test_key.rb",
|
|
84
|
-
"test/test_kronos_timewarp_writer.rb",
|
|
85
|
-
"test/test_segments.rb",
|
|
86
|
-
"test/test_softfx_timewarp_writer.rb",
|
|
87
|
-
"test/test_timewarp_extractor.rb",
|
|
88
|
-
"test/test_xml_setup.rb",
|
|
89
|
-
"test/timewarp_examples/TW_015_010_v01_Baked.timewarp",
|
|
90
|
-
"test/timewarp_examples/TW_016_010_v01.timewarp",
|
|
91
|
-
"test/timewarp_examples/TW_016_010_v01_Baked.timewarp",
|
|
92
|
-
"test/timewarp_examples/TW_16_010_v01.output.txt",
|
|
93
|
-
"test/timewarp_examples/TW_TEST.F_Kronos",
|
|
94
|
-
"test/timewarp_examples/output.txt",
|
|
95
|
-
"test/timewarp_examples/simple.framecurve.txt",
|
|
96
|
-
"test/timewarp_examples/tw_batch_out.framecurve.txt",
|
|
97
|
-
"test/timewarp_export_samples/BatchTW.timewarp_node",
|
|
98
|
-
"test/timewarp_export_samples/Kronos.F_Kronos",
|
|
99
|
-
"test/timewarp_export_samples/SoftFX.timewarp"
|
|
14
|
+
"README.md"
|
|
100
15
|
]
|
|
16
|
+
s.files = `git ls-files -z`.split("\x0")
|
|
101
17
|
s.homepage = "http://guerilla-di.org/flame-channel-parser/"
|
|
102
18
|
s.licenses = ["MIT"]
|
|
103
19
|
s.require_paths = ["lib"]
|
|
104
|
-
s.rubygems_version = "1.8.11"
|
|
105
20
|
s.summary = "A parser/interpolator for Flame/Smoke animation curves"
|
|
106
21
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
|
115
|
-
s.add_development_dependency(%q<cli_test>, ["~> 1.0"])
|
|
116
|
-
else
|
|
117
|
-
s.add_dependency(%q<update_hints>, ["~> 1.0"])
|
|
118
|
-
s.add_dependency(%q<framecurve>, ["~> 1.0.1"])
|
|
119
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
120
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
|
121
|
-
s.add_dependency(%q<cli_test>, ["~> 1.0"])
|
|
122
|
-
end
|
|
123
|
-
else
|
|
124
|
-
s.add_dependency(%q<update_hints>, ["~> 1.0"])
|
|
125
|
-
s.add_dependency(%q<framecurve>, ["~> 1.0.1"])
|
|
126
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
127
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
|
128
|
-
s.add_dependency(%q<cli_test>, ["~> 1.0"])
|
|
129
|
-
end
|
|
22
|
+
s.add_runtime_dependency("update_hints", ["~> 1.0"])
|
|
23
|
+
s.add_runtime_dependency("framecurve", ["~> 2", ">= 2.2.4"])
|
|
24
|
+
s.add_runtime_dependency("matrix")
|
|
25
|
+
s.add_runtime_dependency("rexml")
|
|
26
|
+
s.add_development_dependency("rake", [">= 0"])
|
|
27
|
+
s.add_development_dependency("cli_test", ["~> 1.0"])
|
|
28
|
+
s.add_development_dependency("test-unit")
|
|
130
29
|
end
|
|
131
|
-
|
data/lib/builder.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# shareable_constant_value: literal
|
|
1
2
|
# A Builder-like class for exporting Flame setups
|
|
2
3
|
class FlameChannelParser::Builder #< BasicObject
|
|
3
4
|
INDENT = "\t"
|
|
@@ -67,8 +68,8 @@ class FlameChannelParser::Builder #< BasicObject
|
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
def __camelize(s)
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
@camelizations ||= {}
|
|
72
|
+
@camelizations[s] ||= s.to_s.gsub(/(^|_)(.)/) { $2.upcase }
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
def __flameize(v)
|
data/lib/extractor.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# shareable_constant_value: literal
|
|
1
2
|
# Extracts and bakes a specific animation channel to a given buffer, one string per frame
|
|
2
3
|
class FlameChannelParser::Extractor
|
|
3
4
|
|
|
@@ -27,7 +28,7 @@ class FlameChannelParser::Extractor
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def extract(path, options)
|
|
30
|
-
options = DEFAULTS.
|
|
31
|
+
options = DEFAULTS.merge(:destination => $stdout).merge(options)
|
|
31
32
|
File.open(path) do |f|
|
|
32
33
|
|
|
33
34
|
# Then parse
|
|
@@ -47,7 +48,6 @@ class FlameChannelParser::Extractor
|
|
|
47
48
|
|
|
48
49
|
DEFAULT_START_FRAME = 1
|
|
49
50
|
DEFAULTS = {
|
|
50
|
-
:destination => $stdout,
|
|
51
51
|
:start_frame => nil,
|
|
52
52
|
:end_frame => nil,
|
|
53
53
|
:channel => DEFAULT_CHANNEL_TO_EXTRACT,
|
data/lib/flame_channel_parser.rb
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/flame_channel_parser/version'
|
|
2
|
+
|
|
1
3
|
module FlameChannelParser
|
|
2
|
-
VERSION = '4.0.2'
|
|
3
4
|
|
|
4
5
|
module FramecurveWriters; end
|
|
5
6
|
|
|
6
7
|
# Parse a Flame setup into an array of Channel objects.
|
|
7
8
|
# If a block is given to the method it will yield Channel
|
|
8
9
|
# objects one by one instead of accumulating them into an array (useful for big setups)
|
|
9
|
-
def self.parse(io)
|
|
10
|
-
|
|
11
|
-
if block_given?
|
|
12
|
-
c.new.parse(io, &Proc.new)
|
|
13
|
-
else
|
|
14
|
-
c.new.parse(io)
|
|
15
|
-
end
|
|
10
|
+
def self.parse(io, &blk)
|
|
11
|
+
get_parser_class(io).new.parse(io, &blk)
|
|
16
12
|
end
|
|
17
13
|
|
|
18
14
|
# Parse a Flame setup at passed path. Will return the channels instead of yielding them
|
|
@@ -37,7 +33,7 @@ module FlameChannelParser
|
|
|
37
33
|
end
|
|
38
34
|
|
|
39
35
|
%w(
|
|
40
|
-
key channel parser segments interpolator extractor timewarp_extractor builder xml_parser
|
|
36
|
+
key channel parser segments interpolator extractor timewarp_extractor builder xml_parser inspector
|
|
41
37
|
).each {|f| require File.expand_path(File.dirname(__FILE__) + "/" + f ) }
|
|
42
38
|
|
|
43
39
|
%w(
|
|
@@ -12,14 +12,16 @@ class FlameChannelParser::FramecurveWriters::Base
|
|
|
12
12
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
# Kept as a frozen array in a class-level ivar so that it can be read from non-main Ractors
|
|
15
16
|
def self.inherited(by)
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
writers = FlameChannelParser::FramecurveWriters::Base.instance_variable_get(:@writers) || []
|
|
18
|
+
FlameChannelParser::FramecurveWriters::Base.instance_variable_set(:@writers, (writers + [by]).freeze)
|
|
19
|
+
super
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
# Yields each defined writer class to the block
|
|
21
|
-
def self.with_each_writer
|
|
22
|
-
|
|
23
|
+
def self.with_each_writer(&blk)
|
|
24
|
+
FlameChannelParser::FramecurveWriters::Base.instance_variable_get(:@writers).each(&blk)
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
# Should return the desired extension for the exported file
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
# shareable_constant_value: literal
|
|
1
2
|
# Writes out a Batch timewarp node setup
|
|
2
3
|
class FlameChannelParser::FramecurveWriters::BatchTimewarp < FlameChannelParser::FramecurveWriters::SoftfxTimewarp
|
|
3
4
|
|
|
4
|
-
TEMPLATE = File.dirname(__FILE__) + "/templates/BatchTW.xml"
|
|
5
|
-
TEMPLATE_KEY = File.dirname(__FILE__) + "/templates/key.xml"
|
|
5
|
+
TEMPLATE = (File.dirname(__FILE__) + "/templates/BatchTW.xml").freeze
|
|
6
|
+
TEMPLATE_KEY = (File.dirname(__FILE__) + "/templates/key.xml").freeze
|
|
6
7
|
|
|
7
8
|
def self.extension
|
|
8
9
|
'.timewarp_node'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
# shareable_constant_value: literal
|
|
1
2
|
# Writes out a framecurve setup
|
|
2
3
|
class FlameChannelParser::FramecurveWriters::Kronos < FlameChannelParser::FramecurveWriters::SoftfxTimewarp
|
|
3
|
-
TOKEN = Regexp.new('__INSERT_FRAME_ANIM__')
|
|
4
|
-
TEMPLATE = File.dirname(__FILE__) + "/templates/SampleKronos.F_Kronos"
|
|
4
|
+
TOKEN = Regexp.new('__INSERT_FRAME_ANIM__').freeze
|
|
5
|
+
TEMPLATE = (File.dirname(__FILE__) + "/templates/SampleKronos.F_Kronos").freeze
|
|
5
6
|
|
|
6
7
|
def self.extension
|
|
7
8
|
'.F_Kronos'
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
# shareable_constant_value: literal
|
|
1
2
|
# Writes out a framecurve setup
|
|
2
3
|
class FlameChannelParser::FramecurveWriters::SoftfxTimewarp < FlameChannelParser::FramecurveWriters::Base
|
|
3
4
|
DATETIME_FORMAT = '%a %b %d %H:%M:%S %Y'
|
|
4
|
-
TIME = Time.local(2011,12,28,14,50,05)
|
|
5
|
+
TIME = Time.local(2011,12,28,14,50,05).freeze
|
|
5
6
|
|
|
6
7
|
def self.extension
|
|
7
8
|
'.timewarp'
|
data/lib/inspector.rb
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Prints out a viewable tree of channel metadata. Useful when you need to inspect comparable setups
|
|
2
|
+
# for small differentces in channel ordering and animation.
|
|
3
|
+
class FlameChannelParser::Inspector
|
|
4
|
+
|
|
5
|
+
def initialize(channels_arr)
|
|
6
|
+
@branches = OH.new
|
|
7
|
+
channels_arr.each {|c| cluster(c) }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def pretty_print(output = $stdout)
|
|
11
|
+
@out = output
|
|
12
|
+
print_branch(@branches, initial_indent = 0)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
class OH < Hash # It sucks to be Ruby 1.8-compatible sometimes.
|
|
18
|
+
def initialize
|
|
19
|
+
super
|
|
20
|
+
@keys_in_order = []
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def []=(k, v)
|
|
24
|
+
@keys_in_order.delete(k)
|
|
25
|
+
@keys_in_order << k
|
|
26
|
+
super(k, v)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def each_pair
|
|
30
|
+
@keys_in_order.each {|k| yield(k, self[k]) }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def puts(string)
|
|
35
|
+
@out.puts(string)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def print_branch(branch, indent)
|
|
39
|
+
branch.each_pair do | k, v|
|
|
40
|
+
if v.is_a?(Hash)
|
|
41
|
+
puts((" " * indent) + k)
|
|
42
|
+
print_branch(v, indent + 1)
|
|
43
|
+
else
|
|
44
|
+
puts((" " * indent) + k + " - " + channel_metadata(v))
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def channel_metadata(channel)
|
|
50
|
+
if channel.length.zero?
|
|
51
|
+
"no animations, value %s" % [channel.base_value]
|
|
52
|
+
elsif channel.length > 1
|
|
53
|
+
first_key = channel[0].frame
|
|
54
|
+
last_key = channel[-1].frame
|
|
55
|
+
"animated, %d keys, first at %d last at %d" % [channel.length, first_key, last_key]
|
|
56
|
+
else
|
|
57
|
+
first_key = channel[0].frame
|
|
58
|
+
"animated, 1 key at %d, value %s" % [first_key, channel[0].value]
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def cluster(channel)
|
|
63
|
+
path_parts = channel.name.split('/')
|
|
64
|
+
leaf_name = path_parts.pop
|
|
65
|
+
|
|
66
|
+
current = @branches
|
|
67
|
+
path_parts.each do | path_part |
|
|
68
|
+
current[path_part] ||= OH.new
|
|
69
|
+
current = current[path_part]
|
|
70
|
+
end
|
|
71
|
+
current[leaf_name] = channel
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
data/lib/interpolator.rb
CHANGED
data/lib/parser.rb
CHANGED
data/lib/segments.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# shareable_constant_value: literal
|
|
1
2
|
require "matrix"
|
|
2
3
|
|
|
3
4
|
module FlameChannelParser::Segments #:nodoc:
|
|
@@ -52,7 +53,7 @@ module FlameChannelParser::Segments #:nodoc:
|
|
|
52
53
|
[-2, 3, 0, 0],
|
|
53
54
|
[1, -2, 1, 0],
|
|
54
55
|
[1, -1, 0, 0]
|
|
55
|
-
].transpose
|
|
56
|
+
].transpose.freeze
|
|
56
57
|
|
|
57
58
|
def initialize(from_frame, to_frame, value1, value2, tangent1, tangent2)
|
|
58
59
|
|
data/lib/timewarp_extractor.rb
CHANGED