aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/ChildAgentDataUpdate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/ChildAgentDataUpdate.cs')
-rw-r--r--OpenSim/Framework/ChildAgentDataUpdate.cs98
1 files changed, 68 insertions, 30 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index fdebba3..66487f7 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenMetaverse.StructuredData; 34using OpenMetaverse.StructuredData;
33 35
@@ -310,6 +312,12 @@ namespace OpenSim.Framework
310 // Appearance 312 // Appearance
311 public AvatarAppearance Appearance; 313 public AvatarAppearance Appearance;
312 314
315// DEBUG ON
316 private static readonly ILog m_log =
317 LogManager.GetLogger(
318 MethodBase.GetCurrentMethod().DeclaringType);
319// DEBUG OFF
320
313/* 321/*
314 public byte[] AgentTextures; 322 public byte[] AgentTextures;
315 public byte[] VisualParams; 323 public byte[] VisualParams;
@@ -323,6 +331,10 @@ namespace OpenSim.Framework
323 331
324 public virtual OSDMap Pack() 332 public virtual OSDMap Pack()
325 { 333 {
334// DEBUG ON
335 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data");
336// DEBUG OFF
337
326 OSDMap args = new OSDMap(); 338 OSDMap args = new OSDMap();
327 args["message_type"] = OSD.FromString("AgentData"); 339 args["message_type"] = OSD.FromString("AgentData");
328 340
@@ -387,31 +399,40 @@ namespace OpenSim.Framework
387 // args["agent_textures"] = textures; 399 // args["agent_textures"] = textures;
388 //} 400 //}
389 401
390/* 402 // The code to pack textures, visuals, wearables and attachments
391 if ((AgentTextures != null) && (AgentTextures.Length > 0)) 403 // should be removed; packed appearance contains the full appearance
392 args["texture_entry"] = OSD.FromBinary(AgentTextures); 404 // This is retained for backward compatibility only
405 if (Appearance.Texture != null)
406 {
407 byte[] rawtextures = Appearance.Texture.GetBytes();
408 args["texture_entry"] = OSD.FromBinary(rawtextures);
409 }
393 410
394 if ((VisualParams != null) && (VisualParams.Length > 0)) 411 if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0))
395 args["visual_params"] = OSD.FromBinary(VisualParams); 412 args["visual_params"] = OSD.FromBinary(Appearance.VisualParams);
396 413
397 // We might not pass this in all cases... 414 // We might not pass this in all cases...
398 if ((Wearables != null) && (Wearables.Length > 0)) 415 if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
399 { 416 {
400 OSDArray wears = new OSDArray(Wearables.Length); 417 OSDArray wears = new OSDArray(Appearance.Wearables.Length * 2);
401 foreach (UUID uuid in Wearables) 418 foreach (AvatarWearable awear in Appearance.Wearables)
402 wears.Add(OSD.FromUUID(uuid)); 419 {
420 wears.Add(OSD.FromUUID(awear.ItemID));
421 wears.Add(OSD.FromUUID(awear.AssetID));
422 }
403 args["wearables"] = wears; 423 args["wearables"] = wears;
404 } 424 }
405 425
406 426 List<AvatarAttachment> attachments = Appearance.GetAttachments();
407 if ((Attachments != null) && (Attachments.Length > 0)) 427 if ((attachments != null) && (attachments.Count > 0))
408 { 428 {
409 OSDArray attachs = new OSDArray(Attachments.Length); 429 OSDArray attachs = new OSDArray(attachments.Count);
410 foreach (AvatarAttachment att in Attachments) 430 foreach (AvatarAttachment att in attachments)
411 attachs.Add(att.Pack()); 431 attachs.Add(att.Pack());
412 args["attachments"] = attachs; 432 args["attachments"] = attachs;
413 } 433 }
414*/ 434 // End of code to remove
435
415 if ((Controllers != null) && (Controllers.Length > 0)) 436 if ((Controllers != null) && (Controllers.Length > 0))
416 { 437 {
417 OSDArray controls = new OSDArray(Controllers.Length); 438 OSDArray controls = new OSDArray(Controllers.Length);
@@ -435,6 +456,10 @@ namespace OpenSim.Framework
435 /// <param name="hash"></param> 456 /// <param name="hash"></param>
436 public virtual void Unpack(OSDMap args) 457 public virtual void Unpack(OSDMap args)
437 { 458 {
459// DEBUG ON
460 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Unpack data");
461// DEBUG OFF
462
438 if (args.ContainsKey("region_id")) 463 if (args.ContainsKey("region_id"))
439 UUID.TryParse(args["region_id"].AsString(), out RegionID); 464 UUID.TryParse(args["region_id"].AsString(), out RegionID);
440 465
@@ -547,41 +572,54 @@ namespace OpenSim.Framework
547 // AgentTextures[i++] = o.AsUUID(); 572 // AgentTextures[i++] = o.AsUUID();
548 //} 573 //}
549 574
550 if (args["packed_appearance"] != null) 575 Appearance = new AvatarAppearance(AgentID);
551 Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); 576
552 else 577 // The code to unpack textures, visuals, wearables and attachments
553 Appearance = new AvatarAppearance(AgentID); 578 // should be removed; packed appearance contains the full appearance
554 579 // This is retained for backward compatibility only
555/*
556 if (args["texture_entry"] != null) 580 if (args["texture_entry"] != null)
557 AgentTextures = args["texture_entry"].AsBinary(); 581 {
582 byte[] rawtextures = args["texture_entry"].AsBinary();
583 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length);
584 Appearance.SetTextureEntries(textures);
585 }
558 586
559 if (args["visual_params"] != null) 587 if (args["visual_params"] != null)
560 VisualParams = args["visual_params"].AsBinary(); 588 Appearance.SetVisualParams(args["visual_params"].AsBinary());
561 589
562 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) 590 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
563 { 591 {
564 OSDArray wears = (OSDArray)(args["wearables"]); 592 OSDArray wears = (OSDArray)(args["wearables"]);
565 Wearables = new UUID[wears.Count]; 593 for (int i = 0; i < wears.Count / 2; i++)
566 int i = 0; 594 {
567 foreach (OSD o in wears) 595 AvatarWearable awear = new AvatarWearable(wears[i*2].AsUUID(),wears[(i*2)+1].AsUUID());
568 Wearables[i++] = o.AsUUID(); 596 Appearance.SetWearable(i,awear);
597 }
569 } 598 }
570 599
571 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 600 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
572 { 601 {
573 OSDArray attachs = (OSDArray)(args["attachments"]); 602 OSDArray attachs = (OSDArray)(args["attachments"]);
574 Attachments = new AvatarAttachment[attachs.Count];
575 int i = 0;
576 foreach (OSD o in attachs) 603 foreach (OSD o in attachs)
577 { 604 {
578 if (o.Type == OSDType.Map) 605 if (o.Type == OSDType.Map)
579 { 606 {
580 Attachments[i++] = new AvatarAttachment((OSDMap)o); 607 // We know all of these must end up as attachments so we
608 // append rather than replace to ensure multiple attachments
609 // per point continues to work
610 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
581 } 611 }
582 } 612 }
583 } 613 }
584*/ 614 // end of code to remove
615
616 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
617 Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
618// DEBUG ON
619 else
620 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
621// DEBUG OFF
622
585 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) 623 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
586 { 624 {
587 OSDArray controls = (OSDArray)(args["controllers"]); 625 OSDArray controls = (OSDArray)(args["controllers"]);