mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
cleanup
This commit is contained in:
parent
d3de449b7b
commit
dd577dd080
1 changed files with 8 additions and 10 deletions
|
|
@ -15,18 +15,15 @@ local exclude_patters = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- TODO: replace with actual expression -> lua translator
|
-- TODO: replace with actual expression -> lua translator
|
||||||
local function process_expression(src, memoised, ismul, iscurve)
|
local function process_expression(src, memoised, mode)
|
||||||
if not iscurve then
|
if mode == 'mul' then
|
||||||
if ismul then
|
src = string.format("(%s) * intensity + (1.0 - intensity)", src)
|
||||||
src = string.format("(%s) * intensity + (1.0 - intensity)", src)
|
elseif mode == "add" then
|
||||||
else
|
src = string.format("(%s) * intensity", src)
|
||||||
src = string.format("(%s) * intensity", src)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, pattern in ipairs(exclude_patters) do
|
for i, pattern in ipairs(exclude_patters) do
|
||||||
if src:find(pattern) then
|
if src:find(pattern) then
|
||||||
debug.print(exclude_patters)
|
|
||||||
error("invalid syntax "..string.escape(src))
|
error("invalid syntax "..string.escape(src))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -150,7 +147,8 @@ local function codegen_track(raw_track, lineset, memoised, keysets, use_tsf)
|
||||||
for i, line in ipairs(lines) do
|
for i, line in ipairs(lines) do
|
||||||
if line.expression then
|
if line.expression then
|
||||||
code = code .. "\n local l" .. i .. " = (" ..
|
code = code .. "\n local l" .. i .. " = (" ..
|
||||||
process_expression(line.expression, memoised, is_multiplier[line.channel]) .. ")"
|
process_expression(line.expression, memoised,
|
||||||
|
is_multiplier[line.channel] and "mul" or "add") .. ")"
|
||||||
elseif line.keys then
|
elseif line.keys then
|
||||||
local target_keysets = keysets[lineset.target_name]
|
local target_keysets = keysets[lineset.target_name]
|
||||||
if not target_keysets then
|
if not target_keysets then
|
||||||
|
|
@ -286,7 +284,7 @@ function internals.compile_animation_track(raw_track, track_name)
|
||||||
for name, curve in pairs(raw_track.curves) do
|
for name, curve in pairs(raw_track.curves) do
|
||||||
context.curves[name] = load(string.format(
|
context.curves[name] = load(string.format(
|
||||||
"return function(kl, kr, t) return %s end",
|
"return function(kl, kr, t) return %s end",
|
||||||
process_expression(curve.func, context.memoised, false, true)
|
process_expression(curve.func, context.memoised, "curve")
|
||||||
), "<curve>", "t", env)()
|
), "<curve>", "t", env)()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue