Apparently the events don’t work when the playback mode is set to PLAYBACK_ONCE_BACKWARD or PLAYBACK_LOOP_BACKWARD.
However the hash “spine_event” is received successfully in forward playbacks.
To Reproduce
Steps to reproduce the behavior:
- Open any project with a spine animation that calls an event
- Go to the line of code where the animation is played (spine.play_anim) and change PLAYBACK_ONCE_FORWARD for PLAYBACK_ONCE_BACKWARD
- Run.
Expected behaviour
Events being catched by the line:
if message_id == hash("spine_event") then
just like in forward mode.
Defold version
Platforms
Minimal repro case project
Here is an example
(it’s for v1.9.8 due to Spine extension is not working well on the latest version (v1.10) on my machine so I stayed on previous stable release)
Additional context
On this example code if you open main.script and go to line 32 you will see the expected debug message that will not appear unless you change the line 26 to
spine.play_anim("/small_walk#spinemodel", "walk", go.PLAYBACK_ONCE_FORWARD, {}, function(self, message_id, message, sender)
Iirc, we send the events as we receive them from the Spine runtime. So if they support it, we can.
Can you confirm that the Spine runtime supports events when playing backwards?
As seen here, we merely pass on the events we get from the spine runtime:
extension-spine/defold-spine/src/comp_spine_model.cpp at main · defold/extension-spine
I think your best bet is to ask for that feature request on their forum.
1 Like
ohh I see, ok! Is just a listener.
I’ve read the extension source and also the runtime source at https://es.esotericsoftware.com/spine-cpp#Events and I couln’t find any reference to a playback mode forward or reversed so I don’t get well how the track.m_AnimationInstance->reverse in the extension interacts with the runtime, and I’m not sure if it’s not supported or just a bug in the runtime. The official documentation says nothing about it.
I’m just trying to understand all better, not a big deal. To get the event I just duplicated the animation, reversed the keyframes manually and problem solved, normal event. So I don’t think I’ll request the feature to Esoteric Software. Actually I made this post to be useful because on Discord I was recommended to do it but all good. Thanks for checking it sir! 
1 Like