From be761e2792b4a1f98201c2c9b9820937ec8dc68e Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Wed, 5 Nov 2025 12:40:20 +0100 Subject: [PATCH] Add set empty animation. --- spine-ts/spine-construct3/src/aces.json | 15 +++++++++++++++ .../spine-construct3/src/c3runtime/actions.ts | 4 ++++ .../spine-construct3/src/c3runtime/instance.ts | 4 ++++ spine-ts/spine-construct3/src/lang/en-US.json | 15 +++++++++++++++ spine-ts/spine-construct3/src/lang/zh-CN.json | 15 +++++++++++++++ 5 files changed, 53 insertions(+) diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index e089810eb..305ba03a4 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -120,6 +120,21 @@ "id": "stop", "scriptName": "Stop", "highlight": false + }, + { + "id": "set-empty-animation", + "scriptName": "SetEmptyAnimation", + "highlight": false, + "params": [ + { + "id": "track", + "type": "number" + }, + { + "id": "mix-duration", + "type": "number" + } + ] } ], "expressions": [ diff --git a/spine-ts/spine-construct3/src/c3runtime/actions.ts b/spine-ts/spine-construct3/src/c3runtime/actions.ts index 651297c1f..0a36b66ac 100644 --- a/spine-ts/spine-construct3/src/c3runtime/actions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/actions.ts @@ -31,6 +31,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts = Stop (this: SDKInstanceClass) { this.stop(); + }, + + SetEmptyAnimation (this: SDKInstanceClass, track: number, mixDuration: number) { + this.setEmptyAnimation(track, mixDuration); } }; diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index 578045fe4..3e2dc8ade 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -175,6 +175,10 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase { this.isPlaying = false; } + public setEmptyAnimation (track: number, mixDuration = 0) { + this.state?.setEmptyAnimation(track, mixDuration); + } + private _setSkin () { const { skeleton } = this; if (!skeleton) return; diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index ff0098367..4d96de10f 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -194,6 +194,21 @@ "list-name": "Stop", "display-text": "Stop animation", "description": "Pause or stop the animation" + }, + "set-empty-animation": { + "list-name": "Set empty animation", + "display-text": "Set empty animation on track {0} with mix duration {1}", + "description": "Set an empty animation on a specific track", + "params": { + "track": { + "name": "Track", + "desc": "Track index" + }, + "mix-duration": { + "name": "Mix duration", + "desc": "Duration in seconds to mix from the current animation to empty" + } + } } }, "expressions": { diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index 3061bc513..6738a4f1d 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -196,6 +196,21 @@ "display-text": "停止动画", "description": "暂停或停止动画" }, + "set-empty-animation": { + "list-name": "设置空动画", + "display-text": "在轨道{0}上设置空动画,混合时长{1}", + "description": "在特定轨道上设置空动画", + "params": { + "track": { + "name": "轨道", + "desc": "轨道索引" + }, + "mix-duration": { + "name": "混合时长", + "desc": "从当前动画混合到空动画的持续时间(秒)" + } + } + }, "expressions": { "double": { "description": "将数字翻倍。",