mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[ue4] Added ability to listen for animation events on both the animation state and individual track entries.
This commit is contained in:
parent
08db67ba1c
commit
daca67f78a
Binary file not shown.
BIN
spine-ue4/Content/SpineBoy/SpineboyBlueprint.uasset
Normal file
BIN
spine-ue4/Content/SpineBoy/SpineboyBlueprint.uasset
Normal file
Binary file not shown.
@ -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);
|
||||
|
||||
@ -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; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user