We have now added GUI support for the new official Spine runtime, and it’s time to invite our community to test the beta version of the extension.
Our goal is to have it released in Defold 1.2.193.
Breaking changes
After the version is released, we will have removed any Spine functionality from the core engine/editor, in favor of the new extension. This also means that we won’t support our older version of the spine extension.
This is also why it’s necessary for us to know of any missing features/misbehavior of the extension as soon as possible, with the help from our community.
Requirements
You currently need to run the alpha version of the Defold editor.
You can find the latest version of the alpha channel here.
You also need to use the correct branch from the extension, as your dependency.
Migration guide
The required steps for updating your content to support this extension is listed here
Example project
The example project shows the animated spine boy, using multiple animations on different tracks.
Press left mouse button (or touch) to shoot. Move the mouse cursor to aim using IK target.
For the api documentation, see the .script_api file.
I changed the json file extensions outside of the editor, loaded the project in the new alpha editor, updated the extension, fetched libraries, and then saw this (expected) output
Working through the spine scenes one by one, updating the reference, saving and closing the tab mostly worked but sometimes this error would show in a popup:
clojure.lang.ExceptionInfo: handler ‘:hide-selected’ in context ‘:workbench’ failed at ‘:enabled?’ with message ‘null’
java.lang.reflect.InvocationTargetException: Unknown
java.lang.Error: Invalid memory access
Dismissing that dialog, closing the unsaved spinescene tab (showing an asterisk) and double clicking the spinescene in the console again, I saw this:
Then, after adding required spine scenes to the GUI objects, it was possible to run, which led to this error when calling gui.get_node(“ticket_1_pet_spine”):
ERROR:SCRIPT: /main/ui/world_gui/world.gui_script:51: No such node: ticket_1_pet_spine/Head
stack traceback:
[C]: -1: in function get_node
/main/ui/world_gui/world.gui_script:51: in function initialise_quest_sidebar_nodes
/main/ui/world_gui/world.gui_script:671: in function </main/ui/world_gui/world.gui_script:579>
ERROR:GAMESYS: Error when initializing gui component: -2.
ERROR:SPINEEXT: No animation '' found
ERROR:GAMESYS: Couldn't find gui node type: 0
Forgot to mention that some of the files wouldn’t load and needed to be re-exported from Spine, targeting a later version. The migration guide does mention “Update the spine source files to latest version” but I thought that was optional (e.g. if you needed the new features) - I hadn’t realised that the runtime wasn’t actually backwards compatible.
If it’s part of the C++ Spine runtime, I expect it to “just work”.
As far as I know, there is no different from the user perspective to playing vertex and bone animations?
Sounds great! We will be doing some testing on our game soon. There is no difference in perspective from them at all (bone vs vertex) but we outsource some art and animation, it seems artist are tend to lean more into the vertex side for things such as narrative characters. It would save us iteration if we could just use their vertex animations.
With the latest editor alpha (5645efa) and spine-runtime branch (30cbae8), GUI nodes now appear to be working, except for one screen which renders a grid of spine objects. The gui has a template, which includes a spine node, and the template is cloned with gui.clone_tree() as many times as necessary. The first call to that crashes with the attached callstack.
There is also (I think) a regression since the previous alpha version. We reparent GOs containing sprites to different bones in the skeleton. The spine component has a Y offset specified in its position, and it looks like that position isn’t respected for the child sprites. If I remove the offset, the relative positions of everything are correct.
We exhaust some kind of buffer partway through cloning the instances - is there a new limit that we need to increase?
ERROR:GUI: Could not create the node since the buffer is full (1024).
ERROR:SCRIPT: main/ui/item_render/pet_gui.lua:7: Not enough resources to clone the node tree
I’ll try putting something together this afternoon.
Repro:
Based on the extension-spine sample, in each case there is a spinemodel with a non-zero position, and a sibling gameobject containing a sprite, which is reparented in script to the guntip bone in the spine model:
Perhaps related to the above, I modified the gui part of the spine sample to clone the animated character and add sprites to each bone.
It’s fine in 1.2.189 / extension-spine 1.1.0