asdfadrian

Hello!

Is it possible to run custom render scripts in Spine2D? I created 200 humanoid characters and one idle humanoid animation that I would like to apply to all 200. Doing this manually would be intensive and long. Blender provides an api which allows devs to create a python script do do things such as loading a scene, dynamically swapping out textures and exporting as a gif. This allows me to reuse an animation and apply 150 characters to it. Is this kind of thing possible? If so is there any reference how it can be done? This feature would be very useful for small animation or game studios to run a script to create many assets.

Thank you in advanced

Thanks!
Adrian
asdfadrian
  • Posts: 2

Nate

Spine doesn't currently support running scripts inside Spine. However, you can export to JSON, manipulate the JSON, and import it back into Spine.

I have to say, your use case sounds a bit odd. You wouldn't want to copy an animation into 200 skeletons. Doing that would mean loading the same animation data many times, once for each skeleton. Also if you change the animation, you'd have 199 copies that don't match.

Typically to use the same animation with many different characters you would setup a single skeleton, using skins to achieve the different looks for the many characters. You'd then have one set of animations that would work with all your skins.
User avatar
Nate

Nate
  • Posts: 11935

asdfadrian

Hi Nate,

Thanks for your reply! Sorry I think my description was unclear. What you describe is exactly what I am trying to do. I would setup 1 skeleton with 200 different 2d characters that apply to that skeleton.

To keep it short the real use case is to create 10000 possibilities with the typical render pipeline we have in mind. Modifying the 10000 combinations of json sounds reasonable to swap out the skins mapped to a path. I dont mind running the script outside of Spine. I see the api reference (API Reference) but do not see any import or export. I imagine I would generate the 10,000 json upfront then run an import and and export for all the 10,000 animations.

Edit:

Key peices I see are the following:
    SkeletonLoader
    SkeletonData>imagesPath
But unfortunately I dont see information on exporting the animation.
asdfadrian
  • Posts: 2

Nate

Modifying the 10000 combinations of json sounds reasonable to swap out the skins mapped to a path.
Eh, I would say it doesn't sound reasonable at all. You should have one skeleton data file for all animations that share the same animations. That a skeleton looks different is not a reason to duplicate the skeleton data. If you are just changing the images for a skeleton, you can change which texture atlas you use. When images are attached to a skeleton is separate from the skeleton data. You can define all your skins in one skeleton. If you have many thousands of skins, you can use your skeleton as a template to define all the attachments once and then change how it looks at runtime. See here:
Runtime Skins - Spine Runtimes Guide: Creating attachments
I've also explained it here (and elsewhere on the forum):
Optimizing Many Spines

The API reference is for the Spine Runtimes API. Import and export are editor functionality, so they are in the user guide:
Import - Spine User Guide
Export - Spine User Guide
User avatar
Nate

Nate
  • Posts: 11935


Return to Editor