mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Fix editor crash due to skin ending with comma.
This commit is contained in:
parent
bab3bf625c
commit
25991c282a
@ -125,6 +125,13 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
|||||||
|
|
||||||
if (id === PLUGIN_CLASS.PROP_SKIN) {
|
if (id === PLUGIN_CLASS.PROP_SKIN) {
|
||||||
this.skins = [];
|
this.skins = [];
|
||||||
|
|
||||||
|
const validatedString = this.validateSkinString();
|
||||||
|
if (validatedString) {
|
||||||
|
this._inst.SetPropertyValue(PLUGIN_CLASS.PROP_SKIN, validatedString);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setSkin();
|
this.setSkin();
|
||||||
this.layoutView?.Refresh();
|
this.layoutView?.Refresh();
|
||||||
return;
|
return;
|
||||||
@ -245,6 +252,16 @@ class SpineC3PluginInstance extends SDK.IWorldInstanceBase {
|
|||||||
this.animation = propValue === "" ? undefined : propValue;
|
this.animation = propValue === "" ? undefined : propValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private validateSkinString () {
|
||||||
|
const skins = this._inst.GetPropertyValue(PLUGIN_CLASS.PROP_SKIN) as string;
|
||||||
|
if (skins === "") return;
|
||||||
|
const split = skins.split(",");
|
||||||
|
|
||||||
|
if (!split.includes("")) return;
|
||||||
|
|
||||||
|
return split.filter(s => s !== "").join(",");
|
||||||
|
}
|
||||||
|
|
||||||
private setSkin () {
|
private setSkin () {
|
||||||
const { skeleton } = this;
|
const { skeleton } = this;
|
||||||
if (!skeleton) return;
|
if (!skeleton) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user