Dynamically generated atlas for spine models

Hello,
I’d like to know if the following is possible in the current Defold version:

  • We have a Spine model, made with atlas A (imagine a character)
  • We’d like to propose to our user a very large set of combination of this character (think something like 500 differents hats). That won’t fit in a single atlas and we’d like to add new hats “on the go” once the app is live (think user-generated content).

Would it be possible to generate a new atlas on our server, and then the client downloads it and replaces the current spine atlas with the downloaded one?

Any pointer to do that would be appreciated, thanks.

1 Like

Currently, there’s no way to create or load a new atlas at runtime.

Perhaps you can attach a sprite to one of the bones instead?

Maybe I misnamed atlas for texture in my first post.
Let’s say the atlas stays the same (all the elements have the same size, and are placed the same way on the atlas file).
Is it possible to update the texture dynamically?

Yes, you can replace a texture resource with resource.set_texture()

OK, but how do you generate this new texture in the first place?
I mean let’s say I have a texture that has 10 elements (head, blue hat, etc). I want to creature a new texture where I change the hat to a red one.
Do I create a new PNG where all the elements have the same positions, and replace the blue hat in that PNG file, and then download the PNG and convert it to a texture?

Yes, this is crucial, as the atlas itself (the .texturesetc file) hasn’t changed.

Do I create a new PNG where all the elements have the same positions, and replace the bleu hat in that PNG file, and the download the PNG and convert it to a texture?

That would work yes