From 8ed7554f1454f5fe83930aa6a9624d1d81dd2886 Mon Sep 17 00:00:00 2001 From: Davide Tantillo Date: Thu, 6 Nov 2025 11:46:08 +0100 Subject: [PATCH] Add set-skeleton-color. --- spine-ts/spine-construct3/src/aces.json | 11 +++++++++++ spine-ts/spine-construct3/src/c3runtime/actions.ts | 4 ++++ spine-ts/spine-construct3/src/c3runtime/instance.ts | 10 ++++++++++ spine-ts/spine-construct3/src/lang/en-US.json | 11 +++++++++++ spine-ts/spine-construct3/src/lang/zh-CN.json | 11 +++++++++++ 5 files changed, 47 insertions(+) diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 4b73339ba..9cb3e423a 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -250,6 +250,17 @@ } ] }, + { + "id": "set-skeleton-color", + "scriptName": "SetSkeletonColor", + "highlight": false, + "params": [ + { + "id": "color", + "type": "string" + } + ] + }, { "id": "set-slot-color", "scriptName": "SetSlotColor", diff --git a/spine-ts/spine-construct3/src/c3runtime/actions.ts b/spine-ts/spine-construct3/src/c3runtime/actions.ts index 27123e0f2..1954472ee 100644 --- a/spine-ts/spine-construct3/src/c3runtime/actions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/actions.ts @@ -69,6 +69,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts = this.setPhysicsMode(mode); }, + SetSkeletonColor (this: SDKInstanceClass, color: string) { + this.setSkeletonColor(color); + }, + SetSlotColor (this: SDKInstanceClass, slotName: string, color: string) { this.setSlotColor(slotName, color); }, diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index ab3ad930f..f15658dd1 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -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) { const { skeleton } = this; if (!skeleton) { diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index edebbdf14..af57ccb25 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -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": { "list-name": "Set slot color", "display-text": "Set slot {0} color to {1}", diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index 395f28624..56fea38da 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -333,6 +333,17 @@ } } }, + "set-skeleton-color": { + "list-name": "设置骨架颜色", + "display-text": "设置骨架颜色为{0}", + "description": "设置整个骨架的颜色。接受十六进制颜色(#RRGGBB 或 #RRGGBBAA)或颜色名称。", + "params": { + "color": { + "name": "颜色", + "desc": "颜色值(十六进制如 #FF0000 或颜色名称)" + } + } + }, "set-slot-color": { "list-name": "设置插槽颜色", "display-text": "设置插槽{0}的颜色为{1}",