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.cs202
1 files changed, 171 insertions, 31 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 2a8e67d..a714d86 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -94,6 +94,7 @@ namespace OpenSim.Framework
94 // This probably shouldn't be here 94 // This probably shouldn't be here
95 public byte[] Throttles; 95 public byte[] Throttles;
96 96
97 public Dictionary<ulong, string> ChildrenCapSeeds = null;
97 98
98 public OSDMap Pack() 99 public OSDMap Pack()
99 { 100 {
@@ -119,6 +120,19 @@ namespace OpenSim.Framework
119 if ((Throttles != null) && (Throttles.Length > 0)) 120 if ((Throttles != null) && (Throttles.Length > 0))
120 args["throttles"] = OSD.FromBinary(Throttles); 121 args["throttles"] = OSD.FromBinary(Throttles);
121 122
123 if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
124 {
125 OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
126 foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
127 {
128 OSDMap pair = new OSDMap();
129 pair["handle"] = OSD.FromString(kvp.Key.ToString());
130 pair["seed"] = OSD.FromString(kvp.Value);
131 childrenSeeds.Add(pair);
132 }
133 args["children_seeds"] = childrenSeeds;
134 }
135
122 return args; 136 return args;
123 } 137 }
124 138
@@ -165,6 +179,30 @@ namespace OpenSim.Framework
165 179
166 if (args["throttles"] != null) 180 if (args["throttles"] != null)
167 Throttles = args["throttles"].AsBinary(); 181 Throttles = args["throttles"].AsBinary();
182
183 if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
184 (args["children_seeds"].Type == OSDType.Array))
185 {
186 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
187 ChildrenCapSeeds = new Dictionary<ulong, string>();
188 foreach (OSD o in childrenSeeds)
189 {
190 if (o.Type == OSDType.Map)
191 {
192 ulong handle = 0;
193 string seed = "";
194 OSDMap pair = (OSDMap)o;
195 if (pair["handle"] != null)
196 if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
197 continue;
198 if (pair["seed"] != null)
199 seed = pair["seed"].AsString();
200 if (!ChildrenCapSeeds.ContainsKey(handle))
201 ChildrenCapSeeds.Add(handle, seed);
202 }
203 }
204 }
205
168 } 206 }
169 207
170 /// <summary> 208 /// <summary>
@@ -317,9 +355,11 @@ namespace OpenSim.Framework
317 public UUID ActiveGroupID; 355 public UUID ActiveGroupID;
318 356
319 public AgentGroupData[] Groups; 357 public AgentGroupData[] Groups;
358 public Dictionary<ulong, string> ChildrenCapSeeds = null;
320 public Animation[] Anims; 359 public Animation[] Anims;
321 public Animation DefaultAnim = null; 360 public Animation DefaultAnim = null;
322 public Animation AnimState = null; 361 public Animation AnimState = null;
362 public Byte MotionState = 0;
323 363
324 public UUID GranterID; 364 public UUID GranterID;
325 public UUID ParentPart; 365 public UUID ParentPart;
@@ -349,6 +389,8 @@ namespace OpenSim.Framework
349 public List<ISceneObject> AttachmentObjects; 389 public List<ISceneObject> AttachmentObjects;
350 public List<string> AttachmentObjectStates; 390 public List<string> AttachmentObjectStates;
351 391
392 public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
393
352 public virtual OSDMap Pack() 394 public virtual OSDMap Pack()
353 { 395 {
354// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); 396// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
@@ -399,6 +441,19 @@ namespace OpenSim.Framework
399 args["groups"] = groups; 441 args["groups"] = groups;
400 } 442 }
401 443
444 if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0)
445 {
446 OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
447 foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
448 {
449 OSDMap pair = new OSDMap();
450 pair["handle"] = OSD.FromString(kvp.Key.ToString());
451 pair["seed"] = OSD.FromString(kvp.Value);
452 childrenSeeds.Add(pair);
453 }
454 args["children_seeds"] = childrenSeeds;
455 }
456
402 if ((Anims != null) && (Anims.Length > 0)) 457 if ((Anims != null) && (Anims.Length > 0))
403 { 458 {
404 OSDArray anims = new OSDArray(Anims.Length); 459 OSDArray anims = new OSDArray(Anims.Length);
@@ -417,6 +472,26 @@ namespace OpenSim.Framework
417 args["animation_state"] = AnimState.PackUpdateMessage(); 472 args["animation_state"] = AnimState.PackUpdateMessage();
418 } 473 }
419 474
475 if (MovementAnimationOverRides.Count > 0)
476 {
477 OSDArray AOs = new OSDArray(MovementAnimationOverRides.Count);
478 {
479 foreach (KeyValuePair<string, UUID> kvp in MovementAnimationOverRides)
480 {
481 OSDMap ao = new OSDMap(2);
482 ao["state"] = OSD.FromString(kvp.Key);
483 ao["uuid"] = OSD.FromUUID(kvp.Value);
484 AOs.Add(ao);
485 }
486 }
487 args["movementAO"] = AOs;
488 }
489
490 if (MotionState != 0)
491 {
492 args["motion_state"] = OSD.FromInteger(MotionState);
493 }
494
420 if (Appearance != null) 495 if (Appearance != null)
421 args["packed_appearance"] = Appearance.Pack(); 496 args["packed_appearance"] = Appearance.Pack();
422 497
@@ -431,6 +506,8 @@ namespace OpenSim.Framework
431 // The code to pack textures, visuals, wearables and attachments 506 // The code to pack textures, visuals, wearables and attachments
432 // should be removed; packed appearance contains the full appearance 507 // should be removed; packed appearance contains the full appearance
433 // This is retained for backward compatibility only 508 // This is retained for backward compatibility only
509
510/* then lets remove
434 if (Appearance.Texture != null) 511 if (Appearance.Texture != null)
435 { 512 {
436 byte[] rawtextures = Appearance.Texture.GetBytes(); 513 byte[] rawtextures = Appearance.Texture.GetBytes();
@@ -459,7 +536,7 @@ namespace OpenSim.Framework
459 args["attachments"] = attachs; 536 args["attachments"] = attachs;
460 } 537 }
461 // End of code to remove 538 // End of code to remove
462 539*/
463 if ((Controllers != null) && (Controllers.Length > 0)) 540 if ((Controllers != null) && (Controllers.Length > 0))
464 { 541 {
465 OSDArray controls = new OSDArray(Controllers.Length); 542 OSDArray controls = new OSDArray(Controllers.Length);
@@ -600,6 +677,29 @@ namespace OpenSim.Framework
600 } 677 }
601 } 678 }
602 679
680 if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) &&
681 (args["children_seeds"].Type == OSDType.Array))
682 {
683 OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]);
684 ChildrenCapSeeds = new Dictionary<ulong, string>();
685 foreach (OSD o in childrenSeeds)
686 {
687 if (o.Type == OSDType.Map)
688 {
689 ulong handle = 0;
690 string seed = "";
691 OSDMap pair = (OSDMap)o;
692 if (pair["handle"] != null)
693 if (!UInt64.TryParse(pair["handle"].AsString(), out handle))
694 continue;
695 if (pair["seed"] != null)
696 seed = pair["seed"].AsString();
697 if (!ChildrenCapSeeds.ContainsKey(handle))
698 ChildrenCapSeeds.Add(handle, seed);
699 }
700 }
701 }
702
603 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array) 703 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
604 { 704 {
605 OSDArray anims = (OSDArray)(args["animations"]); 705 OSDArray anims = (OSDArray)(args["animations"]);
@@ -638,6 +738,28 @@ namespace OpenSim.Framework
638 } 738 }
639 } 739 }
640 740
741 MovementAnimationOverRides.Clear();
742
743 if (args["movementAO"] != null && args["movementAO"].Type == OSDType.Array)
744 {
745 OSDArray AOs = (OSDArray)(args["movementAO"]);
746 int count = AOs.Count;
747
748 for (int i = 0; i < count; i++)
749 {
750 OSDMap ao = (OSDMap)AOs[i];
751 if (ao["state"] != null && ao["uuid"] != null)
752 {
753 string state = ao["state"].AsString();
754 UUID id = ao["uuid"].AsUUID();
755 MovementAnimationOverRides[state] = id;
756 }
757 }
758 }
759
760 if (args.ContainsKey("motion_state"))
761 MotionState = (byte)args["motion_state"].AsInteger();
762
641 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) 763 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
642 //{ 764 //{
643 // OSDArray textures = (OSDArray)(args["agent_textures"]); 765 // OSDArray textures = (OSDArray)(args["agent_textures"]);
@@ -647,53 +769,71 @@ namespace OpenSim.Framework
647 // AgentTextures[i++] = o.AsUUID(); 769 // AgentTextures[i++] = o.AsUUID();
648 //} 770 //}
649 771
650 Appearance = new AvatarAppearance();
651 772
652 // The code to unpack textures, visuals, wearables and attachments 773 // packed_appearence should contain all appearance information
653 // should be removed; packed appearance contains the full appearance 774 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 { 775 {
657 byte[] rawtextures = args["texture_entry"].AsBinary(); 776 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
658 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); 777 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
659 Appearance.SetTextureEntries(textures);
660 } 778 }
779 else
780 {
781 // if missing try the old pack method
782 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method");
661 783
662 if (args["visual_params"] != null) 784 Appearance = new AvatarAppearance();
663 Appearance.SetVisualParams(args["visual_params"].AsBinary());
664 785
665 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) 786 // The code to unpack textures, visuals, wearables and attachments
666 { 787 // should be removed; packed appearance contains the full appearance
667 OSDArray wears = (OSDArray)(args["wearables"]); 788 // This is retained for backward compatibility only
668 for (int i = 0; i < wears.Count / 2; i++) 789 if (args["texture_entry"] != null)
669 { 790 {
670 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); 791 byte[] rawtextures = args["texture_entry"].AsBinary();
671 Appearance.SetWearable(i,awear); 792 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
793 Appearance.SetTextureEntries(textures);
672 } 794 }
673 }
674 795
675 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 796 if (args["visual_params"] != null)
676 { 797 Appearance.SetVisualParams(args["visual_params"].AsBinary());
677 OSDArray attachs = (OSDArray)(args["attachments"]); 798
678 foreach (OSD o in attachs) 799 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
679 { 800 {
680 if (o.Type == OSDType.Map) 801 OSDArray wears = (OSDArray)(args["wearables"]);
802
803 int count = wears.Count;
804 if (count > AvatarWearable.MAX_WEARABLES)
805 count = AvatarWearable.MAX_WEARABLES;
806
807 for (int i = 0; i < count / 2; i++)
681 { 808 {
682 // We know all of these must end up as attachments so we 809 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
683 // append rather than replace to ensure multiple attachments 810 Appearance.SetWearable(i, awear);
684 // per point continues to work
685// m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
686 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
687 } 811 }
688 } 812 }
689 }
690 // end of code to remove
691 813
814 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
815 {
816 OSDArray attachs = (OSDArray)(args["attachments"]);
817 foreach (OSD o in attachs)
818 {
819 if (o.Type == OSDType.Map)
820 {
821 // We know all of these must end up as attachments so we
822 // append rather than replace to ensure multiple attachments
823 // per point continues to work
824 // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
825 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
826 }
827 }
828 }
829 // end of code to remove
830 }
831/* moved above
692 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) 832 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
693 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); 833 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
694 else 834 else
695 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); 835 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
696 836*/
697 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) 837 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
698 { 838 {
699 OSDArray controls = (OSDArray)(args["controllers"]); 839 OSDArray controls = (OSDArray)(args["controllers"]);