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.cs83
1 files changed, 49 insertions, 34 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 5beb37d..91df64d 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -431,6 +431,8 @@ namespace OpenSim.Framework
431 // The code to pack textures, visuals, wearables and attachments 431 // The code to pack textures, visuals, wearables and attachments
432 // should be removed; packed appearance contains the full appearance 432 // should be removed; packed appearance contains the full appearance
433 // This is retained for backward compatibility only 433 // This is retained for backward compatibility only
434
435/* then lets remove
434 if (Appearance.Texture != null) 436 if (Appearance.Texture != null)
435 { 437 {
436 byte[] rawtextures = Appearance.Texture.GetBytes(); 438 byte[] rawtextures = Appearance.Texture.GetBytes();
@@ -459,7 +461,7 @@ namespace OpenSim.Framework
459 args["attachments"] = attachs; 461 args["attachments"] = attachs;
460 } 462 }
461 // End of code to remove 463 // End of code to remove
462 464*/
463 if ((Controllers != null) && (Controllers.Length > 0)) 465 if ((Controllers != null) && (Controllers.Length > 0))
464 { 466 {
465 OSDArray controls = new OSDArray(Controllers.Length); 467 OSDArray controls = new OSDArray(Controllers.Length);
@@ -647,58 +649,71 @@ namespace OpenSim.Framework
647 // AgentTextures[i++] = o.AsUUID(); 649 // AgentTextures[i++] = o.AsUUID();
648 //} 650 //}
649 651
650 Appearance = new AvatarAppearance();
651 652
652 // The code to unpack textures, visuals, wearables and attachments 653 // packed_appearence should contain all appearance information
653 // should be removed; packed appearance contains the full appearance 654 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
654 // This is retained for backward compatibility only
655 if (args["texture_entry"] != null)
656 { 655 {
657 byte[] rawtextures = args["texture_entry"].AsBinary(); 656 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
658 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); 657 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
659 Appearance.SetTextureEntries(textures);
660 } 658 }
659 else
660 {
661 // if missing try the old pack method
662 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method");
661 663
662 if (args["visual_params"] != null) 664 Appearance = new AvatarAppearance();
663 Appearance.SetVisualParams(args["visual_params"].AsBinary());
664 665
665 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) 666 // The code to unpack textures, visuals, wearables and attachments
666 { 667 // should be removed; packed appearance contains the full appearance
667 OSDArray wears = (OSDArray)(args["wearables"]); 668 // This is retained for backward compatibility only
669 if (args["texture_entry"] != null)
670 {
671 byte[] rawtextures = args["texture_entry"].AsBinary();
672 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
673 Appearance.SetTextureEntries(textures);
674 }
668 675
669 int count = wears.Count; 676 if (args["visual_params"] != null)
670 if (count > AvatarWearable.MAX_WEARABLES) 677 Appearance.SetVisualParams(args["visual_params"].AsBinary());
671 count = AvatarWearable.MAX_WEARABLES;
672 678
673 for (int i = 0; i < count / 2; i++) 679 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
674 { 680 {
675 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); 681 OSDArray wears = (OSDArray)(args["wearables"]);
676 Appearance.SetWearable(i,awear); 682
683 int count = wears.Count;
684 if (count > AvatarWearable.MAX_WEARABLES)
685 count = AvatarWearable.MAX_WEARABLES;
686
687 for (int i = 0; i < count / 2; i++)
688 {
689 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
690 Appearance.SetWearable(i, awear);
691 }
677 } 692 }
678 }
679 693
680 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 694 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
681 {
682 OSDArray attachs = (OSDArray)(args["attachments"]);
683 foreach (OSD o in attachs)
684 { 695 {
685 if (o.Type == OSDType.Map) 696 OSDArray attachs = (OSDArray)(args["attachments"]);
697 foreach (OSD o in attachs)
686 { 698 {
687 // We know all of these must end up as attachments so we 699 if (o.Type == OSDType.Map)
688 // append rather than replace to ensure multiple attachments 700 {
689 // per point continues to work 701 // We know all of these must end up as attachments so we
690// m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); 702 // append rather than replace to ensure multiple attachments
691 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); 703 // per point continues to work
704 // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
705 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
706 }
692 } 707 }
693 } 708 }
709 // end of code to remove
694 } 710 }
695 // end of code to remove 711/* moved above
696
697 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) 712 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
698 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); 713 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
699 else 714 else
700 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); 715 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
701 716*/
702 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) 717 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
703 { 718 {
704 OSDArray controls = (OSDArray)(args["controllers"]); 719 OSDArray controls = (OSDArray)(args["controllers"]);