Made OnAnimationEvent more generic allowing empty params to be used as any.

This commit is contained in:
Davide Tantillo 2025-11-05 11:57:56 +01:00
parent ff8024ed83
commit 8767b81e17
4 changed files with 17 additions and 15 deletions

View File

@ -16,16 +16,17 @@
{ {
"id": "event", "id": "event",
"type": "string", "type": "string",
"initial-value": "complete" "initial-value": ""
}, },
{ {
"id": "track", "id": "track",
"type": "number", "type": "number",
"initial-value": 0 "initial-value": -1
}, },
{ {
"id": "animation", "id": "animation",
"type": "string" "type": "string",
"initial-value": ""
} }
] ]
}, },

View File

@ -9,9 +9,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Cnds =
return true; return true;
}, },
OnAnimationEvent (this: SpineC3Instance, event: string, track: number, animation: string) { OnAnimationEvent (this: SpineC3Instance, event: string, track: number, animation: string) {
return this.triggeredEventName === event const eventMatches = event === "" || this.triggeredEventName === event;
&& this.triggeredEventTrack === track const trackMatches = track === -1 || this.triggeredEventTrack === track;
&& this.triggeredEventAnimation === animation; const animationMatches = animation === "" || this.triggeredEventAnimation === animation;
return eventMatches && trackMatches && animationMatches;
}, },
IsFlippedX (this: SpineC3Instance) { IsFlippedX (this: SpineC3Instance) {
return this.propFlipX; return this.propFlipX;

View File

@ -82,20 +82,20 @@
}, },
"on-animation-event": { "on-animation-event": {
"list-name": "On animation event", "list-name": "On animation event",
"display-text": "On {0} event triggered by animation {2} on track {1} trigger", "display-text": "On {0} event triggered by animation {2} on track {1}",
"description": "Do something when animation event is triggered", "description": "Triggered when animation event occurs. Use empty string for event/animation or -1 for track to match any value.",
"params": { "params": {
"event": { "event": {
"name": "Event name", "name": "Event name",
"desc": "Event name" "desc": "Event name (start, dispose, event, interrupt, end, complete). Empty string matches any event."
}, },
"animation": { "animation": {
"name": "Animation", "name": "Animation",
"desc": "Animation" "desc": "Animation name. Empty string matches any animation."
}, },
"track": { "track": {
"name": "Track number", "name": "Track number",
"desc": "Track number" "desc": "Track index. Use -1 to match any track."
} }
} }
}, },

View File

@ -83,19 +83,19 @@
"on-animation-event": { "on-animation-event": {
"list-name": "动画事件触发时", "list-name": "动画事件触发时",
"display-text": "当轨道{1}上的动画{2}触发{0}事件时", "display-text": "当轨道{1}上的动画{2}触发{0}事件时",
"description": "当动画事件触发时执行操作", "description": "当动画事件发生时触发。使用空字符串匹配任意事件/动画,或使用-1匹配任意轨道。",
"params": { "params": {
"event": { "event": {
"name": "事件名称", "name": "事件名称",
"desc": "事件名称" "desc": "事件名称start、dispose、event、interrupt、end、complete。空字符串匹配任意事件。"
}, },
"animation": { "animation": {
"name": "动画", "name": "动画",
"desc": "动画" "desc": "动画名称。空字符串匹配任意动画。"
}, },
"track": { "track": {
"name": "轨道编号", "name": "轨道编号",
"desc": "轨道编号" "desc": "轨道索引。使用-1匹配任意轨道。"
} }
} }
}, },