add fps util for pxl8 in lua

This commit is contained in:
asrael 2025-11-11 23:26:51 -06:00
parent 7dd32ec453
commit 5637fa18c8
9 changed files with 57 additions and 76 deletions

View file

@ -1,5 +1,5 @@
-- pxl8 tile properties editor
-- provides a ui for editing custom properties of tilemap tiles
-- pxl8 tile properties dialog menu
-- provides a ui for editing custom properties on tilemap tiles
local DEBUG = false
@ -140,13 +140,11 @@ local function showPropertyEditor(existingProps)
option = prop.type,
options = { "boolean", "number", "string" },
onchange = function()
-- Save all current field values and apply type conversions
for j = 1, #properties do
properties[j].key = dlg.data["key_" .. j] or properties[j].key
local newType = dlg.data["type_" .. j] or properties[j].type
local oldType = properties[j].type
-- Apply default values when type changes
if newType ~= oldType then
if newType == "boolean" then
properties[j].value = false
@ -191,7 +189,6 @@ local function showPropertyEditor(existingProps)
id = "delete_" .. i,
text = "Delete",
onclick = function()
-- Save current field values before deleting
for j = 1, #properties do
properties[j].key = dlg.data["key_" .. j] or properties[j].key
properties[j].type = dlg.data["type_" .. j] or properties[j].type
@ -208,7 +205,6 @@ local function showPropertyEditor(existingProps)
dlg:button{
text = "Add Property",
onclick = function()
-- Save current field values before adding new property
for i = 1, #properties do
properties[i].key = dlg.data["key_" .. i] or properties[i].key
properties[i].type = dlg.data["type_" .. i] or properties[i].type
@ -254,14 +250,12 @@ local function showPropertyEditor(existingProps)
end
function init(plugin)
log("=== PLUGIN INIT START ===")
if not plugin then
print("[tile-properties] ERROR: plugin is nil!")
return
end
-- Register in Sprite menu
-- register in sprite menu
plugin:newCommand{
id = "TilePropertiesEditor",
title = "Tile Properties",
@ -272,12 +266,7 @@ function init(plugin)
end,
onclick = showPropertyEditor
}
log("Command registered in Sprite menu")
log("=== PLUGIN INIT COMPLETE ===")
end
function exit(plugin)
log("=== PLUGIN EXIT ===")
end