Hi Mario, MarvinECL here, sorry for not repost for solong since I can't find which pointer is nullptr.
But today when I use "SetTrackTime" Node, the same problem turns out and I think I find the glitch one.
My project is doing "Voice linked Mouth", that character's mouth can open and close accroding to voice loud. And this funtion is, I read current voice data and use "SetTrackTime" to set the individual mouth track to a certain track time.
Everything is fine at the start, but when I change the mouth by reset the individual mouth track anime, the track entry becomes nullptr. I made a test blueprint to describe this problem.
There is three events in the test blueprint. When I execute Z EVENT for the target spine, everything is fine, C EVENT tells me that the track entry of track two is ok. But when I use X EVENT to set new animation at track two (change mouth), the C EVENT tells me that the track entry of track two is nullptr.
I don't save the track entry as a variable, and I even don't know whether this nullptr is the same problem of my topic. But I think I need to post this problem here asking for help
how do I make the "Voice linked Mouth" function since the track entry would be nullptr 😢
And for the topic problem, now I modify the broadcast code of the anime state - bind broadcast on SkeletonAnimationComponent instead of on uEntry instance:
void callback(AnimationState *state, spine::EventType type, TrackEntry *entry, Event *event) {
USpineSkeletonAnimationComponent *component = (USpineSkeletonAnimationComponent *) state->getRendererObject();
int TrackIndex = entry->getTrackIndex();
if (entry->getRendererObject()) {
if (type == EventType_Start) {
component->AnimationStart.Broadcast(TrackIndex);
} else if (type == EventType_Interrupt) {
component->AnimationInterrupt.Broadcast(TrackIndex);
} else if (type == EventType_Event) {
FSpineEvent evt;
evt.SetEvent(event);
component->AnimationEvent.Broadcast(TrackIndex, evt);
} else if (type == EventType_Complete) {
component->AnimationComplete.Broadcast(TrackIndex);
} else if (type == EventType_End) {
component->AnimationEnd.Broadcast(TrackIndex);
} else if (type == EventType_Dispose) {
component->AnimationDispose.Broadcast(TrackIndex);
component->GetCurrent(TrackIndex)->SetTrackEntry(nullptr);
component->GCTrackEntry(component->GetCurrent(TrackIndex));
}
}
}