aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/AgentCircuitData.cs
diff options
context:
space:
mode:
authorMaster ScienceSim2010-10-20 16:17:54 -0700
committerMaster ScienceSim2010-10-20 16:17:54 -0700
commitb1c8d0588829dfa76f89460eeb8406d9c4fc479f (patch)
tree463cbb0bf2eab5c7e7f98ebdc0dc7113dea56688 /OpenSim/Framework/AgentCircuitData.cs
parentMerge branch 'master' of /var/git/opensim/ (diff)
downloadopensim-SC_OLD-b1c8d0588829dfa76f89460eeb8406d9c4fc479f.zip
opensim-SC_OLD-b1c8d0588829dfa76f89460eeb8406d9c4fc479f.tar.gz
opensim-SC_OLD-b1c8d0588829dfa76f89460eeb8406d9c4fc479f.tar.bz2
opensim-SC_OLD-b1c8d0588829dfa76f89460eeb8406d9c4fc479f.tar.xz
Major refactoring of appearance handling.
AvatarService -- add two new methods, GetAppearance and SetAppearance to get around the lossy encoding in AvatarData. Preseve the old functions to avoid changing the behavior for ROBUST services. AvatarAppearance -- major refactor, moved the various encoding methods used by AgentCircuitData, ClientAgentUpdate and ScenePresence into one location. Changed initialization. AvatarAttachments -- added a class specifically to handle attachments in preparation for additional functionality that will be needed for viewer 2. AvatarFactory -- removed a number of unused or methods duplicated in other locations. Moved in all appearance event handling from ScenePresence. Required a change to IClientAPI that propogated throughout all the IClientAPI implementations.
Diffstat (limited to 'OpenSim/Framework/AgentCircuitData.cs')
-rw-r--r--OpenSim/Framework/AgentCircuitData.cs61
1 files changed, 52 insertions, 9 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs
index 4f89d78..be98380 100644
--- a/OpenSim/Framework/AgentCircuitData.cs
+++ b/OpenSim/Framework/AgentCircuitData.cs
@@ -26,7 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using System.Collections.Generic; 30using System.Collections.Generic;
31using log4net;
30using OpenMetaverse; 32using OpenMetaverse;
31using OpenMetaverse.StructuredData; 33using OpenMetaverse.StructuredData;
32 34
@@ -38,6 +40,12 @@ namespace OpenSim.Framework
38 /// </summary> 40 /// </summary>
39 public class AgentCircuitData 41 public class AgentCircuitData
40 { 42 {
43// DEBUG ON
44 private static readonly ILog m_log =
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47// DEBUG OFF
48
41 /// <summary> 49 /// <summary>
42 /// Avatar Unique Agent Identifier 50 /// Avatar Unique Agent Identifier
43 /// </summary> 51 /// </summary>
@@ -205,6 +213,7 @@ namespace OpenSim.Framework
205 args["mac"] = OSD.FromString(Mac); 213 args["mac"] = OSD.FromString(Mac);
206 args["id0"] = OSD.FromString(Id0); 214 args["id0"] = OSD.FromString(Id0);
207 215
216/*
208 if (Appearance != null) 217 if (Appearance != null)
209 { 218 {
210 //System.Console.WriteLine("XXX Before packing Wearables"); 219 //System.Console.WriteLine("XXX Before packing Wearables");
@@ -221,20 +230,26 @@ namespace OpenSim.Framework
221 } 230 }
222 231
223 //System.Console.WriteLine("XXX Before packing Attachments"); 232 //System.Console.WriteLine("XXX Before packing Attachments");
224 Dictionary<int, UUID[]> attachments = Appearance.GetAttachmentDictionary(); 233 Dictionary<int, AvatarAttachment> attachments = Appearance.Attachments;
225 if ((attachments != null) && (attachments.Count > 0)) 234 if ((attachments != null) && (attachments.Count > 0))
226 { 235 {
227 OSDArray attachs = new OSDArray(attachments.Count); 236 OSDArray attachs = new OSDArray(attachments.Count);
228 foreach (KeyValuePair<int, UUID[]> kvp in attachments) 237 foreach (KeyValuePair<int, AvatarAttachment> kvp in attachments)
229 { 238 {
230 AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]); 239 AvatarAttachment adata = new AvatarAttachment(kvp.Value);
231 attachs.Add(adata.PackUpdateMessage()); 240 attachs.Add(adata.Pack());
232 //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); 241 //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]);
233 } 242 }
234 args["attachments"] = attachs; 243 args["attachments"] = attachs;
235 } 244 }
236 } 245 }
237 246*/
247 if (Appearance != null)
248 {
249 OSDMap appmap = Appearance.Pack();
250 args["packed_appearance"] = appmap;
251 }
252
238 if (ServiceURLs != null && ServiceURLs.Count > 0) 253 if (ServiceURLs != null && ServiceURLs.Count > 0)
239 { 254 {
240 OSDArray urls = new OSDArray(ServiceURLs.Count * 2); 255 OSDArray urls = new OSDArray(ServiceURLs.Count * 2);
@@ -317,9 +332,37 @@ namespace OpenSim.Framework
317 if (args["start_pos"] != null) 332 if (args["start_pos"] != null)
318 Vector3.TryParse(args["start_pos"].AsString(), out startpos); 333 Vector3.TryParse(args["start_pos"].AsString(), out startpos);
319 334
335// DEBUG ON
336 m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
337// DEBUG OFF
338
339 try {
340 // Unpack various appearance elements
320 Appearance = new AvatarAppearance(AgentID); 341 Appearance = new AvatarAppearance(AgentID);
342 if (args["packed_appearance"] != null)
343 {
344 if (args["packed_appearance"].Type == OSDType.Map)
345 {
346 Appearance.Unpack((OSDMap)args["packed_appearance"]);
347 m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance");
348 }
349 else
350 m_log.WarnFormat("[AGENTCIRCUITDATA] packed_appearance is not a map:\n{0}",args["packed_appearance"].ToString());
351 }
352// DEBUG ON
353 else
354 m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
355// DEBUG OFF
356 } catch (Exception e)
357 {
358 m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message);
359 }
360
361
362/*
321 if (args["appearance_serial"] != null) 363 if (args["appearance_serial"] != null)
322 Appearance.Serial = args["appearance_serial"].AsInteger(); 364 Appearance.Serial = args["appearance_serial"].AsInteger();
365
323 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) 366 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
324 { 367 {
325 OSDArray wears = (OSDArray)(args["wearables"]); 368 OSDArray wears = (OSDArray)(args["wearables"]);
@@ -328,23 +371,23 @@ namespace OpenSim.Framework
328 Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); 371 Appearance.Wearables[i].ItemID = wears[i*2].AsUUID();
329 Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); 372 Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID();
330 } 373 }
331 } 374 }
332 375
333 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 376 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
334 { 377 {
335 OSDArray attachs = (OSDArray)(args["attachments"]); 378 OSDArray attachs = (OSDArray)(args["attachments"]);
336 AttachmentData[] attachments = new AttachmentData[attachs.Count]; 379 AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count];
337 int i = 0; 380 int i = 0;
338 foreach (OSD o in attachs) 381 foreach (OSD o in attachs)
339 { 382 {
340 if (o.Type == OSDType.Map) 383 if (o.Type == OSDType.Map)
341 { 384 {
342 attachments[i++] = new AttachmentData((OSDMap)o); 385 attachments[i++] = new AvatarAttachment((OSDMap)o);
343 } 386 }
344 } 387 }
345 Appearance.SetAttachments(attachments); 388 Appearance.SetAttachments(attachments);
346 } 389 }
347 390*/
348 ServiceURLs = new Dictionary<string, object>(); 391 ServiceURLs = new Dictionary<string, object>();
349 if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) 392 if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
350 { 393 {