diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 1bea2a28c..b2be085f7 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -379,6 +379,12 @@ "type": "string" } ] + }, + { + "id": "current-skin", + "expressionName": "CurrentSkin", + "highlight": false, + "returnType": "string" } ] } diff --git a/spine-ts/spine-construct3/src/c3runtime/expressions.ts b/spine-ts/spine-construct3/src/c3runtime/expressions.ts index 5e99f70a7..e94d8dfc9 100644 --- a/spine-ts/spine-construct3/src/c3runtime/expressions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/expressions.ts @@ -27,6 +27,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps = BoneRotation (this: SDKInstanceClass, boneName: string) { return this.getBoneRotation(boneName); + }, + + CurrentSkin (this: SDKInstanceClass) { + return this.getCurrentSkin(); } }; diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index 14201a192..b989f4ed3 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -426,6 +426,15 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase { return boneRotation + (offsetAngle * 180 / Math.PI); } + public getCurrentSkin (): string { + if (!this.skeleton) return ""; + + const skin = this.skeleton.skin; + if (!skin) return ""; + + return skin.name; + } + private _setSkin () { const { skeleton } = this; if (!skeleton) return; diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index 5a559bdfa..717556b42 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -456,6 +456,10 @@ "desc": "Name of the bone" } } + }, + "current-skin": { + "description": "Get the current skin name. Returns comma-separated names if multiple skins are active.", + "translated-name": "CurrentSkin" } } } diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index e29533394..91ce54215 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -456,6 +456,10 @@ "desc": "骨骼的名称" } } + }, + "current-skin": { + "description": "获取当前皮肤名称。如果有多个皮肤处于活动状态,返回逗号分隔的名称。", + "translated-name": "CurrentSkin" } } }