[ue4] Added ability to listen for animation events on both the animation state and individual track entries.

This commit is contained in:
badlogic 2016-12-07 17:06:23 +01:00
parent 08db67ba1c
commit daca67f78a
4 changed files with 7 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,10 +2,15 @@
#define LOCTEXT_NAMESPACE "Spine"
void UTrackEntry::SetTrackEntry(spTrackEntry* entry) {
this->entry = entry;
entry->rendererObject = (void*)this;
}
void callback(spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event) {
USpineSkeletonAnimationComponent* component = (USpineSkeletonAnimationComponent*)state->rendererObject;
if (type == SP_ANIMATION_START) {
if (type == SP_ANIMATION_COMPLETE) {
if (entry->rendererObject) {
UTrackEntry* uEntry = (UTrackEntry*)entry->rendererObject;
component->AnimationStartEvent.Broadcast(uEntry);

View File

@ -19,10 +19,7 @@ public:
spTrackEntry* entry = nullptr;
void SetTrackEntry(spTrackEntry* entry) {
this->entry = entry;
entry->rendererObject = (void*)this;
}
void SetTrackEntry(spTrackEntry* entry);
UFUNCTION(BlueprintCallable, Category="Components|Spine")
int GetTrackIndex() { return entry ? entry->trackIndex : 0; }