Stop mesh avatars that specify the alpha texture in their bake slots from causing the simulator to continually request that they rebake

This is because the alpha texture is not in the cache, we must continue to have the fallback of looking for these and other persisted bakes in the asset service.
Relates to http://opensimulator.org/mantis/view.php?id=6927
0.8.0.3
Justin Clark-Casey (justincc) 2014-02-24 19:20:50 +00:00
parent 0f03c64a0c
commit fd1b2a1c57
3 changed files with 70 additions and 38 deletions

View File

@ -460,7 +460,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
}
// m_log.DebugFormat(
// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
// face.TextureID, idx, client.Name, client.AgentId);
@ -474,16 +473,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
defonly = false; // found a non-default texture reference
if (cache != null)
{
if (!cache.Check(face.TextureID.ToString()))
return false;
}
else
{
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
return false;
}
if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
return false;
}
// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
@ -519,36 +510,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (missingTexturesOnly)
{
if (cache != null)
if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
{
if (cache.Check(face.TextureID.ToString()))
continue;
else
{
m_log.DebugFormat(
"[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
face.TextureID, idx, sp.Name);
}
continue;
}
else
{
if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
{
continue;
}
else
{
// On inter-simulator teleports, this occurs if baked textures are not being stored by the
// grid asset service (which means that they are not available to the new region and so have
// to be re-requested from the client).
//
// The only available core OpenSimulator behaviour right now
// is not to store these textures, temporarily or otherwise.
m_log.DebugFormat(
"[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
face.TextureID, idx, sp.Name);
}
// On inter-simulator teleports, this occurs if baked textures are not being stored by the
// grid asset service (which means that they are not available to the new region and so have
// to be re-requested from the client).
//
// The only available core OpenSimulator behaviour right now
// is not to store these textures, temporarily or otherwise.
m_log.DebugFormat(
"[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
face.TextureID, idx, sp.Name);
}
}
else

View File

@ -116,5 +116,58 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
Assert.That(eyesBake.Local, Is.False);
*/
}
/// <summary>
/// Test appearance setting where the baked texture UUID are library alpha textures.
/// </summary>
/// <remarks>
/// For a mesh avatar, it appears these 'baked textures' are used. So these should not trigger a request to
/// rebake.
/// </remarks>
[Test]
public void TestSetAppearanceAlphaBakedTextures()
{
TestHelpers.InMethod();
TestHelpers.EnableLogging();
UUID userId = TestHelpers.ParseTail(0x1);
UUID alphaTextureID = new UUID("3a367d1c-bef1-6d43-7595-e88c1e3aadb3");
// We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly
// to the AssetService, which will then store temporary and local assets permanently
CoreAssetCache assetCache = new CoreAssetCache();
AvatarFactoryModule afm = new AvatarFactoryModule();
TestScene scene = new SceneHelpers(assetCache).SetupScene();
SceneHelpers.SetupSceneModules(scene, afm);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
AssetBase libraryAsset;
libraryAsset
= new AssetBase(
alphaTextureID, "Default Alpha Layer Texturee", (sbyte)AssetType.Texture, userId.ToString());
libraryAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet
libraryAsset.Temporary = false;
libraryAsset.Local = false;
scene.AssetService.Store(libraryAsset);
byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
for (byte i = 0; i < visualParams.Length; i++)
visualParams[i] = i;
Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
int rebakeRequestsReceived = 0;
((TestClient)sp.ControllingClient).OnReceivedSendRebakeAvatarTextures += id => rebakeRequestsReceived++;
// This is the alpha texture
eyesFace.TextureID = alphaTextureID;
afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
Assert.That(rebakeRequestsReceived, Is.EqualTo(0));
}
}
}
}

View File

@ -63,6 +63,7 @@ namespace OpenSim.Tests.Common.Mock
public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour;
public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport;
public event Action<GridInstantMessage> OnReceivedInstantMessage;
public event Action<UUID> OnReceivedSendRebakeAvatarTextures;
public delegate void TestClientOnSendRegionTeleportDelegate(
ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@ -1227,6 +1228,8 @@ namespace OpenSim.Tests.Common.Mock
public void SendRebakeAvatarTextures(UUID textureID)
{
if (OnReceivedSendRebakeAvatarTextures != null)
OnReceivedSendRebakeAvatarTextures(textureID);
}
public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)