diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 4f89d78..640a646 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | 33 | using 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> |
@@ -198,15 +206,18 @@ namespace OpenSim.Framework | |||
198 | 206 | ||
199 | args["service_session_id"] = OSD.FromString(ServiceSessionID); | 207 | args["service_session_id"] = OSD.FromString(ServiceSessionID); |
200 | args["start_pos"] = OSD.FromString(startpos.ToString()); | 208 | args["start_pos"] = OSD.FromString(startpos.ToString()); |
201 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); | ||
202 | args["client_ip"] = OSD.FromString(IPAddress); | 209 | args["client_ip"] = OSD.FromString(IPAddress); |
203 | args["viewer"] = OSD.FromString(Viewer); | 210 | args["viewer"] = OSD.FromString(Viewer); |
204 | args["channel"] = OSD.FromString(Channel); | 211 | args["channel"] = OSD.FromString(Channel); |
205 | args["mac"] = OSD.FromString(Mac); | 212 | args["mac"] = OSD.FromString(Mac); |
206 | args["id0"] = OSD.FromString(Id0); | 213 | args["id0"] = OSD.FromString(Id0); |
207 | 214 | ||
215 | // Eventually this code should be deprecated, use full appearance | ||
216 | // packing in packed_appearance | ||
208 | if (Appearance != null) | 217 | if (Appearance != null) |
209 | { | 218 | { |
219 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); | ||
220 | |||
210 | //System.Console.WriteLine("XXX Before packing Wearables"); | 221 | //System.Console.WriteLine("XXX Before packing Wearables"); |
211 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) | 222 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) |
212 | { | 223 | { |
@@ -221,20 +232,25 @@ namespace OpenSim.Framework | |||
221 | } | 232 | } |
222 | 233 | ||
223 | //System.Console.WriteLine("XXX Before packing Attachments"); | 234 | //System.Console.WriteLine("XXX Before packing Attachments"); |
224 | Dictionary<int, UUID[]> attachments = Appearance.GetAttachmentDictionary(); | 235 | List<AvatarAttachment> attachments = Appearance.GetAttachments(); |
225 | if ((attachments != null) && (attachments.Count > 0)) | 236 | if ((attachments != null) && (attachments.Count > 0)) |
226 | { | 237 | { |
227 | OSDArray attachs = new OSDArray(attachments.Count); | 238 | OSDArray attachs = new OSDArray(attachments.Count); |
228 | foreach (KeyValuePair<int, UUID[]> kvp in attachments) | 239 | foreach (AvatarAttachment attach in attachments) |
229 | { | 240 | { |
230 | AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]); | 241 | attachs.Add(attach.Pack()); |
231 | attachs.Add(adata.PackUpdateMessage()); | ||
232 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); | 242 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); |
233 | } | 243 | } |
234 | args["attachments"] = attachs; | 244 | args["attachments"] = attachs; |
235 | } | 245 | } |
236 | } | 246 | } |
237 | 247 | ||
248 | if (Appearance != null) | ||
249 | { | ||
250 | OSDMap appmap = Appearance.Pack(); | ||
251 | args["packed_appearance"] = appmap; | ||
252 | } | ||
253 | |||
238 | if (ServiceURLs != null && ServiceURLs.Count > 0) | 254 | if (ServiceURLs != null && ServiceURLs.Count > 0) |
239 | { | 255 | { |
240 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); | 256 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); |
@@ -317,34 +333,57 @@ namespace OpenSim.Framework | |||
317 | if (args["start_pos"] != null) | 333 | if (args["start_pos"] != null) |
318 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); | 334 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); |
319 | 335 | ||
336 | // DEBUG ON | ||
337 | m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); | ||
338 | // DEBUG OFF | ||
339 | |||
340 | try { | ||
341 | // Unpack various appearance elements | ||
320 | Appearance = new AvatarAppearance(AgentID); | 342 | Appearance = new AvatarAppearance(AgentID); |
343 | |||
344 | // Eventually this code should be deprecated, use full appearance | ||
345 | // packing in packed_appearance | ||
321 | if (args["appearance_serial"] != null) | 346 | if (args["appearance_serial"] != null) |
322 | Appearance.Serial = args["appearance_serial"].AsInteger(); | 347 | Appearance.Serial = args["appearance_serial"].AsInteger(); |
348 | |||
323 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 349 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
324 | { | 350 | { |
325 | OSDArray wears = (OSDArray)(args["wearables"]); | 351 | OSDArray wears = (OSDArray)(args["wearables"]); |
326 | for (int i = 0; i < wears.Count / 2; i++) | 352 | for (int i = 0; i < wears.Count / 2; i++) |
327 | { | 353 | { |
328 | Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); | 354 | AvatarWearable awear = new AvatarWearable(wears[i*2].AsUUID(),wears[(i*2)+1].AsUUID()); |
329 | Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); | 355 | Appearance.SetWearable(i,awear); |
330 | } | 356 | } |
331 | } | 357 | } |
332 | 358 | ||
333 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | 359 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) |
334 | { | 360 | { |
335 | OSDArray attachs = (OSDArray)(args["attachments"]); | 361 | OSDArray attachs = (OSDArray)(args["attachments"]); |
336 | AttachmentData[] attachments = new AttachmentData[attachs.Count]; | ||
337 | int i = 0; | ||
338 | foreach (OSD o in attachs) | 362 | foreach (OSD o in attachs) |
339 | { | 363 | { |
340 | if (o.Type == OSDType.Map) | 364 | if (o.Type == OSDType.Map) |
341 | { | 365 | { |
342 | attachments[i++] = new AttachmentData((OSDMap)o); | 366 | Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); |
343 | } | 367 | } |
344 | } | 368 | } |
345 | Appearance.SetAttachments(attachments); | ||
346 | } | 369 | } |
347 | 370 | ||
371 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) | ||
372 | { | ||
373 | Appearance.Unpack((OSDMap)args["packed_appearance"]); | ||
374 | // DEBUG ON | ||
375 | m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); | ||
376 | // DEBUG OFF | ||
377 | } | ||
378 | // DEBUG ON | ||
379 | else | ||
380 | m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); | ||
381 | // DEBUG OFF | ||
382 | } catch (Exception e) | ||
383 | { | ||
384 | m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); | ||
385 | } | ||
386 | |||
348 | ServiceURLs = new Dictionary<string, object>(); | 387 | ServiceURLs = new Dictionary<string, object>(); |
349 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | 388 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) |
350 | { | 389 | { |