Merge pull request #6348 from samme/feature/create-animation-failures

Improve the missing frame/texture handling when creating animations
This commit is contained in:
Richard Davey 2023-01-18 16:24:31 +00:00 committed by GitHub
commit 9a4c3b0361
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 4 deletions

View file

@ -399,6 +399,13 @@ var Animation = new Class({
{
textureKey = frames;
if (!textureManager.exists(textureKey))
{
console.warn('Texture "%s" not found', textureKey);
return out;
}
var texture = textureManager.get(textureKey);
var frameKeys = texture.getFrameNames();
@ -437,6 +444,13 @@ var Animation = new Class({
// The actual texture frame
var textureFrame = textureManager.getFrame(key, frame);
if (!textureFrame)
{
console.warn('Texture "%s" not found', key);
continue;
}
animationFrame = new Frame(key, frame, index, textureFrame);
animationFrame.duration = GetValue(item, 'duration', 0);

View file

@ -637,6 +637,13 @@ var AnimationManager = new Class({
var out = GetValue(config, 'outputArray', []);
var frames = GetValue(config, 'frames', false);
if (!this.textureManager.exists(key))
{
console.warn('Texture "%s" not found', key);
return out;
}
var texture = this.textureManager.get(key);
if (!texture)
@ -673,7 +680,7 @@ var AnimationManager = new Class({
}
else
{
console.warn('generateFrameNames: Frame missing: ' + frame + ' from texture: ' + key);
console.warn('Frame "%s" not found in texture "%s"', frame, key);
}
}
}
@ -736,6 +743,13 @@ var AnimationManager = new Class({
var out = GetValue(config, 'outputArray', []);
var frames = GetValue(config, 'frames', false);
if (!this.textureManager.exists(key))
{
console.warn('Texture "%s" not found', key);
return out;
}
var texture = this.textureManager.get(key);
if (!texture)
@ -763,13 +777,15 @@ var AnimationManager = new Class({
for (var i = 0; i < frames.length; i++)
{
if (texture.has(frames[i]))
var frameName = frames[i];
if (texture.has(frameName))
{
out.push({ key: key, frame: frames[i] });
out.push({ key: key, frame: frameName });
}
else
{
console.warn('generateFrameNumbers: Frame ' + i + ' missing from texture: ' + key);
console.warn('Frame "%s" not found in texture "%s"', frameName, key);
}
}