aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs55
2 files changed, 67 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