Animation error in editor.

This commit is contained in:
Davide Tantillo 2025-11-04 11:33:31 +01:00
parent f8c82e0fb9
commit a64ec68c3f

View File

@ -79,6 +79,7 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
const hasErrors = this.hasErrors(); const hasErrors = this.hasErrors();
if (this.skeleton && !hasErrors) { if (this.skeleton && !hasErrors) {
this.setAnimation();
this.setSkin(); this.setSkin();
const rectX = this._inst.GetX(); const rectX = this._inst.GetX();
@ -233,6 +234,7 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
} }
if (id === PLUGIN_CLASS.PROP_ANIMATION) { if (id === PLUGIN_CLASS.PROP_ANIMATION) {
this.setAnimation();
this.layoutView?.Refresh(); this.layoutView?.Refresh();
return; return;
} }
@ -262,6 +264,10 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
console.log("Prop change end"); console.log("Prop change end");
} }
private setAnimation () {
this.animation = this._inst.GetPropertyValue(PLUGIN_CLASS.PROP_ANIMATION) as string;
}
private setSkin () { private setSkin () {
const { skeleton } = this; const { skeleton } = this;
if (!skeleton) return; if (!skeleton) return;
@ -426,6 +432,12 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
"Animation/Skin bounds provider requires one between skin and animation to be set." "Animation/Skin bounds provider requires one between skin and animation to be set."
); );
this.setError(
"nonExistingAnimation",
Boolean(!animation || this.skeleton?.data.findAnimation(animation)) === false,
"Not existing animation"
);
const { width, height } = spineBounds; const { width, height } = spineBounds;
this.setError( this.setError(
"boundsNoDimension", "boundsNoDimension",