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 spr = app.activeSprite | |
if not spr then | |
return app.alert "You need to create a sprite first" | |
end | |
app.transaction( | |
function() | |
app.command.NewLayer{ name="Tilemap", tilemap=true } | |
local grid = spr.gridBounds | |
for y=grid.y,spr.height,grid.width do | |
for x=grid.x,spr.width,grid.width do |
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 spr = app.activeSprite | |
if not spr then return end | |
for _,t in ipairs(spr.tags) do | |
if t.name == "TagName" then | |
local old_play_once = app.preferences.editor.play_once | |
local old_play_all = app.preferences.editor.play_all | |
app.activeFrame = t.fromFrame | |
app.preferences.editor.play_once = true |
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 spr = app.activeSprite | |
if not spr then return end | |
local r = app.range | |
app.transaction( | |
function() | |
local oldActiveLayer = app.activeLayer | |
local oldActiveFrame = app.activeFrame | |
local deltaFrames = 0 |
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 spr = app.activeSprite | |
if not spr then return end | |
app.transaction( | |
function() | |
local oldActiveLayer = app.activeLayer | |
local oldActiveFrame = app.activeFrame | |
local deltaFrames = 0 | |
for i = #spr.frames,1,-1 do | |
local frame = spr.frames[i] |
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 spr = app.activeSprite | |
local tag = app.activeTag | |
local fr = app.activeFrame | |
if not spr or not tag then return end | |
local relativeFr = fr.frameNumber - tag.fromFrame.frameNumber | |
local function clamp(x, min, max) | |
if x < min then | |
return min |
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
function script_filename() | |
local source = debug.getinfo(2, "S").source | |
if source:sub(1, 1) == "@" then | |
return source:sub(2) | |
else | |
return "" | |
end | |
end |
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
-- E.g. if the filename is called "spriteR1.png", it will rename it to "spriteR2.png" and save it. | |
local spr = app.activeSprite | |
if not spr then return app.alert "No active sprite" end | |
local pt = app.fs.filePathAndTitle(spr.filename) | |
local ext = app.fs.fileExtension(spr.filename) | |
-- New filename replacing the revision number at the end with its | |
-- incremented version |
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 toolPref = app.preferences.tool(app.activeTool) | |
if toolPref.floodfill.refer_to == 1 then | |
toolPref.floodfill.refer_to = 0 | |
else | |
toolPref.floodfill.refer_to = 1 | |
end |
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
if TilesetMode == nil then return app.alert "Use Aseprite v1.3" end | |
local lay = app.activeLayer | |
if not lay.isTilemap then return app.alert "No active tilemap layer" end | |
local tileset = lay.tileset | |
local dlg = Dialog("Export Tileset") | |
dlg:file{ id="file", label="Export to File:", save=true, focus=true, | |
filename=app.fs.joinPath(app.fs.filePath(lay.sprite.filename), |
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 lay = app.activeLayer | |
if not lay then return app.alert "There is no active layer" end | |
app.transaction( | |
function() | |
local name = app.activeLayer.name | |
app.command.MergeDownLayer() | |
app.activeLayer.name = name | |
end) |