Add set-animation-mix.

This commit is contained in:
Davide Tantillo 2025-11-06 10:57:58 +01:00
parent e90d5d5d82
commit 3075b5b9b6
5 changed files with 73 additions and 4 deletions

View File

@ -207,10 +207,7 @@
{
"id": "units",
"type": "combo",
"items": [
"seconds",
"ratio"
]
"items": ["seconds", "ratio"]
},
{
"id": "time",
@ -221,6 +218,25 @@
"type": "number"
}
]
},
{
"id": "set-animation-mix",
"scriptName": "SetAnimationMix",
"highlight": false,
"params": [
{
"id": "from-name",
"type": "string"
},
{
"id": "to-name",
"type": "string"
},
{
"id": "duration",
"type": "number"
}
]
}
],
"expressions": [

View File

@ -59,6 +59,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
SetAnimationTime (this: SDKInstanceClass, units: 0 | 1, time: number, track: number) {
this.setAnimationTime(units, time, track);
},
SetAnimationMix (this: SDKInstanceClass, fromName: string, toName: string, duration: number) {
this.setAnimationMix(fromName, toName, duration);
}
};

View File

@ -249,6 +249,17 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
}
}
public setAnimationMix (fromName: string, toName: string, duration: number) {
const stateData = this.state?.data;
if (!stateData) return;
try {
stateData.setMix(fromName, toName, duration);
} catch (error) {
console.error('[Spine] setAnimationMix error:', error);
}
}
private _setSkin () {
const { skeleton } = this;
if (!skeleton) return;

View File

@ -295,6 +295,25 @@
"desc": "Track index"
}
}
},
"set-animation-mix": {
"list-name": "Set animation mix",
"display-text": "Set animation mix from {0} to {1} duration {2}",
"description": "Set the blend/crossfade duration when transitioning from one animation to another",
"params": {
"from-name": {
"name": "From animation",
"desc": "Name of the animation to transition from"
},
"to-name": {
"name": "To animation",
"desc": "Name of the animation to transition to"
},
"duration": {
"name": "Duration",
"desc": "Blend duration in seconds"
}
}
}
},
"expressions": {

View File

@ -297,6 +297,25 @@
}
}
},
"set-animation-mix": {
"list-name": "设置动画混合",
"display-text": "设置从动画{0}到{1}的混合时长为{2}",
"description": "设置从一个动画过渡到另一个动画时的混合/淡入淡出时长",
"params": {
"from-name": {
"name": "起始动画",
"desc": "过渡起始的动画名称"
},
"to-name": {
"name": "目标动画",
"desc": "过渡目标的动画名称"
},
"duration": {
"name": "时长",
"desc": "混合时长(秒)"
}
}
},
"expressions": {
"double": {
"description": "将数字翻倍。",