From 9b57f98260e9dd8515632f5aaeaefac9909ded50 Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Tue, 24 Mar 2026 17:13:41 +0100 Subject: [PATCH] Add Loop expression to determine if the current animation on the specified track is looping. --- spine-ts/spine-construct3/src/aces.json | 13 +++++++++++++ .../spine-construct3/src/c3runtime/expressions.ts | 6 ++++++ spine-ts/spine-construct3/src/lang/en-US.json | 10 ++++++++++ spine-ts/spine-construct3/src/lang/zh-CN.json | 10 ++++++++++ 4 files changed, 39 insertions(+) diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 2c327c812..61926933e 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -847,6 +847,19 @@ } ] }, + { + "id": "loop", + "expressionName": "Loop", + "highlight": false, + "returnType": "number", + "params": [ + { + "id": "track-index", + "type": "number", + "initial-value": 0 + } + ] + }, { "id": "current-animation-start", "expressionName": "CurrentAnimationStart", diff --git a/spine-ts/spine-construct3/src/c3runtime/expressions.ts b/spine-ts/spine-construct3/src/c3runtime/expressions.ts index 034e0bfa8..049d7ddba 100644 --- a/spine-ts/spine-construct3/src/c3runtime/expressions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/expressions.ts @@ -119,6 +119,12 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps = return entry?.timeScale ?? 1; }, + Loop (this: SpineC3Instance, track: number) { + if (!this.state) return 0; + const entry = this.state.getCurrent(track); + return entry?.loop ? 1 : 0; + }, + CurrentAnimationStart (this: SpineC3Instance, trackIndex: number) { const track = this.state?.tracks[trackIndex]; return track?.animationStart ?? 0; diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index e9a3dd634..6e36b3e25 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -919,6 +919,16 @@ } } }, + "loop": { + "description": "Get whether the current animation on a track is set to loop (1 = looping, 0 = not looping).", + "translated-name": "Loop", + "params": { + "track-index": { + "name": "Track", + "desc": "Track index." + } + } + }, "current-animation-start": { "description": "Get the start time of the current animation on the specified track.", "translated-name": "CurrentAnimationStart", diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index f7b0e6cb2..488803a34 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -919,6 +919,16 @@ } } }, + "loop": { + "description": "获取轨道上当前动画是否设置为循环(1 = 循环,0 = 不循环)。", + "translated-name": "Loop", + "params": { + "track-index": { + "name": "轨道", + "desc": "轨道索引。" + } + } + }, "current-animation-start": { "description": "获取指定轨道上当前动画的开始时间。", "translated-name": "CurrentAnimationStart",