From 8767b81e177336b6f5f700ae7e870f110fdc0818 Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Wed, 5 Nov 2025 11:57:56 +0100 Subject: [PATCH] Made OnAnimationEvent more generic allowing empty params to be used as any. --- spine-ts/spine-construct3/src/aces.json | 7 ++++--- spine-ts/spine-construct3/src/c3runtime/conditions.ts | 7 ++++--- spine-ts/spine-construct3/src/lang/en-US.json | 10 +++++----- spine-ts/spine-construct3/src/lang/zh-CN.json | 8 ++++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 5e604423b..0e589549e 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -16,16 +16,17 @@ { "id": "event", "type": "string", - "initial-value": "complete" + "initial-value": "" }, { "id": "track", "type": "number", - "initial-value": 0 + "initial-value": -1 }, { "id": "animation", - "type": "string" + "type": "string", + "initial-value": "" } ] }, diff --git a/spine-ts/spine-construct3/src/c3runtime/conditions.ts b/spine-ts/spine-construct3/src/c3runtime/conditions.ts index 44693df8c..f26a9227f 100644 --- a/spine-ts/spine-construct3/src/c3runtime/conditions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/conditions.ts @@ -9,9 +9,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds = return true; }, OnAnimationEvent (this: SpineC3Instance, event: string, track: number, animation: string) { - return this.triggeredEventName === event - && this.triggeredEventTrack === track - && this.triggeredEventAnimation === animation; + const eventMatches = event === "" || this.triggeredEventName === event; + const trackMatches = track === -1 || this.triggeredEventTrack === track; + const animationMatches = animation === "" || this.triggeredEventAnimation === animation; + return eventMatches && trackMatches && animationMatches; }, IsFlippedX (this: SpineC3Instance) { return this.propFlipX; diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index 6011e00b5..69e37692a 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -82,20 +82,20 @@ }, "on-animation-event": { "list-name": "On animation event", - "display-text": "On {0} event triggered by animation {2} on track {1} trigger", - "description": "Do something when animation event is triggered", + "display-text": "On {0} event triggered by animation {2} on track {1}", + "description": "Triggered when animation event occurs. Use empty string for event/animation or -1 for track to match any value.", "params": { "event": { "name": "Event name", - "desc": "Event name" + "desc": "Event name (start, dispose, event, interrupt, end, complete). Empty string matches any event." }, "animation": { "name": "Animation", - "desc": "Animation" + "desc": "Animation name. Empty string matches any animation." }, "track": { "name": "Track number", - "desc": "Track number" + "desc": "Track index. Use -1 to match any track." } } }, diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index 52e6c5ffb..3d19e6983 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -83,19 +83,19 @@ "on-animation-event": { "list-name": "动画事件触发时", "display-text": "当轨道{1}上的动画{2}触发{0}事件时", - "description": "当动画事件触发时执行操作", + "description": "当动画事件发生时触发。使用空字符串匹配任意事件/动画,或使用-1匹配任意轨道。", "params": { "event": { "name": "事件名称", - "desc": "事件名称" + "desc": "事件名称(start、dispose、event、interrupt、end、complete)。空字符串匹配任意事件。" }, "animation": { "name": "动画", - "desc": "动画" + "desc": "动画名称。空字符串匹配任意动画。" }, "track": { "name": "轨道编号", - "desc": "轨道编号" + "desc": "轨道索引。使用-1匹配任意轨道。" } } },