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.cs223
1 files changed, 183 insertions, 40 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index 967278e..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,15 +179,40 @@ 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>
171 /// Soon to be decommissioned 209 /// Soon to be decommissioned
172 /// </summary> 210 /// </summary>
173 /// <param name="cAgent"></param> 211 /// <param name="cAgent"></param>
174 public void CopyFrom(ChildAgentDataUpdate cAgent) 212 public void CopyFrom(ChildAgentDataUpdate cAgent, UUID sid)
175 { 213 {
176 AgentID = new UUID(cAgent.AgentID); 214 AgentID = new UUID(cAgent.AgentID);
215 SessionID = sid;
177 216
178 // next: ??? 217 // next: ???
179 Size = new Vector3(); 218 Size = new Vector3();
@@ -291,7 +330,13 @@ namespace OpenSim.Framework
291 public Vector3 AtAxis; 330 public Vector3 AtAxis;
292 public Vector3 LeftAxis; 331 public Vector3 LeftAxis;
293 public Vector3 UpAxis; 332 public Vector3 UpAxis;
294 public bool ChangedGrid; 333
334 /// <summary>
335 /// Signal on a V2 teleport that Scene.IncomingChildAgentDataUpdate(AgentData ad) should wait for the
336 /// scene presence to become root (triggered when the viewer sends a CompleteAgentMovement UDP packet after
337 /// establishing the connection triggered by it's receipt of a TeleportFinish EQ message).
338 /// </summary>
339 public bool SenderWantsToWaitForRoot;
295 340
296 public float Far; 341 public float Far;
297 public float Aspect; 342 public float Aspect;
@@ -310,9 +355,11 @@ namespace OpenSim.Framework
310 public UUID ActiveGroupID; 355 public UUID ActiveGroupID;
311 356
312 public AgentGroupData[] Groups; 357 public AgentGroupData[] Groups;
358 public Dictionary<ulong, string> ChildrenCapSeeds = null;
313 public Animation[] Anims; 359 public Animation[] Anims;
314 public Animation DefaultAnim = null; 360 public Animation DefaultAnim = null;
315 public Animation AnimState = null; 361 public Animation AnimState = null;
362 public Byte MotionState = 0;
316 363
317 public UUID GranterID; 364 public UUID GranterID;
318 public UUID ParentPart; 365 public UUID ParentPart;
@@ -342,6 +389,8 @@ namespace OpenSim.Framework
342 public List<ISceneObject> AttachmentObjects; 389 public List<ISceneObject> AttachmentObjects;
343 public List<string> AttachmentObjectStates; 390 public List<string> AttachmentObjectStates;
344 391
392 public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
393
345 public virtual OSDMap Pack() 394 public virtual OSDMap Pack()
346 { 395 {
347// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); 396// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
@@ -362,8 +411,9 @@ namespace OpenSim.Framework
362 args["left_axis"] = OSD.FromString(LeftAxis.ToString()); 411 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
363 args["up_axis"] = OSD.FromString(UpAxis.ToString()); 412 args["up_axis"] = OSD.FromString(UpAxis.ToString());
364 413
365 414 //backwards compatibility
366 args["changed_grid"] = OSD.FromBoolean(ChangedGrid); 415 args["changed_grid"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
416 args["wait_for_root"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
367 args["far"] = OSD.FromReal(Far); 417 args["far"] = OSD.FromReal(Far);
368 args["aspect"] = OSD.FromReal(Aspect); 418 args["aspect"] = OSD.FromReal(Aspect);
369 419
@@ -391,6 +441,19 @@ namespace OpenSim.Framework
391 args["groups"] = groups; 441 args["groups"] = groups;
392 } 442 }
393 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
394 if ((Anims != null) && (Anims.Length > 0)) 457 if ((Anims != null) && (Anims.Length > 0))
395 { 458 {
396 OSDArray anims = new OSDArray(Anims.Length); 459 OSDArray anims = new OSDArray(Anims.Length);
@@ -409,6 +472,26 @@ namespace OpenSim.Framework
409 args["animation_state"] = AnimState.PackUpdateMessage(); 472 args["animation_state"] = AnimState.PackUpdateMessage();
410 } 473 }
411 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
412 if (Appearance != null) 495 if (Appearance != null)
413 args["packed_appearance"] = Appearance.Pack(); 496 args["packed_appearance"] = Appearance.Pack();
414 497
@@ -423,6 +506,8 @@ namespace OpenSim.Framework
423 // The code to pack textures, visuals, wearables and attachments 506 // The code to pack textures, visuals, wearables and attachments
424 // should be removed; packed appearance contains the full appearance 507 // should be removed; packed appearance contains the full appearance
425 // This is retained for backward compatibility only 508 // This is retained for backward compatibility only
509
510/* then lets remove
426 if (Appearance.Texture != null) 511 if (Appearance.Texture != null)
427 { 512 {
428 byte[] rawtextures = Appearance.Texture.GetBytes(); 513 byte[] rawtextures = Appearance.Texture.GetBytes();
@@ -451,7 +536,7 @@ namespace OpenSim.Framework
451 args["attachments"] = attachs; 536 args["attachments"] = attachs;
452 } 537 }
453 // End of code to remove 538 // End of code to remove
454 539*/
455 if ((Controllers != null) && (Controllers.Length > 0)) 540 if ((Controllers != null) && (Controllers.Length > 0))
456 { 541 {
457 OSDArray controls = new OSDArray(Controllers.Length); 542 OSDArray controls = new OSDArray(Controllers.Length);
@@ -536,8 +621,8 @@ namespace OpenSim.Framework
536 if (args["up_axis"] != null) 621 if (args["up_axis"] != null)
537 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis); 622 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
538 623
539 if (args["changed_grid"] != null) 624 if (args.ContainsKey("wait_for_root") && args["wait_for_root"] != null)
540 ChangedGrid = args["changed_grid"].AsBoolean(); 625 SenderWantsToWaitForRoot = args["wait_for_root"].AsBoolean();
541 626
542 if (args["far"] != null) 627 if (args["far"] != null)
543 Far = (float)(args["far"].AsReal()); 628 Far = (float)(args["far"].AsReal());
@@ -592,6 +677,29 @@ namespace OpenSim.Framework
592 } 677 }
593 } 678 }
594 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
595 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array) 703 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
596 { 704 {
597 OSDArray anims = (OSDArray)(args["animations"]); 705 OSDArray anims = (OSDArray)(args["animations"]);
@@ -630,6 +738,28 @@ namespace OpenSim.Framework
630 } 738 }
631 } 739 }
632 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
633 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) 763 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
634 //{ 764 //{
635 // OSDArray textures = (OSDArray)(args["agent_textures"]); 765 // OSDArray textures = (OSDArray)(args["agent_textures"]);
@@ -639,58 +769,71 @@ namespace OpenSim.Framework
639 // AgentTextures[i++] = o.AsUUID(); 769 // AgentTextures[i++] = o.AsUUID();
640 //} 770 //}
641 771
642 Appearance = new AvatarAppearance();
643 772
644 // The code to unpack textures, visuals, wearables and attachments 773 // packed_appearence should contain all appearance information
645 // should be removed; packed appearance contains the full appearance 774 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
646 // This is retained for backward compatibility only
647 if (args["texture_entry"] != null)
648 { 775 {
649 byte[] rawtextures = args["texture_entry"].AsBinary(); 776 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance");
650 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); 777 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
651 Appearance.SetTextureEntries(textures);
652 } 778 }
779 else
780 {
781 // if missing try the old pack method
782 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method");
653 783
654 if (args["visual_params"] != null) 784 Appearance = new AvatarAppearance();
655 Appearance.SetVisualParams(args["visual_params"].AsBinary());
656 785
657 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) 786 // The code to unpack textures, visuals, wearables and attachments
658 { 787 // should be removed; packed appearance contains the full appearance
659 OSDArray wears = (OSDArray)(args["wearables"]); 788 // This is retained for backward compatibility only
789 if (args["texture_entry"] != null)
790 {
791 byte[] rawtextures = args["texture_entry"].AsBinary();
792 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length);
793 Appearance.SetTextureEntries(textures);
794 }
660 795
661 int count = wears.Count; 796 if (args["visual_params"] != null)
662 if (count > AvatarWearable.MAX_WEARABLES) 797 Appearance.SetVisualParams(args["visual_params"].AsBinary());
663 count = AvatarWearable.MAX_WEARABLES;
664 798
665 for (int i = 0; i < count / 2; i++) 799 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
666 { 800 {
667 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); 801 OSDArray wears = (OSDArray)(args["wearables"]);
668 Appearance.SetWearable(i,awear); 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++)
808 {
809 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
810 Appearance.SetWearable(i, awear);
811 }
669 } 812 }
670 }
671 813
672 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) 814 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
673 {
674 OSDArray attachs = (OSDArray)(args["attachments"]);
675 foreach (OSD o in attachs)
676 { 815 {
677 if (o.Type == OSDType.Map) 816 OSDArray attachs = (OSDArray)(args["attachments"]);
817 foreach (OSD o in attachs)
678 { 818 {
679 // We know all of these must end up as attachments so we 819 if (o.Type == OSDType.Map)
680 // append rather than replace to ensure multiple attachments 820 {
681 // per point continues to work 821 // We know all of these must end up as attachments so we
682// m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); 822 // append rather than replace to ensure multiple attachments
683 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); 823 // per point continues to work
824 // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
825 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
826 }
684 } 827 }
685 } 828 }
829 // end of code to remove
686 } 830 }
687 // end of code to remove 831/* moved above
688
689 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) 832 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
690 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); 833 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
691 else 834 else
692 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); 835 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
693 836*/
694 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) 837 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
695 { 838 {
696 OSDArray controls = (OSDArray)(args["controllers"]); 839 OSDArray controls = (OSDArray)(args["controllers"]);