diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 3374fd055..2c327c812 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -294,6 +294,11 @@ "scriptName": "SetTimeScale", "highlight": false, "params": [ + { + "id": "track-index", + "type": "number", + "initial-value": -1 + }, { "id": "time-scale", "type": "number" @@ -833,7 +838,14 @@ "id": "time-scale", "expressionName": "TimeScale", "highlight": false, - "returnType": "number" + "returnType": "number", + "params": [ + { + "id": "track-index", + "type": "number", + "initial-value": -1 + } + ] }, { "id": "current-animation-start", diff --git a/spine-ts/spine-construct3/src/c3runtime/actions.ts b/spine-ts/spine-construct3/src/c3runtime/actions.ts index aec182b46..2c129c37f 100644 --- a/spine-ts/spine-construct3/src/c3runtime/actions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/actions.ts @@ -85,8 +85,8 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts = this.setCustomSkin(skinName); }, - SetTimeScale (this: SDKInstanceClass, timeScale: number) { - this.setAnimationSpeed(timeScale); + SetTimeScale (this: SDKInstanceClass, track: number, timeScale: number) { + this.setTimeScale(track, timeScale); }, SetAnimationTime (this: SDKInstanceClass, track: number, time: number, units: 0 | 1) { diff --git a/spine-ts/spine-construct3/src/c3runtime/expressions.ts b/spine-ts/spine-construct3/src/c3runtime/expressions.ts index e11a5f1cc..034e0bfa8 100644 --- a/spine-ts/spine-construct3/src/c3runtime/expressions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/expressions.ts @@ -112,8 +112,11 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps = return ""; }, - TimeScale (this: SpineC3Instance) { - return this.state?.timeScale ?? 1; + TimeScale (this: SpineC3Instance, track: number) { + if (!this.state) return 1; + if (track < 0) return this.state.timeScale; + const entry = this.state.getCurrent(track); + return entry?.timeScale ?? 1; }, CurrentAnimationStart (this: SpineC3Instance, trackIndex: number) { diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index 06649db51..bf6857110 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -594,9 +594,14 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase { return track.animation.name; } - public setAnimationSpeed (speed: number) { + public setTimeScale (track: number, timeScale: number) { if (!this.state) return; - this.state.timeScale = speed; + if (track < 0) { + this.state.timeScale = timeScale; + } else { + const entry = this.state.getCurrent(track); + if (entry) entry.timeScale = timeScale; + } } public setAnimationTime (units: 0 | 1, time: number, track: number) { diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index 5bbb0d3c5..e9a3dd634 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -370,12 +370,16 @@ }, "set-time-scale": { "list-name": "Set time scale", - "display-text": "Set time scale to {0}", - "description": "Set the time scale of animations (1.0 = normal, 2.0 = double speed, 0.5 = half speed)", + "display-text": "Set track {0} time scale to {1}", + "description": "Set the time scale for a specific track or the entire animation state. When targeting a track, the time scale affects only the current animation on that track. Use -1 for the track to set the global animation state time scale. Set to 0 to pause.", "params": { + "track-index": { + "name": "Track", + "desc": "Track index to set the time scale for, or -1 to set the global animation state time scale." + }, "time-scale": { "name": "Time scale", - "desc": "Time scale multiplier (1.0 is normal speed)" + "desc": "Time scale multiplier (1.0 is normal speed, 0 to pause)" } } }, @@ -906,8 +910,14 @@ } }, "time-scale": { - "description": "Get the current animation time scale (speed multiplier).", - "translated-name": "TimeScale" + "description": "Get the time scale for a specific track or the global animation state. Use -1 for the global animation state time scale.", + "translated-name": "TimeScale", + "params": { + "track-index": { + "name": "Track", + "desc": "Track index, or -1 for the global animation state time scale." + } + } }, "current-animation-start": { "description": "Get the start time of the current animation on the specified track.", diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index a83c2bdd9..f7b0e6cb2 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -370,12 +370,16 @@ }, "set-time-scale": { "list-name": "设置时间缩放", - "display-text": "将时间缩放设置为{0}", - "description": "设置动画时间缩放(1.0 = 正常,2.0 = 两倍速,0.5 = 半速)", + "display-text": "将轨道{0}的时间缩放设置为{1}", + "description": "设置特定轨道或整个动画状态的时间缩放。针对轨道时,时间缩放仅影响该轨道上的当前动画。使用-1设置全局动画状态时间缩放。设置为0可暂停。", "params": { + "track-index": { + "name": "轨道", + "desc": "要设置时间缩放的轨道索引,或-1设置全局动画状态时间缩放。" + }, "time-scale": { "name": "时间缩放", - "desc": "时间缩放倍数(1.0为正常速度)" + "desc": "时间缩放倍数(1.0为正常速度,0为暂停)" } } }, @@ -906,8 +910,14 @@ } }, "time-scale": { - "description": "获取当前动画时间缩放(速度倍数)。", - "translated-name": "TimeScale" + "description": "获取特定轨道或全局动画状态的时间缩放。使用-1获取全局动画状态时间缩放。", + "translated-name": "TimeScale", + "params": { + "track-index": { + "name": "轨道", + "desc": "轨道索引,或-1获取全局动画状态时间缩放。" + } + } }, "current-animation-start": { "description": "获取指定轨道上当前动画的开始时间。",