Add set-skeleton-color.

This commit is contained in:
Davide Tantillo 2025-11-06 11:46:08 +01:00
parent 34e56af5c5
commit 8ed7554f14
5 changed files with 47 additions and 0 deletions

View File

@ -250,6 +250,17 @@
} }
] ]
}, },
{
"id": "set-skeleton-color",
"scriptName": "SetSkeletonColor",
"highlight": false,
"params": [
{
"id": "color",
"type": "string"
}
]
},
{ {
"id": "set-slot-color", "id": "set-slot-color",
"scriptName": "SetSlotColor", "scriptName": "SetSlotColor",

View File

@ -69,6 +69,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
this.setPhysicsMode(mode); this.setPhysicsMode(mode);
}, },
SetSkeletonColor (this: SDKInstanceClass, color: string) {
this.setSkeletonColor(color);
},
SetSlotColor (this: SDKInstanceClass, slotName: string, color: string) { SetSlotColor (this: SDKInstanceClass, slotName: string, color: string) {
this.setSlotColor(slotName, color); this.setSlotColor(slotName, color);
}, },

View File

@ -271,6 +271,16 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
} }
} }
public setSkeletonColor (color: string) {
const { skeleton } = this;
if (!skeleton) {
console.warn('[Spine] setSkeletonColor: no skeleton');
return;
}
skeleton.color.setFromString(color);
}
public setSlotColor (slotName: string, color: string) { public setSlotColor (slotName: string, color: string) {
const { skeleton } = this; const { skeleton } = this;
if (!skeleton) { if (!skeleton) {

View File

@ -332,6 +332,17 @@
} }
} }
}, },
"set-skeleton-color": {
"list-name": "Set skeleton color",
"display-text": "Set skeleton color to {0}",
"description": "Set the color of the entire skeleton. Accepts hex colors (#RRGGBB or #RRGGBBAA) or color names.",
"params": {
"color": {
"name": "Color",
"desc": "Color value (hex like #FF0000 or color name)"
}
}
},
"set-slot-color": { "set-slot-color": {
"list-name": "Set slot color", "list-name": "Set slot color",
"display-text": "Set slot {0} color to {1}", "display-text": "Set slot {0} color to {1}",

View File

@ -333,6 +333,17 @@
} }
} }
}, },
"set-skeleton-color": {
"list-name": "设置骨架颜色",
"display-text": "设置骨架颜色为{0}",
"description": "设置整个骨架的颜色。接受十六进制颜色(#RRGGBB 或 #RRGGBBAA或颜色名称。",
"params": {
"color": {
"name": "颜色",
"desc": "颜色值(十六进制如 #FF0000 或颜色名称)"
}
}
},
"set-slot-color": { "set-slot-color": {
"list-name": "设置插槽颜色", "list-name": "设置插槽颜色",
"display-text": "设置插槽{0}的颜色为{1}", "display-text": "设置插槽{0}的颜色为{1}",