mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
add 'texture' vca directive
This commit is contained in:
parent
5ecbeeda7e
commit
c573d01cb7
3 changed files with 41 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ local action_to_channel = {
|
|||
rotate = animation.CH_ROTATE,
|
||||
scale = animation.CH_SCALE,
|
||||
zoom = animation.CH_ZOOM,
|
||||
texture = animation.CH_TEXTURE,
|
||||
}
|
||||
|
||||
local curve_to_interp = {
|
||||
|
|
@ -50,6 +51,17 @@ local function parse_curve(line, node)
|
|||
end
|
||||
end
|
||||
|
||||
local function parse_simple_frames(line, node)
|
||||
line.keys = {}
|
||||
for j, key_node in ipairs(node) do
|
||||
local keyframe = {
|
||||
frame = tonumber(key_node.frame),
|
||||
value = key_node.value,
|
||||
}
|
||||
table.insert(line.keys, keyframe)
|
||||
end
|
||||
end
|
||||
|
||||
local function parse_track(root)
|
||||
local raw_track = {
|
||||
duration = math.huge,
|
||||
|
|
@ -74,8 +86,10 @@ local function parse_track(root)
|
|||
local target_type = nil
|
||||
if node.bone then
|
||||
target_type = "bone"
|
||||
elseif tag == "texture" then
|
||||
target_type = "texture"
|
||||
end
|
||||
local target_name = node.bone or ""
|
||||
local target_name = node.bone or node.name or ""
|
||||
local lineset = linesets[target_name]
|
||||
if not lineset then
|
||||
lineset = {
|
||||
|
|
@ -86,16 +100,20 @@ local function parse_track(root)
|
|||
linesets[target_name] = lineset
|
||||
end
|
||||
|
||||
local channel = action_to_channel[tag]
|
||||
if not channel then
|
||||
error("unknown directive " .. tag:escape())
|
||||
end
|
||||
local line = {
|
||||
axis = node.by and ("xyz"):find(node.by) or "",
|
||||
channel = action_to_channel[tag]
|
||||
channel = channel
|
||||
}
|
||||
if node.func then
|
||||
line.expression = node.func
|
||||
elseif node.curve then
|
||||
parse_curve(line, node)
|
||||
else
|
||||
error("not implemented")
|
||||
parse_simple_frames(line, node)
|
||||
end
|
||||
|
||||
table.insert(lineset.lines, line)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue