mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-15 11:31:37 +08:00
[ue4] Null check for track entry at specific index. Closes #1548.
This commit is contained in:
parent
9d2353bc46
commit
8362074681
@ -40,8 +40,8 @@ void UTrackEntry::SetTrackEntry(TrackEntry* trackEntry) {
|
||||
|
||||
void callback(AnimationState* state, spine::EventType type, TrackEntry* entry, Event* event) {
|
||||
USpineSkeletonAnimationComponent* component = (USpineSkeletonAnimationComponent*)state->getRendererObject();
|
||||
|
||||
if (entry->getRendererObject()) {
|
||||
|
||||
if (entry->getRendererObject()) {
|
||||
UTrackEntry* uEntry = (UTrackEntry*)entry->getRendererObject();
|
||||
if (type == EventType_Start) {
|
||||
component->AnimationStart.Broadcast(uEntry);
|
||||
@ -70,7 +70,7 @@ void callback(AnimationState* state, spine::EventType type, TrackEntry* entry, E
|
||||
uEntry->SetTrackEntry(nullptr);
|
||||
component->GCTrackEntry(uEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
USpineSkeletonAnimationComponent::USpineSkeletonAnimationComponent () {
|
||||
@ -154,7 +154,7 @@ void USpineSkeletonAnimationComponent::CheckState () {
|
||||
}
|
||||
}
|
||||
|
||||
void USpineSkeletonAnimationComponent::DisposeState () {
|
||||
void USpineSkeletonAnimationComponent::DisposeState () {
|
||||
if (state) {
|
||||
delete state;
|
||||
state = nullptr;
|
||||
@ -225,14 +225,14 @@ UTrackEntry* USpineSkeletonAnimationComponent::SetAnimation (int trackIndex, FSt
|
||||
trackEntries.Add(uEntry);
|
||||
return uEntry;
|
||||
} else return NewObject<UTrackEntry>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
UTrackEntry* USpineSkeletonAnimationComponent::AddAnimation (int trackIndex, FString animationName, bool loop, float delay) {
|
||||
CheckState();
|
||||
if (state && skeleton->getData()->findAnimation(TCHAR_TO_UTF8(*animationName))) {
|
||||
state->disableQueue();
|
||||
TrackEntry* entry = state->addAnimation(trackIndex, TCHAR_TO_UTF8(*animationName), loop, delay);
|
||||
TrackEntry* entry = state->addAnimation(trackIndex, TCHAR_TO_UTF8(*animationName), loop, delay);
|
||||
state->enableQueue();
|
||||
UTrackEntry* uEntry = NewObject<UTrackEntry>();
|
||||
uEntry->SetTrackEntry(entry);
|
||||
@ -265,7 +265,7 @@ UTrackEntry* USpineSkeletonAnimationComponent::AddEmptyAnimation (int trackIndex
|
||||
|
||||
UTrackEntry* USpineSkeletonAnimationComponent::GetCurrent (int trackIndex) {
|
||||
CheckState();
|
||||
if (state) {
|
||||
if (state && state->getCurrent(trackIndex)) {
|
||||
TrackEntry* entry = state->getCurrent(trackIndex);
|
||||
if (entry->getRendererObject()) {
|
||||
return (UTrackEntry*)entry->getRendererObject();
|
||||
|
||||
@ -436,7 +436,7 @@ UTrackEntry* USpineWidget::AddEmptyAnimation(int trackIndex, float mixDuration,
|
||||
|
||||
UTrackEntry* USpineWidget::GetCurrent(int trackIndex) {
|
||||
CheckState();
|
||||
if (state) {
|
||||
if (state && state->getCurrent(trackIndex)) {
|
||||
TrackEntry* entry = state->getCurrent(trackIndex);
|
||||
if (entry->getRendererObject()) {
|
||||
return (UTrackEntry*)entry->getRendererObject();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user