aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-02-24 19:20:50 +0000
committerJustin Clark-Casey (justincc)2014-02-24 19:20:50 +0000
commitfd1b2a1c574a3397383a91279d56cece81945547 (patch)
tree6495d78f4904a835805b0177dbea87960cd93ee4
parentMake Scene.DefaultDrawDistance to be the max of the region size and the (diff)
downloadopensim-SC-fd1b2a1c574a3397383a91279d56cece81945547.zip
opensim-SC-fd1b2a1c574a3397383a91279d56cece81945547.tar.gz
opensim-SC-fd1b2a1c574a3397383a91279d56cece81945547.tar.bz2
opensim-SC-fd1b2a1c574a3397383a91279d56cece81945547.tar.xz
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
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs55
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs3
3 files changed, 70 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index cdad729..856c4e1 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -460,7 +460,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
460 } 460 }
461 } 461 }
462 462
463
464// m_log.DebugFormat( 463// m_log.DebugFormat(
465// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", 464// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
466// face.TextureID, idx, client.Name, client.AgentId); 465// face.TextureID, idx, client.Name, client.AgentId);
@@ -474,16 +473,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
474 473
475 defonly = false; // found a non-default texture reference 474 defonly = false; // found a non-default texture reference
476 475
477 if (cache != null) 476 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
478 { 477 return false;
479 if (!cache.Check(face.TextureID.ToString()))
480 return false;
481 }
482 else
483 {
484 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
485 return false;
486 }
487 } 478 }
488 479
489// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID); 480// m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0} {1}", sp.Name, sp.UUID);
@@ -519,36 +510,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
519 510
520 if (missingTexturesOnly) 511 if (missingTexturesOnly)
521 { 512 {
522 if (cache != null) 513 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
523 { 514 {
524 if (cache.Check(face.TextureID.ToString())) 515 continue;
525 continue;
526 else
527 {
528 m_log.DebugFormat(
529 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
530 face.TextureID, idx, sp.Name);
531 }
532 } 516 }
533 else 517 else
534 { 518 {
535 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) 519 // On inter-simulator teleports, this occurs if baked textures are not being stored by the
536 { 520 // grid asset service (which means that they are not available to the new region and so have
537 continue; 521 // to be re-requested from the client).
538 } 522 //
539 523 // The only available core OpenSimulator behaviour right now
540 else 524 // is not to store these textures, temporarily or otherwise.
541 { 525 m_log.DebugFormat(
542 // On inter-simulator teleports, this occurs if baked textures are not being stored by the 526 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
543 // grid asset service (which means that they are not available to the new region and so have 527 face.TextureID, idx, sp.Name);
544 // to be re-requested from the client).
545 //
546 // The only available core OpenSimulator behaviour right now
547 // is not to store these textures, temporarily or otherwise.
548 m_log.DebugFormat(
549 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
550 face.TextureID, idx, sp.Name);
551 }
552 } 528 }
553 } 529 }
554 else 530 else
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index ff4c6c9..2019726 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -116,5 +116,58 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
116 Assert.That(eyesBake.Local, Is.False); 116 Assert.That(eyesBake.Local, Is.False);
117*/ 117*/
118 } 118 }
119
120 /// <summary>
121 /// Test appearance setting where the baked texture UUID are library alpha textures.
122 /// </summary>
123 /// <remarks>
124 /// For a mesh avatar, it appears these 'baked textures' are used. So these should not trigger a request to
125 /// rebake.
126 /// </remarks>
127 [Test]
128 public void TestSetAppearanceAlphaBakedTextures()
129 {
130 TestHelpers.InMethod();
131 TestHelpers.EnableLogging();
132
133 UUID userId = TestHelpers.ParseTail(0x1);
134 UUID alphaTextureID = new UUID("3a367d1c-bef1-6d43-7595-e88c1e3aadb3");
135
136
137 // We need an asset cache because otherwise the LocalAssetServiceConnector will short-circuit directly
138 // to the AssetService, which will then store temporary and local assets permanently
139 CoreAssetCache assetCache = new CoreAssetCache();
140
141 AvatarFactoryModule afm = new AvatarFactoryModule();
142 TestScene scene = new SceneHelpers(assetCache).SetupScene();
143 SceneHelpers.SetupSceneModules(scene, afm);
144 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
145
146 AssetBase libraryAsset;
147 libraryAsset
148 = new AssetBase(
149 alphaTextureID, "Default Alpha Layer Texturee", (sbyte)AssetType.Texture, userId.ToString());
150 libraryAsset.Data = new byte[] { 2 }; // Not necessary to have a genuine JPEG2000 asset here yet
151 libraryAsset.Temporary = false;
152 libraryAsset.Local = false;
153 scene.AssetService.Store(libraryAsset);
154
155 byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
156 for (byte i = 0; i < visualParams.Length; i++)
157 visualParams[i] = i;
158
159 Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
160 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
161 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
162
163 int rebakeRequestsReceived = 0;
164 ((TestClient)sp.ControllingClient).OnReceivedSendRebakeAvatarTextures += id => rebakeRequestsReceived++;
165
166 // This is the alpha texture
167 eyesFace.TextureID = alphaTextureID;
168 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
169
170 Assert.That(rebakeRequestsReceived, Is.EqualTo(0));
171 }
119 } 172 }
120} 173} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index a4247e3..09ff531 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -63,6 +63,7 @@ namespace OpenSim.Tests.Common.Mock
63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; 63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour;
64 public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; 64 public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport;
65 public event Action<GridInstantMessage> OnReceivedInstantMessage; 65 public event Action<GridInstantMessage> OnReceivedInstantMessage;
66 public event Action<UUID> OnReceivedSendRebakeAvatarTextures;
66 67
67 public delegate void TestClientOnSendRegionTeleportDelegate( 68 public delegate void TestClientOnSendRegionTeleportDelegate(
68 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 69 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@@ -1227,6 +1228,8 @@ namespace OpenSim.Tests.Common.Mock
1227 1228
1228 public void SendRebakeAvatarTextures(UUID textureID) 1229 public void SendRebakeAvatarTextures(UUID textureID)
1229 { 1230 {
1231 if (OnReceivedSendRebakeAvatarTextures != null)
1232 OnReceivedSendRebakeAvatarTextures(textureID);
1230 } 1233 }
1231 1234
1232 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages) 1235 public void SendAvatarInterestsReply(UUID avatarID, uint wantMask, string wantText, uint skillsMask, string skillsText, string languages)