mjtorn / spine-to-godot

A script to generate Godot scenes from Spine animation json files
3 stars 0 forks source link

About

This tool was originally written to be used with Escoria though it's not specific to it.

Please submit pull requests if you find something that can be better, but beside that request this is public domain unless I change my mind later.

Using Spine in Godot

Spine is an animation program that is not officially supported by Godot, but there exists a Spine module that can be added to the modules/ directory in your Godot source tree and built with eg. schedtool -D -e ccache scons platform=x11 tools=yes target=release_debug or whatever you like.

The script as referred to here is spine-to-godot-scene.py, which must be run from your device/ directory. Do note it requires python3-docopt, so please install it using pip3 or whatever you prefer.

Caveats

NOTE: Showing the animation's duration has not been merged to GodotExplorer's repository, so until further notice, use mjtorn's fork instead.

Do note that Spine animations cannot be played in reverse by design.

Prerequisities

If you have different skins for your Spine skeletons, and multiple files for eg. moving in different directions, make sure they're named exactly the same. The script will do its best to make this easy for you to use.

Creating Spine scenes

Copy your Spine data under eg. items/foo/. This can be the player or an NPC or even just an item.

Use the script to generate a scene in the same items/foo/.

The script generates a scene with a Spine node and animations. These animations are autogenerated and have horrible names, but they're there.

Using Spine scenes

To avoid editing and using the autogenerated animations, go to the animation editor and for every relevant animation, make a copy and rename it.

Looking at the Spine node, you'll have to select the different animations to get their durations. Unfortunately there is no other way now to get them.

Update your copied animation with the relevant information (like duration), add tracks; do whatever your project requires.