Hello, I’ve been writing a few scripts to improve my Blender->Aseprite workflow and I’ve run into a weird issue where I just can’t cache any tag property.
If I create a local table storing the original tag objects in the sprite and then I modify those tags in some way, like adding a new frame or changing the name of some tag via code, the cached tags are overwritten for some reason. I’ve tried setting a local scope and encapsulating the cached copy inside a function that simply returns its own copy, but none of this seems to work. I even tried creating separate tables copying the values of each parameter (name, fromFrame.frameNumber, toFrame.frameNumber), thinking “it’s just strings and integers, how are they going to be overwritten”, with no luck, which is what threw me entirely off.
And this doesn’t happen with other cache tables that store “dynamic” information that can be modified via a script, like a layer’s visibility. Caching that visibility in a table, enabling all layers’ visibility then restoring the visibility from that table works perfectly fine.
I thought maybe Lua had some peculiarities so I ran some tests, and this script works exactly as it should. The list is modified and restored from a backup.
Could someone point me in the right direction? I had zero experience with Lua and the Aseprite API until a few days ago so it’s possible I’m missing something extremely basic.
You can find the scripts at this URL with a sample file. The one that’s just not working properly is debugTags: https://github.com/IgnacioLuxP/Aseprite-ScriptTest
(I wasn’t sure if copypasting a bunch of buggy code was proper forum discipline)