Add Loop expression to determine if the current animation on the specified track is looping.

This commit is contained in:
Davide Tantillo 2026-03-24 17:13:41 +01:00
parent 02ec69de27
commit 9b57f98260
4 changed files with 39 additions and 0 deletions

View File

@ -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", "id": "current-animation-start",
"expressionName": "CurrentAnimationStart", "expressionName": "CurrentAnimationStart",

View File

@ -119,6 +119,12 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
return entry?.timeScale ?? 1; 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) { CurrentAnimationStart (this: SpineC3Instance, trackIndex: number) {
const track = this.state?.tracks[trackIndex]; const track = this.state?.tracks[trackIndex];
return track?.animationStart ?? 0; return track?.animationStart ?? 0;

View File

@ -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": { "current-animation-start": {
"description": "Get the start time of the current animation on the specified track.", "description": "Get the start time of the current animation on the specified track.",
"translated-name": "CurrentAnimationStart", "translated-name": "CurrentAnimationStart",

View File

@ -919,6 +919,16 @@
} }
} }
}, },
"loop": {
"description": "获取轨道上当前动画是否设置为循环1 = 循环0 = 不循环)。",
"translated-name": "Loop",
"params": {
"track-index": {
"name": "轨道",
"desc": "轨道索引。"
}
}
},
"current-animation-start": { "current-animation-start": {
"description": "获取指定轨道上当前动画的开始时间。", "description": "获取指定轨道上当前动画的开始时间。",
"translated-name": "CurrentAnimationStart", "translated-name": "CurrentAnimationStart",