LIBOMV-282 Applies Patch from Dahlia Trimble which catches exception when baking is called with a bad or missing texture and allows baking to continue.

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1916 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Jim Radford
2008-07-16 06:07:36 +00:00
parent 25b7790cce
commit b11b67e7d7

View File

@@ -235,21 +235,31 @@ namespace libsecondlife.Baking
int i = 0;
AssetTexture texture;
if (!_textures.TryGetValue(textureIndex, out texture))
return false;
Image source;
Image source = texture.Image;
bool sourceHasAlpha = ((source.Channels & ImageChannels.Alpha) != 0 && source.Alpha != null);
bool sourceHasBump = ((source.Channels & ImageChannels.Bump) != 0 && source.Bump != null);
bool sourceHasAlpha;
bool sourceHasBump;
bool copySourceAlphaToBakedLayer;
bool copySourceAlphaToBakedLayer = sourceHasAlpha && (
textureIndex == AppearanceManager.TextureIndex.HeadBodypaint ||
textureIndex == AppearanceManager.TextureIndex.Skirt
);
try
{
if (!_textures.TryGetValue(textureIndex, out texture))
return false;
if (source.Width != _bakeWidth || source.Height != _bakeHeight)
source.ResizeNearestNeighbor(_bakeWidth, _bakeHeight);
source = texture.Image;
sourceHasAlpha = ((source.Channels & ImageChannels.Alpha) != 0 && source.Alpha != null);
sourceHasBump = ((source.Channels & ImageChannels.Bump) != 0 && source.Bump != null);
copySourceAlphaToBakedLayer = sourceHasAlpha && (
textureIndex == AppearanceManager.TextureIndex.HeadBodypaint ||
textureIndex == AppearanceManager.TextureIndex.Skirt
);
if (source.Width != _bakeWidth || source.Height != _bakeHeight)
source.ResizeNearestNeighbor(_bakeWidth, _bakeHeight);
}
catch { return false; }
int alpha = 255;
//int alphaInv = 255 - alpha;