I would like to export my spritesheet, and json in as simple a way as possible. the default json from aseprite is really big and has a lot of extra data i really do not need.
Let’s say i have an animation with 4 different tags. that i wanna export as one big spritesheet.
The json i’d just like to look something like this:
extremely simplified, so there’s a width and height of every frame, and each tag is an animation with the cell on the spritesheet it starts on, and how many frames it lasts.
So is it possible to override/replace the current json export with this somehow?
after more searching i’ve found you can also run scripts via command prompt. So maybe that’s the route i should take. Though i am still a bit unsure.
Ideally i wanna make an option with as few clicks in the end
I think i figured it all out! for my purposes atleast. I made a script, that export a spritesheet and json the way i want it.
I’ll share the code in case others get use out of it
-- Export Spritesheet by rows, and simplified json file
local spr = app.activeSprite
if not spr then return print('No active sprite') end
local title = spr.filename:match("([^\\]+)%.aseprite")
local path = 'D:/projects/Game dev/GameMakerStudio2/BunnyBallFightingGame/datafiles/sprites'
-- Exports packed spritesheet
local fn = path .. '/' .. title
app.command.ExportSpriteSheet{
ui=false,
type=SpriteSheetType.ROWS,
textureFilename=fn .. '.png',
trimSprite=true,
splitTags=true,
}
-- Makes Json Lua table
t = {}
t['width'] = spr.width
t['height'] = spr.height
anims = {}
for i,tag in ipairs(spr.tags) do
anims[tag.name] = tag.frames
end
t['animations'] = anims
-- Exports Json file
file = io.open(fn .. '.json','w')
file:write(json.encode(t))
file:close()
for my little test sprite it makes these
{"animations": {"idle": 6, "other": 5}, "height": 173, "width": 140}
1 Like