diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 52be3e76c..3374fd055 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -763,6 +763,18 @@ } ] }, + { + "id": "bone-length", + "expressionName": "BoneLength", + "highlight": false, + "returnType": "number", + "params": [ + { + "id": "bone-name", + "type": "string" + } + ] + }, { "id": "bone-world-x", "expressionName": "BoneWorldX", diff --git a/spine-ts/spine-construct3/src/c3runtime/expressions.ts b/spine-ts/spine-construct3/src/c3runtime/expressions.ts index 5e08c87d5..e11a5f1cc 100644 --- a/spine-ts/spine-construct3/src/c3runtime/expressions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/expressions.ts @@ -76,6 +76,14 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps = return this.getBoneRotation(boneName); }, + BoneLength (this: SpineC3Instance, boneName: string) { + const { skeleton } = this; + if (!skeleton) return 0; + const bone = skeleton.findBone(boneName); + if (!bone) return 0; + return bone.data.length; + }, + BoneWorldX (this: SpineC3Instance, boneName: string) { return this.getBoneWorldX(boneName); }, diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index 435c0132d..5bbb0d3c5 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -851,6 +851,16 @@ } } }, + "bone-length": { + "description": "Get the length of a bone.", + "translated-name": "BoneLength", + "params": { + "bone-name": { + "name": "Bone name", + "desc": "Name of the bone" + } + } + }, "bone-world-x": { "description": "Get the C3 world X position of a bone.", "translated-name": "BoneWorldX", diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index 69ce34b01..a83c2bdd9 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -851,6 +851,16 @@ } } }, + "bone-length": { + "description": "获取骨骼的长度。", + "translated-name": "BoneLength", + "params": { + "bone-name": { + "name": "骨骼名称", + "desc": "骨骼的名称" + } + } + }, "bone-world-x": { "description": "获取骨骼的C3世界X位置。", "translated-name": "BoneWorldX",