Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aseprite Script crashes when attempting to copy-paste between files #36

Open
Ev-Abbott opened this issue Jan 25, 2021 · 0 comments
Open
Labels

Comments

@Ev-Abbott
Copy link

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:

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!

@dacap dacap added the bug label Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants