Skip to content

Commit

Permalink
[ue4] Need to temporarily disable queue draining of animation state w…
Browse files Browse the repository at this point in the history
…hen setting or adding new animations. Closes #1037
  • Loading branch information
badlogic committed Nov 10, 2017
1 parent 361378b commit 33a0018
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,18 @@ float USpineSkeletonAnimationComponent::GetTimeScale() {
return 1;
}

// we need to disable the queue when setting or adding animations, see #1037
extern "C" {
void _spAnimationState_disableQueue(spAnimationState* state);
void _spAnimationState_enableQueue(spAnimationState* state);
}

UTrackEntry* USpineSkeletonAnimationComponent::SetAnimation (int trackIndex, FString animationName, bool loop) {
CheckState();
if (state && spSkeletonData_findAnimation(skeleton->data, TCHAR_TO_UTF8(*animationName))) {
_spAnimationState_disableQueue(state);
spTrackEntry* entry = spAnimationState_setAnimationByName(state, trackIndex, TCHAR_TO_UTF8(*animationName), loop ? 1 : 0);
_spAnimationState_enableQueue(state);
UTrackEntry* uEntry = NewObject<UTrackEntry>();
uEntry->SetTrackEntry(entry);
trackEntries.Add(uEntry);
Expand All @@ -165,7 +173,9 @@ UTrackEntry* USpineSkeletonAnimationComponent::SetAnimation (int trackIndex, FSt
UTrackEntry* USpineSkeletonAnimationComponent::AddAnimation (int trackIndex, FString animationName, bool loop, float delay) {
CheckState();
if (state && spSkeletonData_findAnimation(skeleton->data, TCHAR_TO_UTF8(*animationName))) {
_spAnimationState_disableQueue(state);
spTrackEntry* entry = spAnimationState_addAnimationByName(state, trackIndex, TCHAR_TO_UTF8(*animationName), loop ? 1 : 0, delay);
_spAnimationState_enableQueue(state);
UTrackEntry* uEntry = NewObject<UTrackEntry>();
uEntry->SetTrackEntry(entry);
trackEntries.Add(uEntry);
Expand Down

0 comments on commit 33a0018

Please sign in to comment.