From 728186bb4f17ada1efa38d19bd204322c9457137 Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Thu, 26 Feb 2026 12:27:13 +0100 Subject: [PATCH] Add expressions for current animation start/end/last giving track index. --- spine-ts/spine-construct3/src/aces.json | 36 +++++++++++++++++++ .../src/c3runtime/expressions.ts | 15 ++++++++ spine-ts/spine-construct3/src/lang/en-US.json | 30 ++++++++++++++++ spine-ts/spine-construct3/src/lang/zh-CN.json | 30 ++++++++++++++++ 4 files changed, 111 insertions(+) diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 67820e10a..0f80e204e 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -725,6 +725,42 @@ "expressionName": "TimeScale", "highlight": false, "returnType": "number" + }, + { + "id": "current-animation-start", + "expressionName": "CurrentAnimationStart", + "highlight": false, + "returnType": "number", + "params": [ + { + "id": "track-index", + "type": "number" + } + ] + }, + { + "id": "current-animation-end", + "expressionName": "CurrentAnimationEnd", + "highlight": false, + "returnType": "number", + "params": [ + { + "id": "track-index", + "type": "number" + } + ] + }, + { + "id": "current-animation-last", + "expressionName": "CurrentAnimationLast", + "highlight": false, + "returnType": "number", + "params": [ + { + "id": "track-index", + "type": "number" + } + ] } ] } diff --git a/spine-ts/spine-construct3/src/c3runtime/expressions.ts b/spine-ts/spine-construct3/src/c3runtime/expressions.ts index b6f820861..c897cc21b 100644 --- a/spine-ts/spine-construct3/src/c3runtime/expressions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/expressions.ts @@ -83,5 +83,20 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps = TimeScale (this: SpineC3Instance) { return this.state?.timeScale ?? 1; + }, + + CurrentAnimationStart (this: SpineC3Instance, trackIndex: number) { + const track = this.state?.tracks[trackIndex]; + return track?.animationStart ?? 0; + }, + + CurrentAnimationEnd (this: SpineC3Instance, trackIndex: number) { + const track = this.state?.tracks[trackIndex]; + return track?.animationEnd ?? 0; + }, + + CurrentAnimationLast (this: SpineC3Instance, trackIndex: number) { + const track = this.state?.tracks[trackIndex]; + return track?.animationLast ?? 0; } }; diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index e200065c0..6d5772eb1 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -811,6 +811,36 @@ "time-scale": { "description": "Get the current animation time scale (speed multiplier).", "translated-name": "TimeScale" + }, + "current-animation-start": { + "description": "Get the start time of the current animation on the specified track.", + "translated-name": "CurrentAnimationStart", + "params": { + "track-index": { + "name": "Track index", + "desc": "The track index" + } + } + }, + "current-animation-end": { + "description": "Get the end time of the current animation on the specified track.", + "translated-name": "CurrentAnimationEnd", + "params": { + "track-index": { + "name": "Track index", + "desc": "The track index" + } + } + }, + "current-animation-last": { + "description": "Get the last applied time of the current animation on the specified track.", + "translated-name": "CurrentAnimationLast", + "params": { + "track-index": { + "name": "Track index", + "desc": "The track index" + } + } } }, "custom_ui": { diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index 3e5e86e1e..c0f2e9e43 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -811,6 +811,36 @@ "time-scale": { "description": "获取当前动画时间缩放(速度倍数)。", "translated-name": "TimeScale" + }, + "current-animation-start": { + "description": "获取指定轨道上当前动画的开始时间。", + "translated-name": "CurrentAnimationStart", + "params": { + "track-index": { + "name": "轨道索引", + "desc": "轨道索引" + } + } + }, + "current-animation-end": { + "description": "获取指定轨道上当前动画的结束时间。", + "translated-name": "CurrentAnimationEnd", + "params": { + "track-index": { + "name": "轨道索引", + "desc": "轨道索引" + } + } + }, + "current-animation-last": { + "description": "获取指定轨道上当前动画的最后应用时间。", + "translated-name": "CurrentAnimationLast", + "params": { + "track-index": { + "name": "轨道索引", + "desc": "轨道索引" + } + } } }, "custom_ui": {