aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs (renamed from OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs)41
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs2
3 files changed, 53 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index e92f072..1955e5b 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -116,16 +116,20 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
116 #endregion 116 #endregion
117 117
118 /// <summary> 118 /// <summary>
119 /// Check for the existence of the baked texture assets. Request a rebake 119 /// Check for the existence of the baked texture assets.
120 /// unless checkonly is true.
121 /// </summary> 120 /// </summary>
122 /// <param name="client"></param> 121 /// <param name="client"></param>
123 /// <param name="checkonly"></param>
124 public bool ValidateBakedTextureCache(IClientAPI client) 122 public bool ValidateBakedTextureCache(IClientAPI client)
125 { 123 {
126 return ValidateBakedTextureCache(client, true); 124 return ValidateBakedTextureCache(client, true);
127 } 125 }
128 126
127 /// <summary>
128 /// Check for the existence of the baked texture assets. Request a rebake
129 /// unless checkonly is true.
130 /// </summary>
131 /// <param name="client"></param>
132 /// <param name="checkonly"></param>
129 private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly) 133 private bool ValidateBakedTextureCache(IClientAPI client, bool checkonly)
130 { 134 {
131 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 135 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
@@ -156,18 +160,20 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
156 160
157 defonly = false; // found a non-default texture reference 161 defonly = false; // found a non-default texture reference
158 162
159 if (! CheckBakedTextureAsset(client,face.TextureID,idx)) 163 if (!CheckBakedTextureAsset(client, face.TextureID, idx))
160 { 164 {
161 // the asset didn't exist if we are only checking, then we found a bad 165 // the asset didn't exist if we are only checking, then we found a bad
162 // one and we're done otherwise, ask for a rebake 166 // one and we're done otherwise, ask for a rebake
163 if (checkonly) return false; 167 if (checkonly)
168 return false;
164 169
165 m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake",face.TextureID); 170 m_log.InfoFormat("[AVFACTORY]: missing baked texture {0}, requesting rebake", face.TextureID);
171
166 client.SendRebakeAvatarTextures(face.TextureID); 172 client.SendRebakeAvatarTextures(face.TextureID);
167 } 173 }
168 } 174 }
169 175
170 m_log.DebugFormat("[AVFACTORY]: completed texture check for {0}", client.AgentId); 176 m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", client.AgentId);
171 177
172 // If we only found default textures, then the appearance is not cached 178 // If we only found default textures, then the appearance is not cached
173 return (defonly ? false : true); 179 return (defonly ? false : true);
@@ -183,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
183 ScenePresence sp = m_scene.GetScenePresence(client.AgentId); 189 ScenePresence sp = m_scene.GetScenePresence(client.AgentId);
184 if (sp == null) 190 if (sp == null)
185 { 191 {
186 m_log.WarnFormat("[AVFACTORY]: SetAppearance unable to find presence for {0}",client.AgentId); 192 m_log.WarnFormat("[AVFACTORY]: SetAppearance unable to find presence for {0}", client.AgentId);
187 return; 193 return;
188 } 194 }
189 195
@@ -211,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
211 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 217 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
212 218
213 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", client.AgentId); 219 m_log.InfoFormat("[AVFACTORY]: received texture update for {0}", client.AgentId);
214 Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client,false); }); 220 Util.FireAndForget(delegate(object o) { ValidateBakedTextureCache(client, false); });
215 221
216 // This appears to be set only in the final stage of the appearance 222 // This appears to be set only in the final stage of the appearance
217 // update transaction. In theory, we should be able to do an immediate 223 // update transaction. In theory, we should be able to do an immediate
@@ -220,9 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
220 // save only if there were changes, send no matter what (doesn't hurt to send twice) 226 // save only if there were changes, send no matter what (doesn't hurt to send twice)
221 if (changed) 227 if (changed)
222 QueueAppearanceSave(client.AgentId); 228 QueueAppearanceSave(client.AgentId);
229
223 QueueAppearanceSend(client.AgentId); 230 QueueAppearanceSend(client.AgentId);
224 } 231 }
225
226 } 232 }
227 233
228 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString()); 234 // m_log.WarnFormat("[AVFACTORY]: complete SetAppearance for {0}:\n{1}",client.AgentId,sp.Appearance.ToString());
diff --git a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index cd2fe4f..07de908 100644
--- a/OpenSim/Region/CoreModules/Avatar/NPC/INPCModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -25,16 +25,45 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
29using NUnit.Framework;
28using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework;
29using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Tests.Common;
34using OpenSim.Tests.Common.Mock;
30 35
31namespace OpenSim.Region.CoreModules.Avatar.NPC 36namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
32{ 37{
33 public interface INPCModule 38 [TestFixture]
39 public class AvatarFactoryModuleTests
34 { 40 {
35 UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); 41 /// <summary>
36 void Autopilot(UUID agentID, Scene scene, Vector3 pos); 42 /// Only partial right now since we don't yet test that it's ended up in the avatar appearance service.
37 void Say(UUID agentID, Scene scene, string text); 43 /// </summary>
38 void DeleteNPC(UUID agentID, Scene scene); 44 [Test]
45 public void TestSetAppearance()
46 {
47 TestHelper.InMethod();
48// log4net.Config.XmlConfigurator.Configure();
49
50 UUID userId = TestHelper.ParseTail(0x1);
51
52 AvatarFactoryModule afm = new AvatarFactoryModule();
53 TestScene scene = SceneSetupHelpers.SetupScene();
54 SceneSetupHelpers.SetupSceneModules(scene, afm);
55 TestClient tc = SceneSetupHelpers.AddClient(scene, userId);
56
57 byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT];
58 for (byte i = 0; i < visualParams.Length; i++)
59 visualParams[i] = i;
60
61 afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelper.ParseTail(0x10)), visualParams);
62
63 ScenePresence sp = scene.GetScenePresence(userId);
64
65 // TODO: Check baked texture
66 Assert.AreEqual(visualParams, sp.Appearance.VisualParams);
67 }
39 } 68 }
40} \ No newline at end of file 69} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index daee4ca..3a7178c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -830,7 +830,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
830 830
831 public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) 831 public bool LocalStatusNotification(UUID userID, UUID friendID, bool online)
832 { 832 {
833 m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); 833// m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online);
834 IClientAPI friendClient = LocateClientObject(friendID); 834 IClientAPI friendClient = LocateClientObject(friendID);
835 if (friendClient != null) 835 if (friendClient != null)
836 { 836 {