Add BoneLength expression.

This commit is contained in:
Davide Tantillo 2026-03-17 12:53:29 +01:00
parent a079413721
commit f2c07a02ec
4 changed files with 40 additions and 0 deletions

View File

@ -763,6 +763,18 @@
} }
] ]
}, },
{
"id": "bone-length",
"expressionName": "BoneLength",
"highlight": false,
"returnType": "number",
"params": [
{
"id": "bone-name",
"type": "string"
}
]
},
{ {
"id": "bone-world-x", "id": "bone-world-x",
"expressionName": "BoneWorldX", "expressionName": "BoneWorldX",

View File

@ -76,6 +76,14 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
return this.getBoneRotation(boneName); 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) { BoneWorldX (this: SpineC3Instance, boneName: string) {
return this.getBoneWorldX(boneName); return this.getBoneWorldX(boneName);
}, },

View File

@ -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": { "bone-world-x": {
"description": "Get the C3 world X position of a bone.", "description": "Get the C3 world X position of a bone.",
"translated-name": "BoneWorldX", "translated-name": "BoneWorldX",

View File

@ -851,6 +851,16 @@
} }
} }
}, },
"bone-length": {
"description": "获取骨骼的长度。",
"translated-name": "BoneLength",
"params": {
"bone-name": {
"name": "骨骼名称",
"desc": "骨骼的名称"
}
}
},
"bone-world-x": { "bone-world-x": {
"description": "获取骨骼的C3世界X位置。", "description": "获取骨骼的C3世界X位置。",
"translated-name": "BoneWorldX", "translated-name": "BoneWorldX",