replace control with show for visibility

This commit is contained in:
MihailRis 2026-10-08 23:24:09 +03:00
parent bbe1873bc7
commit 26d09f750b
3 changed files with 12 additions and 10 deletions

View file

@ -45,7 +45,7 @@ local M = {
CH_SCALE = 3, CH_SCALE = 3,
CH_ZOOM = 4, CH_ZOOM = 4,
CH_TEXTURE = 5, CH_TEXTURE = 5,
CH_CONTROL = 6, CH_SHOW = 6,
INT_CONST = 1, INT_CONST = 1,
INT_LINEAR = 2, INT_LINEAR = 2,

View file

@ -192,13 +192,11 @@ local function codegen_track(raw_track, lineset, keysets, use_tsf, target_type)
elseif line.channel == animation.CH_TEXTURE then elseif line.channel == animation.CH_TEXTURE then
code = code .. string.format("\n target:set_texture(%s, l%d)", code = code .. string.format("\n target:set_texture(%s, l%d)",
lineset.target_name:escape(), i) lineset.target_name:escape(), i)
elseif line.channel == animation.CH_CONTROL then elseif line.channel == animation.CH_SHOW then
if lineset.flag == "visible" then if target_type == "bone" then
if target_type == "bone" then code = code .. string.format("\n target:set_visible(bone_index, l%d)", i)
code = code .. string.format("\n target:set_visible(bone_index, l%d)", i) else
else code = code .. string.format("\n target:set_visible(l%d)", i)
code = code .. string.format("\n target:set_visible(l%d)", i)
end
end end
end end
end end

View file

@ -8,7 +8,7 @@ local action_to_channel = {
scale = animation.CH_SCALE, scale = animation.CH_SCALE,
zoom = animation.CH_ZOOM, zoom = animation.CH_ZOOM,
texture = animation.CH_TEXTURE, texture = animation.CH_TEXTURE,
control = animation.CH_CONTROL, show = animation.CH_SHOW,
} }
local curve_to_interp = { local curve_to_interp = {
@ -17,6 +17,10 @@ local curve_to_interp = {
bezier = animation.INT_BEZIER, bezier = animation.INT_BEZIER,
} }
local boolean_actions = {
show = true
}
local function parse_configure(raw_track, node) local function parse_configure(raw_track, node)
if node.fps then if node.fps then
raw_track.fps = tonumber(node.fps) raw_track.fps = tonumber(node.fps)
@ -118,7 +122,7 @@ local function parse_directive(node, raw_track)
line.expression = node.func line.expression = node.func
elseif node.curve then elseif node.curve then
parse_curve(line, node) parse_curve(line, node)
elseif node.flag then elseif boolean_actions[tag] then
parse_boolean_frames(line, node) parse_boolean_frames(line, node)
else else
parse_simple_frames(line, node) parse_simple_frames(line, node)