Skip to content

Commit f2c07a0

Browse files
committed
Add BoneLength expression.
1 parent a079413 commit f2c07a0

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

spine-ts/spine-construct3/src/aces.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,18 @@
763763
}
764764
]
765765
},
766+
{
767+
"id": "bone-length",
768+
"expressionName": "BoneLength",
769+
"highlight": false,
770+
"returnType": "number",
771+
"params": [
772+
{
773+
"id": "bone-name",
774+
"type": "string"
775+
}
776+
]
777+
},
766778
{
767779
"id": "bone-world-x",
768780
"expressionName": "BoneWorldX",

spine-ts/spine-construct3/src/c3runtime/expressions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
7676
return this.getBoneRotation(boneName);
7777
},
7878

79+
BoneLength (this: SpineC3Instance, boneName: string) {
80+
const { skeleton } = this;
81+
if (!skeleton) return 0;
82+
const bone = skeleton.findBone(boneName);
83+
if (!bone) return 0;
84+
return bone.data.length;
85+
},
86+
7987
BoneWorldX (this: SpineC3Instance, boneName: string) {
8088
return this.getBoneWorldX(boneName);
8189
},

spine-ts/spine-construct3/src/lang/en-US.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,16 @@
851851
}
852852
}
853853
},
854+
"bone-length": {
855+
"description": "Get the length of a bone.",
856+
"translated-name": "BoneLength",
857+
"params": {
858+
"bone-name": {
859+
"name": "Bone name",
860+
"desc": "Name of the bone"
861+
}
862+
}
863+
},
854864
"bone-world-x": {
855865
"description": "Get the C3 world X position of a bone.",
856866
"translated-name": "BoneWorldX",

spine-ts/spine-construct3/src/lang/zh-CN.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,16 @@
851851
}
852852
}
853853
},
854+
"bone-length": {
855+
"description": "获取骨骼的长度。",
856+
"translated-name": "BoneLength",
857+
"params": {
858+
"bone-name": {
859+
"name": "骨骼名称",
860+
"desc": "骨骼的名称"
861+
}
862+
}
863+
},
854864
"bone-world-x": {
855865
"description": "获取骨骼的C3世界X位置。",
856866
"translated-name": "BoneWorldX",

0 commit comments

Comments
 (0)