Created
July 3, 2023 23:50
-
-
Save dacap/c8e99f6b5ee634be411d954ab9fc5b09 to your computer and use it in GitHub Desktop.
Usage: aseprite -b file.aseprite -script show-category-names.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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