Add Setup Pose and Setup Bone Slot Pose actions.

This commit is contained in:
Davide Tantillo 2026-02-04 15:33:25 +01:00
parent 3e15e3f688
commit a4b7081ba3
5 changed files with 126 additions and 0 deletions

View File

@ -452,6 +452,34 @@
}
]
},
{
"id": "setup-pose",
"scriptName": "SetupPose",
"highlight": false,
"params": [
{
"id": "target",
"type": "combo",
"items": ["all", "bones", "slots"]
}
]
},
{
"id": "setup-bone-slot-pose",
"scriptName": "SetupBoneSlotPose",
"highlight": false,
"params": [
{
"id": "type",
"type": "combo",
"items": ["bone", "slot"]
},
{
"id": "name",
"type": "string"
}
]
},
{
"id": "attach-instance-to-bone",
"scriptName": "AttachInstanceToBone",

View File

@ -138,6 +138,14 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
this.releaseBoneHold(boneName, resetToSetup);
},
SetupPose (this: SDKInstanceClass, target: 0 | 1 | 2) {
this.setupPose(target);
},
SetupBoneSlotPose (this: SDKInstanceClass, type: 0 | 1, name: string) {
this.setupBoneSlotPose(type === 0 ? "bone" : "slot", name);
},
AttachInstanceToBone (this: SDKInstanceClass, uid: number, boneName: string, offsetX: number, offsetY: number, offsetAngle: number) {
this.attachInstanceToBone(uid, boneName, offsetX, offsetY, offsetAngle);
},

View File

@ -1019,6 +1019,26 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
if (resetToSetup) bone.setupPose();
}
public setupPose (target: 0 | 1 | 2) {
const { skeleton } = this;
if (!skeleton) return;
if (target === 0) skeleton.setupPose();
else if (target === 1) skeleton.setupPoseBones();
else skeleton.setupPoseSlots();
}
public setupBoneSlotPose (type: "bone" | "slot", name: string) {
if (type === "bone") {
const bone = this.getBone(name);
if (!bone) return;
bone.setupPose();
} else {
const slot = this.getSlot(name);
if (!slot) return;
slot.setupPose();
}
}
private getBone (boneName: string | Bone) {
if (boneName instanceof spine.Bone) return boneName;

View File

@ -545,6 +545,41 @@
}
}
},
"setup-pose": {
"list-name": "Setup pose",
"display-text": "Reset {0} to setup pose",
"description": "Reset bones and/or slots to their setup pose values.",
"params": {
"target": {
"name": "Target",
"desc": "What to reset to setup pose.",
"items": {
"all": "All (bones and slots)",
"bones": "Bones",
"slots": "Slots"
}
}
}
},
"setup-bone-slot-pose": {
"list-name": "Setup bone/slot pose",
"display-text": "Reset {0} {1} to setup pose",
"description": "Reset a specific bone or slot to its setup pose values.",
"params": {
"type": {
"name": "Type",
"desc": "Type of target to reset.",
"items": {
"bone": "Bone",
"slot": "Slot"
}
},
"name": {
"name": "Name",
"desc": "Name of the bone or slot to reset."
}
}
},
"attach-instance-to-bone": {
"list-name": "Attach instance to bone",
"display-text": "Attach instance UID {0} to bone {1} with offset ({2}, {3}, {4}°)",

View File

@ -545,6 +545,41 @@
}
}
},
"setup-pose": {
"list-name": "重置为初始姿势",
"display-text": "将{0}重置为初始姿势",
"description": "将骨骼和/或插槽重置为初始姿势值。",
"params": {
"target": {
"name": "目标",
"desc": "要重置为初始姿势的内容。",
"items": {
"all": "全部(骨骼和插槽)",
"bones": "骨骼",
"slots": "插槽"
}
}
}
},
"setup-bone-slot-pose": {
"list-name": "重置骨骼/插槽为初始姿势",
"display-text": "将{0} {1}重置为初始姿势",
"description": "将指定的骨骼或插槽重置为初始姿势值。",
"params": {
"type": {
"name": "类型",
"desc": "要重置的目标类型。",
"items": {
"bone": "骨骼",
"slot": "插槽"
}
},
"name": {
"name": "名称",
"desc": "要重置的骨骼或插槽名称。"
}
}
},
"attach-instance-to-bone": {
"list-name": "将实例附加到骨骼",
"display-text": "将实例UID {0}附加到骨骼{1},偏移({2}, {3}, {4}°)",