Skip to content

Instantly share code, notes, and snippets.

@dacap
Created July 3, 2023 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacap/c8e99f6b5ee634be411d954ab9fc5b09 to your computer and use it in GitHub Desktop.
Save dacap/c8e99f6b5ee634be411d954ab9fc5b09 to your computer and use it in GitHub Desktop.
Usage: aseprite -b file.aseprite -script show-category-names.lua
local PK = "aseprite/Attachment-System"
local sprite = app.activeSprite
function find_tileset_by_catID(catID)
for _,ts in ipairs(sprite.tilesets) do
if ts.properties(PK) and
ts.properties(PK).id == catID then
return ts
end
end
end
for i,layer in ipairs(sprite.layers) do
if layer.properties(PK) then
print(layer.name .. ' Categories:')
for j,catID in ipairs(layer.properties(PK).categories) do
local tileset = find_tileset_by_catID(catID)
if tileset then
if tileset.name == "" then
print(' - Empty category name (catID=' .. catID .. ')')
else
print(' - ' .. tileset.name .. ' (catID=' .. catID .. ')')
end
end
end
else
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment