mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add 'period' keyframes-based line parameter
This commit is contained in:
parent
5310de45f0
commit
e485aedc8e
4 changed files with 12 additions and 9 deletions
|
|
@ -48,8 +48,9 @@ local this = {
|
||||||
INT_LINEAR = 2,
|
INT_LINEAR = 2,
|
||||||
INT_BEZIER = 3,
|
INT_BEZIER = 3,
|
||||||
INT_CUSTOM = 4,
|
INT_CUSTOM = 4,
|
||||||
|
ALMOST_HUGE = 1e9,
|
||||||
|
|
||||||
TRACE_CODEGEN = false,
|
TRACE_CODEGEN = true,
|
||||||
|
|
||||||
maths = {
|
maths = {
|
||||||
bezier_interpolation = bezier_interpolation
|
bezier_interpolation = bezier_interpolation
|
||||||
|
|
|
||||||
|
|
@ -150,16 +150,16 @@ local function codegen_track(raw_track, lineset, memoised, keysets, use_tsf)
|
||||||
local valueat = string.format("curves[%s]", string.escape(line.curve_func))
|
local valueat = string.format("curves[%s]", string.escape(line.curve_func))
|
||||||
|
|
||||||
code = code .. string.format(
|
code = code .. string.format(
|
||||||
"\n local l%d = value_at_custom(keysets['%s'][%d], t * %s, %s)",
|
"\n local l%d = value_at_custom(keysets['%s'][%d], t * %s %% %s, %s)",
|
||||||
i, lineset.target_name, i, raw_track.fps, valueat)
|
i, lineset.target_name, i, raw_track.fps, line.period, valueat)
|
||||||
elseif line.channel == animation.CH_TEXTURE then
|
elseif line.channel == animation.CH_TEXTURE then
|
||||||
code = code .. string.format(
|
code = code .. string.format(
|
||||||
"\n local l%d = string_at(keysets['%s'][%d], t * %s)",
|
"\n local l%d = string_at(keysets['%s'][%d], t * %s %% %s)",
|
||||||
i, lineset.target_name, i, raw_track.fps)
|
i, lineset.target_name, i, raw_track.fps, line.period)
|
||||||
else
|
else
|
||||||
code = code .. string.format(
|
code = code .. string.format(
|
||||||
"\n local l%d = value_at(keysets['%s'][%d], t * %s, %s)",
|
"\n local l%d = value_at(keysets['%s'][%d], t * %s %% %s, %s)",
|
||||||
i, lineset.target_name, i, raw_track.fps, line.interp)
|
i, lineset.target_name, i, raw_track.fps, line.period, line.interp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,10 @@ local function parse_track(root)
|
||||||
end
|
end
|
||||||
local line = {
|
local line = {
|
||||||
axis = node.by and ("xyz"):find(node.by) or "",
|
axis = node.by and ("xyz"):find(node.by) or "",
|
||||||
channel = channel
|
channel = channel,
|
||||||
|
period = node.period or animation.ALMOST_HUGE
|
||||||
}
|
}
|
||||||
|
debug.print(animation.ALMOST_HUGE)
|
||||||
if node.func then
|
if node.func then
|
||||||
line.expression = node.func
|
line.expression = node.func
|
||||||
elseif node.curve then
|
elseif node.curve then
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
local ALMOST_HUGE = 1e9
|
local ALMOST_HUGE = animation.ALMOST_HUGE
|
||||||
|
|
||||||
local rig = entity.skeleton
|
local rig = entity.skeleton
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue