Merge branch 'teravuswork' into avination

avinationmerge
Melanie 2013-01-08 12:14:08 +01:00
commit f86278e389
2 changed files with 115 additions and 50 deletions

View File

@ -119,13 +119,20 @@ namespace OpenSim.Region.ClientStack.Linden
private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
{
int maxCacheitemsLoop = cacheItems.Length;
if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES)
{
maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES;
m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES);
}
m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
if (cacheItems.Length > 0)
{
m_log.Info("[Cacheitems]: " + cacheItems.Length);
for (int iter = 0; iter < cacheItems.Length; iter++)
m_log.Debug("[Cacheitems]: " + cacheItems.Length);
for (int iter = 0; iter < maxCacheitemsLoop; iter++)
{
m_log.Info("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
cacheItems[iter].TextureID);
}
@ -149,10 +156,28 @@ namespace OpenSim.Region.ClientStack.Linden
}
}
/*
* The following Catch types DO NOT WORK with m_BakedTextureModule.Get
* it jumps to the General Packet Exception Handler if you don't catch Exception!
*
catch (System.Net.Sockets.SocketException)
{
cacheItems = null;
}
catch (WebException)
{
cacheItems = null;
}
catch (InvalidOperationException)
{
cacheItems = null;
} */
catch (Exception)
{
// The service logs a sufficient error message.
}
if (savedcache != null)
existingitems = savedcache;
}
@ -161,12 +186,20 @@ namespace OpenSim.Region.ClientStack.Linden
if (existingitems == null)
{
for (int iter = 0; iter < cacheItems.Length; iter++)
for (int i = 0; i < maxCacheitemsLoop; i++)
{
cacheItems[iter].TextureID = textureEntry.FaceTextures[cacheItems[iter].TextureIndex].TextureID;
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
{
cacheItems[i].TextureID =
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID;
if (m_scene.AssetService != null)
cacheItems[iter].TextureAsset = m_scene.AssetService.GetCached(cacheItems[iter].TextureID.ToString());
cacheItems[i].TextureAsset =
m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
}
else
{
m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
}
}
@ -176,17 +209,25 @@ namespace OpenSim.Region.ClientStack.Linden
{
// for each uploaded baked texture
for (int i = 0; i < cacheItems.Length; i++)
for (int i = 0; i < maxCacheitemsLoop; i++)
{
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
{
cacheItems[i].TextureID =
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID;
}
else
{
m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
}
}
for (int i = 0; i < cacheItems.Length; i++)
for (int i = 0; i < maxCacheitemsLoop; i++)
{
if (cacheItems[i].TextureAsset == null)
{
cacheItems[i].TextureAsset = m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
cacheItems[i].TextureAsset =
m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
}
}
}

View File

@ -11727,6 +11727,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
IAssetService cache = m_scene.AssetService;
IBakedTextureModule bakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
//bakedTextureModule = null;
int maxWearablesLoop = cachedtex.WearableData.Length;
if (maxWearablesLoop > AvatarWearable.MAX_WEARABLES)
maxWearablesLoop = AvatarWearable.MAX_WEARABLES;
if (bakedTextureModule != null && cache != null)
{
// We need to make sure the asset stored in the bake is available on this server also by it's assetid before we map it to a Cacheid
@ -11742,10 +11747,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
p.Appearance.WearableCacheItems = cacheItems;
p.Appearance.WearableCacheItemsDirty = false;
}
catch (InvalidOperationException)
/*
* The following Catch types DO NOT WORK, it jumps to the General Packet Exception Handler if you don't catch Exception!
*
catch (System.Net.Sockets.SocketException)
{
cacheItems = null;
}
catch (WebException)
{
cacheItems = null;
}
catch (InvalidOperationException)
{
cacheItems = null;
} */
catch (Exception)
{
cacheItems = null;
}
}
else if (p.Appearance.WearableCacheItems != null)
{
@ -11766,10 +11788,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
if (cacheItems != null)
{
for (int i = 0; i < cachedtex.WearableData.Length; i++)
for (int i = 0; i < maxWearablesLoop; i++)
{
WearableCacheItem item =
WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex,cacheItems);
@ -11777,8 +11800,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex= cachedtex.WearableData[i].TextureIndex;
cachedresp.WearableData[i].HostName = new byte[0];
if (item != null)
if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
{
cachedresp.WearableData[i].TextureID = item.TextureID;
}
else
@ -11789,7 +11813,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
for (int i = 0; i < cachedtex.WearableData.Length; i++)
for (int i = 0; i < maxWearablesLoop; i++)
{
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
@ -11803,7 +11827,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (cache == null)
{
for (int i = 0; i < cachedtex.WearableData.Length; i++)
for (int i = 0; i < maxWearablesLoop; i++)
{
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
@ -11814,7 +11838,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
for (int i = 0; i < cachedtex.WearableData.Length; i++)
for (int i = 0; i < maxWearablesLoop; i++)
{
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;