/// <param name="bakeType">Layer to bake</param>
/// <returns>True on success, otherwise false</returns>
private boolean CreateBake(BakeType bakeType) throws Exception
{
List<AvatarTextureIndex> textureIndices = BakeTypeToTextures(bakeType);
Baker oven = new Baker(bakeType);
for (int i = 0; i < textureIndices.size(); i++)
{
AvatarTextureIndex textureIndex = textureIndices.get(i);
TextureData texture = Textures[(int)textureIndex.getIndex()];
if(texture == null)
JLogger.warn("Texture is null for index" + textureIndex.getIndex());
//TODO need to verfy why original code was sending even Zero textures for baking
if(!texture.TextureID.equals(UUID.Zero))
{
JLogger.debug("Adding Texture to oven" + texture.toString());
texture.TextureIndex = textureIndex;
oven.AddTexture(texture);
}
}
long start = Utils.getUnixTime();
JLogger.debug("Going to oven.Bake..");
oven.Bake();
JLogger.debug("Task Baking " + bakeType + " took " + (Utils.getUnixTime() - start) + "ms");
UUID newAssetID = UUID.Zero;
int retries = UPLOAD_RETRIES;
while (newAssetID.equals(UUID.Zero) && retries > 0)
{
newAssetID = UploadBake(oven.getBakedTexture().AssetData);
--retries;
}
Textures[(int)BakeTypeToAgentTextureIndex(bakeType).getIndex()].TextureID = newAssetID;