mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix custom curves
This commit is contained in:
parent
ac3d4a5148
commit
ea63d29221
1 changed files with 8 additions and 6 deletions
|
|
@ -15,11 +15,13 @@ local exclude_patters = {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- TODO: replace with actual expression -> lua translator
|
-- TODO: replace with actual expression -> lua translator
|
||||||
local function process_expression(src, memoised, ismul)
|
local function process_expression(src, memoised, ismul, iscurve)
|
||||||
if ismul then
|
if not iscurve then
|
||||||
src = string.format("(%s) * intensity + (1.0 - intensity)", src)
|
if ismul then
|
||||||
else
|
src = string.format("(%s) * intensity + (1.0 - intensity)", src)
|
||||||
src = string.format("(%s) * intensity", src)
|
else
|
||||||
|
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
|
||||||
|
|
@ -284,7 +286,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)
|
process_expression(curve.func, context.memoised, false, true)
|
||||||
), "<curve>", "t", env)()
|
), "<curve>", "t", env)()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue