The JSON Hash and Array Texture Parsers will now throw a console.warn if the JSON is invalid and contains identically named frames.

This commit is contained in:
Richard Davey 2021-11-03 13:49:24 +00:00
parent 68550dbddb
commit 07f0bd4184
2 changed files with 14 additions and 0 deletions

View file

@ -47,6 +47,13 @@ var JSONArray = function (texture, sourceIndex, json)
// The frame values are the exact coordinates to cut the frame out of the atlas from // The frame values are the exact coordinates to cut the frame out of the atlas from
newFrame = texture.add(src.filename, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h); newFrame = texture.add(src.filename, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h);
if (!newFrame)
{
console.warn('Invalid atlas json, frame already exists: ' + src.filename);
continue;
}
// These are the original (non-trimmed) sprite values // These are the original (non-trimmed) sprite values
if (src.trimmed) if (src.trimmed)
{ {

View file

@ -51,6 +51,13 @@ var JSONHash = function (texture, sourceIndex, json)
// The frame values are the exact coordinates to cut the frame out of the atlas from // The frame values are the exact coordinates to cut the frame out of the atlas from
newFrame = texture.add(key, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h); newFrame = texture.add(key, sourceIndex, src.frame.x, src.frame.y, src.frame.w, src.frame.h);
if (!newFrame)
{
console.warn('Invalid atlas json, frame already exists: ' + key);
continue;
}
// These are the original (non-trimmed) sprite values // These are the original (non-trimmed) sprite values
if (src.trimmed) if (src.trimmed)
{ {