29 using System.Collections.Generic;
31 using NUnit.Framework;
33 using OpenSim.Framework;
34 using OpenSim.Region.CoreModules.Asset;
35 using OpenSim.Region.Framework.Scenes;
36 using OpenSim.Tests.Common;
38 namespace OpenSim.
Region.CoreModules.
Avatar.AvatarFactory
49 TestHelpers.InMethod();
52 UUID userId = TestHelpers.ParseTail(0x1);
53 UUID bakedTextureID = TestHelpers.ParseTail(0x2);
61 SceneHelpers.SetupSceneModules(scene, afm);
62 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
68 bakedTextureID,
"Test Baked Texture", (sbyte)AssetType.Texture, userId.ToString());
69 bakedTextureAsset.Data =
new byte[] { 2 };
70 bakedTextureAsset.Temporary =
true;
71 bakedTextureAsset.Local =
true;
72 scene.AssetService.Store(bakedTextureAsset);
74 byte[] visualParams =
new byte[AvatarAppearance.VISUALPARAM_COUNT];
75 for (byte i = 0; i < visualParams.Length; i++)
78 Primitive.TextureEntry bakedTextureEntry =
new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
79 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
80 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
82 int rebakeRequestsReceived = 0;
83 ((
TestClient)sp.ControllingClient).OnReceivedSendRebakeAvatarTextures +=
id => rebakeRequestsReceived++;
86 eyesFace.TextureID = bakedTextureID;
87 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
89 Assert.That(rebakeRequestsReceived, Is.EqualTo(0));
91 AssetBase eyesBake = scene.AssetService.Get(bakedTextureID.ToString());
92 Assert.That(eyesBake, Is.Not.Null);
93 Assert.That(eyesBake.Temporary, Is.True);
94 Assert.That(eyesBake.Local, Is.True);
107 TestHelpers.InMethod();
110 UUID userId = TestHelpers.ParseTail(0x1);
111 UUID alphaTextureID =
new UUID(
"3a367d1c-bef1-6d43-7595-e88c1e3aadb3");
119 SceneHelpers.SetupSceneModules(scene, afm);
120 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
125 alphaTextureID,
"Default Alpha Layer Texture", (sbyte)AssetType.Texture, userId.ToString());
126 libraryAsset.Data =
new byte[] { 2 };
127 libraryAsset.Temporary =
false;
128 libraryAsset.Local =
false;
129 scene.AssetService.Store(libraryAsset);
131 byte[] visualParams =
new byte[AvatarAppearance.VISUALPARAM_COUNT];
132 for (byte i = 0; i < visualParams.Length; i++)
135 Primitive.TextureEntry bakedTextureEntry =
new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
136 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
137 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
139 int rebakeRequestsReceived = 0;
140 ((
TestClient)sp.ControllingClient).OnReceivedSendRebakeAvatarTextures +=
id => rebakeRequestsReceived++;
143 eyesFace.TextureID = alphaTextureID;
144 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
146 Assert.That(rebakeRequestsReceived, Is.EqualTo(0));
152 TestHelpers.InMethod();
155 UUID userId = TestHelpers.ParseTail(0x1);
156 UUID eyesTextureId = TestHelpers.ParseTail(0x2);
164 SceneHelpers.SetupSceneModules(scene, afm);
165 ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId);
169 uploadedAsset =
new AssetBase(eyesTextureId,
"Baked Texture", (sbyte)AssetType.Texture, userId.ToString());
170 uploadedAsset.Data =
new byte[] { 2 };
171 uploadedAsset.Temporary =
true;
172 uploadedAsset.Local =
true;
173 scene.AssetService.Store(uploadedAsset);
175 byte[] visualParams =
new byte[AvatarAppearance.VISUALPARAM_COUNT];
176 for (byte i = 0; i < visualParams.Length; i++)
179 Primitive.TextureEntry bakedTextureEntry =
new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
180 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
181 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
182 eyesFace.TextureID = eyesTextureId;
184 afm.SetAppearance(sp, bakedTextureEntry, visualParams,
new WearableCacheItem[0]);
185 afm.SaveBakedTextures(userId);
191 AssetBase eyesBake = scene.AssetService.Get(eyesTextureId.ToString());
192 Assert.That(eyesBake, Is.Not.Null);
193 Assert.That(eyesBake.Temporary, Is.False);
194 Assert.That(eyesBake.Local, Is.False);
void TestSaveBakedTextures()
void TestSetAppearance()
Only partial right now since we don't yet test that it's ended up in the avatar appearance service...
Asset class. All Assets are reference by this class or a class derived from this class ...
void TestSetAppearanceAlphaBakedTextures()
Test appearance setting where the baked texture UUID are library alpha textures.
Helpers for setting up scenes.