mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +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"
|
#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) {
|
void callback(spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event) {
|
||||||
USpineSkeletonAnimationComponent* component = (USpineSkeletonAnimationComponent*)state->rendererObject;
|
USpineSkeletonAnimationComponent* component = (USpineSkeletonAnimationComponent*)state->rendererObject;
|
||||||
|
|
||||||
if (type == SP_ANIMATION_START) {
|
if (type == SP_ANIMATION_COMPLETE) {
|
||||||
if (entry->rendererObject) {
|
if (entry->rendererObject) {
|
||||||
UTrackEntry* uEntry = (UTrackEntry*)entry->rendererObject;
|
UTrackEntry* uEntry = (UTrackEntry*)entry->rendererObject;
|
||||||
component->AnimationStartEvent.Broadcast(uEntry);
|
component->AnimationStartEvent.Broadcast(uEntry);
|
||||||
|
|||||||
@ -19,10 +19,7 @@ public:
|
|||||||
|
|
||||||
spTrackEntry* entry = nullptr;
|
spTrackEntry* entry = nullptr;
|
||||||
|
|
||||||
void SetTrackEntry(spTrackEntry* entry) {
|
void SetTrackEntry(spTrackEntry* entry);
|
||||||
this->entry = entry;
|
|
||||||
entry->rendererObject = (void*)this;
|
|
||||||
}
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category="Components|Spine")
|
UFUNCTION(BlueprintCallable, Category="Components|Spine")
|
||||||
int GetTrackIndex() { return entry ? entry->trackIndex : 0; }
|
int GetTrackIndex() { return entry ? entry->trackIndex : 0; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user