mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
feat: vca keyframes support
This commit is contained in:
parent
57c9da2eb1
commit
ff0d7d094f
1 changed files with 28 additions and 7 deletions
|
|
@ -167,6 +167,12 @@ local action_to_channel = {
|
||||||
rotate = CH_ROTATE
|
rotate = CH_ROTATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local curve_to_interp = {
|
||||||
|
const = INT_CONST,
|
||||||
|
linear = INT_LINEAR,
|
||||||
|
bezier = INT_BEZIER,
|
||||||
|
}
|
||||||
|
|
||||||
function this.parse_track(root)
|
function this.parse_track(root)
|
||||||
local linesets = {}
|
local linesets = {}
|
||||||
for i, node in ipairs(root) do
|
for i, node in ipairs(root) do
|
||||||
|
|
@ -182,14 +188,29 @@ function this.parse_track(root)
|
||||||
linesets[bone] = lineset
|
linesets[bone] = lineset
|
||||||
end
|
end
|
||||||
|
|
||||||
local line
|
local line = {
|
||||||
|
axis = ("xyz"):find(node.by),
|
||||||
|
channel = action_to_channel[tag]
|
||||||
|
}
|
||||||
if node.func then
|
if node.func then
|
||||||
line = {
|
line.expression = node.func
|
||||||
axis = ("xyz"):find(node.by),
|
elseif node.curve then
|
||||||
channel = action_to_channel[tag],
|
line.interp = curve_to_interp[node.curve]
|
||||||
expression = node.func,
|
line.keys = {}
|
||||||
}
|
for j, key_node in ipairs(node) do
|
||||||
elseif #node > 0 then
|
local keyframe = {
|
||||||
|
frame = tonumber(key_node.frame),
|
||||||
|
value = tonumber(key_node.value),
|
||||||
|
}
|
||||||
|
if line.interp == INT_BEZIER then
|
||||||
|
keyframe.lx = tonumber(key_node.lx)
|
||||||
|
keyframe.ly = tonumber(key_node.ly)
|
||||||
|
keyframe.rx = tonumber(key_node.rx)
|
||||||
|
keyframe.ry = tonumber(key_node.ry)
|
||||||
|
end
|
||||||
|
table.insert(line.keys, keyframe)
|
||||||
|
end
|
||||||
|
else
|
||||||
error("not implemented")
|
error("not implemented")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue