Hi! I am creating an import script which uses a template sprite. It first opens the template sprite, then it reads from the input file and uses that data to draws on the template sprite, inside particular slices. When this is finished I don’t want the user to accidentally save over the template sprite. I would like it to behave like a new sprite - it should have a name like “Sprite-0001” and attempting to do “File → Save” should open a save dialog rather than immediately overwriting the file. Is there any way to do this? I have tried:
- Change sprite.filename to an empty string. This does prevent saving over the template, but it is undesirable because it makes “File → Save” produce an error about a bad filename.
- Copy the sprite using
local sprite2 = Sprite(sprite1). This partially works. The new sprite still has the name of the template. “File → Save” doesn’t immediately save over it, but it does still suggest to save over it with the same name in the same directory. Additionally, the copy has lost all its slices, although I imagine I could work around this by copying them by script.
The only way I can really see to get the effect I want is to load the template, create a brand new empty sprite, then copy across all the layers, frames, cels and slices, then close the template again. Is there a better way?