From f5f1f1d2972fa6887e4d9895f972eae2ff23782c Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Mon, 15 Dec 2025 16:12:26 +0100 Subject: [PATCH] Spine events data stores track and animation when triggered. --- .../src/c3runtime/expressions.ts | 4 ++-- .../spine-construct3/src/c3runtime/instance.ts | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spine-ts/spine-construct3/src/c3runtime/expressions.ts b/spine-ts/spine-construct3/src/c3runtime/expressions.ts index 76e4e8050..e743fa48e 100644 --- a/spine-ts/spine-construct3/src/c3runtime/expressions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/expressions.ts @@ -52,8 +52,8 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps = if (field === "volume") return this.triggeredEventData?.volume; if (field === "audiopath") return this.triggeredEventData?.data.audioPath; if (field === "event") return this.triggeredEventData?.data.name; - if (field === "animation") return this.triggeredEventAnimation; - if (field === "track") return this.triggeredEventTrack; + if (field === "animation") return this.triggeredEventData?.animation; + if (field === "track") return this.triggeredEventData?.track; return ""; } }; diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index 5a9e00c70..d7aad6e58 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -36,7 +36,7 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase { public triggeredEventTrack = -1; public triggeredEventAnimation = ""; public triggeredEventName = ""; - public triggeredEventData?: Event; + public triggeredEventData?: Event & { track: number, animation: string }; private assetLoader: AssetLoader; private skeletonRenderer?: C3RendererRuntime; @@ -547,21 +547,21 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase { } } - private triggetAnimationEvent (eventName: string, track: number, animation: string, event?: Event) { + private triggerAnimationEvent (eventName: string, track: number, animation: string, event?: Event) { this.triggeredEventTrack = track; this.triggeredEventAnimation = animation; this.triggeredEventName = eventName; - this.triggeredEventData = event; + if (event) this.triggeredEventData = { ...event, track, animation }; this._trigger(C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds.OnAnimationEvent); } private makeTrackListener = (track: number, animation: string): AnimationStateListener => ({ - start: () => this.triggetAnimationEvent("start", track, animation), - dispose: () => this.triggetAnimationEvent("dispose", track, animation), - event: (_, event) => this.triggetAnimationEvent("event", track, animation, event), - interrupt: () => this.triggetAnimationEvent("interrupt", track, animation), - end: () => this.triggetAnimationEvent("end", track, animation), - complete: () => this.triggetAnimationEvent("complete", track, animation), + start: () => this.triggerAnimationEvent("start", track, animation), + dispose: () => this.triggerAnimationEvent("dispose", track, animation), + event: (_, event) => this.triggerAnimationEvent("event", track, animation, event), + interrupt: () => this.triggerAnimationEvent("interrupt", track, animation), + end: () => this.triggerAnimationEvent("end", track, animation), + complete: () => this.triggerAnimationEvent("complete", track, animation), }) /**********/