rayxuln / spine-runtime-for-godot

This project is a module for godot that allows it to load/play Spine skeleton animation.
MIT License
93 stars 22 forks source link

SpineEvent methods crashes godot #16

Closed jonchun closed 4 years ago

jonchun commented 4 years ago

Trying to do anything with a SpineEvent seems to crash Godot.

func _on_SpineSprite_animation_complete(_animation_state: SpineAnimationState, _track_entry: SpineTrackEntry, _event: SpineEvent):
    print(_event.get_data())
    print(_event.get_event_name())
scottkunkel commented 4 years ago

No sure what you are trying to do.

Only EventType_Event has an actual event associated with it, otherwise _event is null.

so this works:

func test6()->void:
    $SpineSprite.connect("animation_complete", self, "done");
    $SpineSprite.get_animation_state().set_animation("dance", false, 0);

func done(a,b,c)->void:
    print("Done")

It is meant for events in the timeline such as audio to be played or other meta data for the programmer.

scottkunkel commented 4 years ago

It should be possible in code to add events to the callbacks, though. Need to discuss usage. I'd say go for it since otherwise godot crashes on calling a method on a null object.

jonchun commented 4 years ago

I'm not actually using the SpineEvent, but I'm documenting the fact that trying to do anything with the SpineEvent causes a crash.

I'm not getting a null value for parameter c, I'm getting a SpineEvent object. image

However, if I try to call any method on it other than just printing it, Godot crashes.

rayxuln commented 4 years ago

I fixed it.

Now the SpineEvent you got should be NULL in "animation_complete".

It crashed because the actual spine object is NULL.