diff options
author | Justin Clark-Casey (justincc) | 2014-02-24 19:20:50 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-02-24 19:20:50 +0000 |
commit | fd1b2a1c574a3397383a91279d56cece81945547 (patch) | |
tree | 6495d78f4904a835805b0177dbea87960cd93ee4 /OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests | |
parent | Make Scene.DefaultDrawDistance to be the max of the region size and the (diff) | |
download | opensim-SC_OLD-fd1b2a1c574a3397383a91279d56cece81945547.zip opensim-SC_OLD-fd1b2a1c574a3397383a91279d56cece81945547.tar.gz opensim-SC_OLD-fd1b2a1c574a3397383a91279d56cece81945547.tar.bz2 opensim-SC_OLD-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
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs | 55 |
1 files changed, 54 insertions, 1 deletions
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 |