The SpineFile will no longer throw a warning if adding a texture into the Texture Manager that already exists. This allows you to have multiple Spine JSON use the same texture file, however, it also means you now get no warning if you accidentally load a texture that exists, so be careful with your keys! Fix #4947

This commit is contained in:
Richard Davey 2020-08-26 00:14:16 +01:00
parent 2c79753ef3
commit 798fa8f5fd

View file

@ -211,6 +211,7 @@ var SpineFile = new Class({
var atlasKey = '';
var combinedAtlasData = '';
var preMultipliedAlpha = (this.config.preMultipliedAlpha) ? true : false;
var textureManager = this.loader.textureManager;
for (var i = 1; i < this.files.length; i++)
{
@ -230,7 +231,10 @@ var SpineFile = new Class({
var pos = src.indexOf('_');
var key = src.substr(pos + 1);
this.loader.textureManager.addImage(key, file.data);
if (!textureManager.exists(key))
{
textureManager.addImage(key, file.data);
}
}
file.pendingDestroy();