Add expressions for current animation start/end/last giving track index.

This commit is contained in:
Davide Tantillo 2026-02-26 12:27:13 +01:00
parent f825f3755b
commit 728186bb4f
4 changed files with 111 additions and 0 deletions

View File

@ -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"
}
]
}
]
}

View File

@ -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;
}
};

View File

@ -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": {

View File

@ -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": {