Initial commit.
This commit is contained in:
commit
1327848b05
2
Makefile
Normal file
2
Makefile
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
all:
|
||||||
|
zip -f ./aseprite-advanced-spritesheets *.lua LICENSE
|
99
advanced-spritesheet-export.lua
Normal file
99
advanced-spritesheet-export.lua
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
local extKey = "annabunches/AtlasExporter"
|
||||||
|
|
||||||
|
function init(plugin)
|
||||||
|
plugin:newCommand{
|
||||||
|
id="AnnabunchesASEExportSpritesheetAdvanced",
|
||||||
|
title="Export Spritesheet (Advanced)",
|
||||||
|
group="file_export",
|
||||||
|
onclick=exportSpritesheetAdvanced
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin:newCommand{
|
||||||
|
id="AnnabunchesASEToggleIgnoreLayer",
|
||||||
|
title="Ignore on Export",
|
||||||
|
group="layer_popup_menu",
|
||||||
|
onclick=toggleIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin:newCommand{
|
||||||
|
id="AnnabunchesASEToggleExportAsSprite",
|
||||||
|
title="Export as Sprite",
|
||||||
|
group="layer_popup_menu",
|
||||||
|
onclick=toggleExportAsSprite
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function revealLayers(layers)
|
||||||
|
for i, layer in ipairs(layers) do
|
||||||
|
if layer.isGroup then
|
||||||
|
revealLayers(layer.layers)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not layer.isVisible then
|
||||||
|
layer.isVisible = true
|
||||||
|
layer.properties(extKey).revealed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function restoreLayers(layers)
|
||||||
|
for i, layer in ipairs(layers) do
|
||||||
|
if layer.isGroup then
|
||||||
|
restoreLayers(layer.layers)
|
||||||
|
end
|
||||||
|
|
||||||
|
if layer.properties(extKey).revealed then
|
||||||
|
layer.isVisible = false
|
||||||
|
-- layer.properties(extKey).revealed = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function deleteLayers(sprite, layers)
|
||||||
|
for i, layer in ipairs(layers) do
|
||||||
|
if layer.name:find("%+i") then
|
||||||
|
sprite:deleteLayer(layer)
|
||||||
|
elseif layer.isGroup then
|
||||||
|
deleteLayers(sprite, layer.layers)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function flattenLayers(layers)
|
||||||
|
for i, layer in ipairs(layers) do
|
||||||
|
if not layer.isGroup then
|
||||||
|
goto continue
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Layers "tagged" with +f get flattened
|
||||||
|
if layer.name:find("%+f") then
|
||||||
|
app.range.layers = { layer }
|
||||||
|
app.command.FlattenLayers(false)
|
||||||
|
else
|
||||||
|
-- recurse
|
||||||
|
flattenLayers(layer.layers)
|
||||||
|
end
|
||||||
|
|
||||||
|
::continue::
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function exportSpritesheetAdvanced()
|
||||||
|
local sprite = app.activeSprite
|
||||||
|
if not sprite then
|
||||||
|
return app.alert "Must have a sprite open to export."
|
||||||
|
end
|
||||||
|
|
||||||
|
app.transaction(function()
|
||||||
|
deleteLayers(sprite, sprite.layers)
|
||||||
|
flattenLayers(sprite.layers)
|
||||||
|
revealLayers(sprite.layers)
|
||||||
|
end)
|
||||||
|
app.command.ExportSpriteSheet {
|
||||||
|
splitLayers=true,
|
||||||
|
}
|
||||||
|
restoreLayers(sprite.layers)
|
||||||
|
app.undo()
|
||||||
|
end
|
||||||
|
|
||||||
|
main()
|
18
package.json
Normal file
18
package.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "advanced-spritesheets",
|
||||||
|
"displayName": "Advanced Spritesheets"
|
||||||
|
"description": "Improved spritesheet export functionality for Aseprite.",
|
||||||
|
"version": "0.1",
|
||||||
|
"author": { "name": "Anna Wiggins",
|
||||||
|
"email": "annabunches@gmail.com",
|
||||||
|
"url": "https://annabunches.net" },
|
||||||
|
"contributors": [ ],
|
||||||
|
"publisher": "annabunches",
|
||||||
|
"license": "CC BY-SA 4.0",
|
||||||
|
"categories": [ "Scripts" ],
|
||||||
|
"contributes": {
|
||||||
|
"scripts": [
|
||||||
|
{ "path": "./advanced-spritesheet-export.lua" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
19
readme.md
Normal file
19
readme.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Advanced spritesheet functionality for Aseprite
|
||||||
|
|
||||||
|
This extension adds a more sophisticated spritesheet export command to Aseprite.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To install, go to Aseprite's Settings -> Extensions -> Add Extension, and select advanced-spritesheet-export.aseprite-extension
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
* Choose which layers to export, regardless of visibility.
|
||||||
|
* Export groups as a single sprite.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
* All layers are exported by default. To ignore a layer, tk.
|
||||||
|
* To export a group as a single sprite, tk
|
||||||
|
* Invoke the tool via File -> Export -> Export Sprite Sheet (Advanced).
|
||||||
|
* Use the Sprite Sheet Export dialog as normal, but make sure Layers is set to "Visible Layers."
|
Loading…
Reference in New Issue
Block a user