mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 22:52:14 +00:00
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:
parent
68550dbddb
commit
07f0bd4184
2 changed files with 14 additions and 0 deletions
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue