mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-05 23:05:01 +08:00
Add expression current-animation.
This commit is contained in:
parent
6af077c0a6
commit
ff2ee5397b
@ -385,6 +385,18 @@
|
||||
"expressionName": "CurrentSkin",
|
||||
"highlight": false,
|
||||
"returnType": "string"
|
||||
},
|
||||
{
|
||||
"id": "current-animation",
|
||||
"expressionName": "CurrentAnimation",
|
||||
"highlight": false,
|
||||
"returnType": "string",
|
||||
"params": [
|
||||
{
|
||||
"id": "track-index",
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -31,6 +31,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
|
||||
|
||||
CurrentSkin (this: SDKInstanceClass) {
|
||||
return this.getCurrentSkin();
|
||||
},
|
||||
|
||||
CurrentAnimation (this: SDKInstanceClass, trackIndex: number) {
|
||||
return this.getCurrentAnimation(trackIndex);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -435,6 +435,18 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
return skin.name;
|
||||
}
|
||||
|
||||
public getCurrentAnimation (trackIndex: number): string {
|
||||
if (!this.skeleton) return "";
|
||||
|
||||
const { state } = this;
|
||||
if (!state) return "";
|
||||
|
||||
const track = state.tracks[trackIndex];
|
||||
if (!track || !track.animation) return "";
|
||||
|
||||
return track.animation.name;
|
||||
}
|
||||
|
||||
private _setSkin () {
|
||||
const { skeleton } = this;
|
||||
if (!skeleton) return;
|
||||
|
||||
@ -460,6 +460,16 @@
|
||||
"current-skin": {
|
||||
"description": "Get the current skin name. Returns comma-separated names if multiple skins are active.",
|
||||
"translated-name": "CurrentSkin"
|
||||
},
|
||||
"current-animation": {
|
||||
"description": "Get the name of the currently playing animation on a specific track.",
|
||||
"translated-name": "CurrentAnimation",
|
||||
"params": {
|
||||
"track-index": {
|
||||
"name": "Track index",
|
||||
"desc": "Index of the track"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -460,6 +460,16 @@
|
||||
"current-skin": {
|
||||
"description": "获取当前皮肤名称。如果有多个皮肤处于活动状态,返回逗号分隔的名称。",
|
||||
"translated-name": "CurrentSkin"
|
||||
},
|
||||
"current-animation": {
|
||||
"description": "获取特定轨道上当前播放的动画名称。",
|
||||
"translated-name": "CurrentAnimation",
|
||||
"params": {
|
||||
"track-index": {
|
||||
"name": "轨道索引",
|
||||
"desc": "轨道的索引"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user