Scripting question - layer/group functionality seems pretty barebones

So I was excited when I heard that Aseprite was adding Lua scripting. Unfortunately, I played around with it last night and discovered I couldn’t do certain things with it that I was looking forward to.

The bottom line is, I want to be able to take the active layer, make a group with the same name at the same level as the layer, move the layer inside the new group, and create a new layer inside that same group. The only thing on that list that I can do at present, according to the API, is make a group with the same name as the layer: all groups and layers are created at the top of the list, and while I assume I can move them around the same way I can move items in any Lua table, there doesn’t seem to be a way to move a layer inside a group, or a group inside another group.

Are these oversights in the documentation, or in the API itself?

I just created an account to ask a question about layer/group support in scripting and discovered your post was the most recent. :slight_smile:

I too would love to see expanded support for layers/groups in the scripting API. A few things that would be helpful for me for a particular script I’m trying to write:

  • flatten a group into a single layer
  • get a list of child layers of a group layer

I was trying to write a script that would export a trimmed version of each layer, and where grouped layers are only exported as a single image for the group. I tried several different approaches, but wasn’t able to find a way to do it with the current API.

I love the idea of scripting support in Aseprite (thank you for adding it!) Right now it seems more focused on providing an API for people to write creation tools, which is awesome, but I hope it might continue to be expanded to become more useful for creating pipeline tools. :slight_smile:

Here is a forked script if anyone wants to Aseprite export first groups as layers: An Aseprite script to export all frames of every layer as individual sprites. · GitHub