Changes in spine.play callback (SOLVED)

As I understood in defold 1.2.88 you change spine callback.
And now callback has all parameters like on_message and can has different message_id.
And, one more important that callback can be call not only when animation ended and by spine events too.

Am I right?

I can’t find information about this changes in docs but this changes broke my project animations(

example of new callback

local function callback_example(self, message_id, message, sender)
	print(message_id)
	pprint( message)
	print(sender)
end

spine.play("#spinemodel", "idle_var1",go.PLAYBACK_ONCE_FORWARD, 0.1, callback_example)

print:

DEBUG:SCRIPT: type	hash: [spine_animation_done]
DEBUG:SCRIPT: 
{
  animation_id = hash: [idle_var1],
  playback = 1,
}

DEBUG:SCRIPT: url: [game:/instance158#spinemodel]
1 Like

Good question! @sven should know more about it I think. @sicher is the documentation lagging behind on this?

1 Like

I have few more bugs with it (

when I try to ignore events by return

	if message_id == cfg.A_SPINE_EVENT then
	return

I receive strange bug message

ERROR:SCRIPT: attempt to call a userdata value
stack traceback:
ERROR:SCRIPT: attempt to call a nil value
stack traceback:

and then, sometimes app crashed. (gui.cpp - I have no code manipulations with gui in this moment)

Assertion failed: (lua_isfunction(L, -1)), function RunScript, file ../src/gui.cpp, line 1280.
2 Likes

Thanks for reporting this, I’m looking into it!
There should not have been any changes to the function signature of the callback, at least not by design. :slight_smile:

Update: Tracked down the error, turns out this was a bug introduced in the latest release, related to the internal changes of our spine runtime. Many thanks to @AGulev for reporting this!

@AGulev: Regarding your initial question about the callback function parameter list… The function signature has not changed, but it was/is not described correctly in the documentation. Due to the way the callback is triggered internally (by using the message passing system) means you will actually get the same parameters as if it was triggered through on_message, and as you pointed out it will be; callback(self, message_id, message, sender). :thumbsup:

1 Like

What about spine_event in callback? It’s a by desing in new defold version or it’s a bug?

1 Like

That is a bug, and will be reverted to the previous behaviour in next release. (That is, spine_event will only be sent to on_message).

2 Likes

It it, I’ll make sure the docs cover it.

2 Likes

Resolved in 1.2.89: Defold 1.2.89 has been released

2 Likes