aseprite / aseprite/api

Aseprite Script crashes when attempting to copy-paste between files

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
No language data
Stars
307
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Hello! I have an animated tile map I am trying to automate by copying the frames from a tile merged cell by cell into a new file. Selection and new frames work all well but when I attempt to paste my selection, the application crashes.

Script in Question:
```lua
do
local spr = app.activeSprite
if not spr then return app.alert "No Active Sprite" end

local basePath = "PathFromRoot/To/Tiles/Directory"

app.transaction(
function()
local current = app.open(basePath .. "/WaterTiles.aseprite")
local standardLayer = app.activeLayer
local newSprite = Sprite{ fromFile=basePath .. "/Test.aseprite" }
local newSpriteLayer = newSprite.layers[1]

for i = 1,8 do
local frame = newSprite:newEmptyFrame()
app.activeSprite = current
app.activeLayer = standardLayer
app.activeFrame = i
current.selection:select(Rectangle(0, 0, 16, 16))
app.command.CopyMerged()
app.activeSprite = newSprite
app.activeLayer = newSpriteLayer
app.command.Paste()
current.selection:deselect()
end
end
)
end
```

OS:
macOS BigSur 11.1

Any help would be appreciated!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.