diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Framework/ChildAgentDataUpdate.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Framework/ChildAgentDataUpdate.cs')
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 337 |
1 files changed, 223 insertions, 114 deletions
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 1504f21..ee5007a 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -61,8 +61,8 @@ namespace OpenSim.Framework | |||
61 | { | 61 | { |
62 | UUID AgentID { get; set; } | 62 | UUID AgentID { get; set; } |
63 | 63 | ||
64 | OSDMap Pack(); | 64 | OSDMap Pack(EntityTransferContext ctx); |
65 | void Unpack(OSDMap map, IScene scene); | 65 | void Unpack(OSDMap map, IScene scene, EntityTransferContext ctx); |
66 | } | 66 | } |
67 | 67 | ||
68 | /// <summary> | 68 | /// <summary> |
@@ -89,13 +89,16 @@ namespace OpenSim.Framework | |||
89 | public Vector3 AtAxis; | 89 | public Vector3 AtAxis; |
90 | public Vector3 LeftAxis; | 90 | public Vector3 LeftAxis; |
91 | public Vector3 UpAxis; | 91 | public Vector3 UpAxis; |
92 | //public int GodLevel; | ||
93 | public OSD GodData = null; | ||
92 | public bool ChangedGrid; | 94 | public bool ChangedGrid; |
93 | 95 | ||
94 | // This probably shouldn't be here | 96 | // This probably shouldn't be here |
95 | public byte[] Throttles; | 97 | public byte[] Throttles; |
96 | 98 | ||
99 | public Dictionary<ulong, string> ChildrenCapSeeds = null; | ||
97 | 100 | ||
98 | public OSDMap Pack() | 101 | public OSDMap Pack(EntityTransferContext ctx) |
99 | { | 102 | { |
100 | OSDMap args = new OSDMap(); | 103 | OSDMap args = new OSDMap(); |
101 | args["message_type"] = OSD.FromString("AgentPosition"); | 104 | args["message_type"] = OSD.FromString("AgentPosition"); |
@@ -115,14 +118,37 @@ namespace OpenSim.Framework | |||
115 | 118 | ||
116 | args["far"] = OSD.FromReal(Far); | 119 | args["far"] = OSD.FromReal(Far); |
117 | args["changed_grid"] = OSD.FromBoolean(ChangedGrid); | 120 | args["changed_grid"] = OSD.FromBoolean(ChangedGrid); |
121 | //args["god_level"] = OSD.FromString(GodLevel.ToString()); | ||
122 | if(GodData != null) | ||
123 | { | ||
124 | args["god_data"] = GodData; | ||
125 | OSDMap g = (OSDMap)GodData; | ||
126 | // Set legacy value | ||
127 | // TODO: remove after 0.9 is superseded | ||
128 | if (g.ContainsKey("ViewerUiIsGod")) | ||
129 | args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0; | ||
130 | } | ||
118 | 131 | ||
119 | if ((Throttles != null) && (Throttles.Length > 0)) | 132 | if ((Throttles != null) && (Throttles.Length > 0)) |
120 | args["throttles"] = OSD.FromBinary(Throttles); | 133 | args["throttles"] = OSD.FromBinary(Throttles); |
121 | 134 | ||
135 | if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0) | ||
136 | { | ||
137 | OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count); | ||
138 | foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds) | ||
139 | { | ||
140 | OSDMap pair = new OSDMap(); | ||
141 | pair["handle"] = OSD.FromString(kvp.Key.ToString()); | ||
142 | pair["seed"] = OSD.FromString(kvp.Value); | ||
143 | childrenSeeds.Add(pair); | ||
144 | } | ||
145 | args["children_seeds"] = childrenSeeds; | ||
146 | } | ||
147 | |||
122 | return args; | 148 | return args; |
123 | } | 149 | } |
124 | 150 | ||
125 | public void Unpack(OSDMap args, IScene scene) | 151 | public void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx) |
126 | { | 152 | { |
127 | if (args.ContainsKey("region_handle")) | 153 | if (args.ContainsKey("region_handle")) |
128 | UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); | 154 | UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle); |
@@ -160,11 +186,40 @@ namespace OpenSim.Framework | |||
160 | if (args["changed_grid"] != null) | 186 | if (args["changed_grid"] != null) |
161 | ChangedGrid = args["changed_grid"].AsBoolean(); | 187 | ChangedGrid = args["changed_grid"].AsBoolean(); |
162 | 188 | ||
189 | //if (args["god_level"] != null) | ||
190 | // Int32.TryParse(args["god_level"].AsString(), out GodLevel); | ||
191 | if (args.ContainsKey("god_data") && args["god_data"] != null) | ||
192 | GodData = args["god_data"]; | ||
193 | |||
163 | if (args["far"] != null) | 194 | if (args["far"] != null) |
164 | Far = (float)(args["far"].AsReal()); | 195 | Far = (float)(args["far"].AsReal()); |
165 | 196 | ||
166 | if (args["throttles"] != null) | 197 | if (args["throttles"] != null) |
167 | Throttles = args["throttles"].AsBinary(); | 198 | Throttles = args["throttles"].AsBinary(); |
199 | |||
200 | if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) && | ||
201 | (args["children_seeds"].Type == OSDType.Array)) | ||
202 | { | ||
203 | OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); | ||
204 | ChildrenCapSeeds = new Dictionary<ulong, string>(); | ||
205 | foreach (OSD o in childrenSeeds) | ||
206 | { | ||
207 | if (o.Type == OSDType.Map) | ||
208 | { | ||
209 | ulong handle = 0; | ||
210 | string seed = ""; | ||
211 | OSDMap pair = (OSDMap)o; | ||
212 | if (pair["handle"] != null) | ||
213 | if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) | ||
214 | continue; | ||
215 | if (pair["seed"] != null) | ||
216 | seed = pair["seed"].AsString(); | ||
217 | if (!ChildrenCapSeeds.ContainsKey(handle)) | ||
218 | ChildrenCapSeeds.Add(handle, seed); | ||
219 | } | ||
220 | } | ||
221 | } | ||
222 | |||
168 | } | 223 | } |
169 | 224 | ||
170 | /// <summary> | 225 | /// <summary> |
@@ -294,7 +349,7 @@ namespace OpenSim.Framework | |||
294 | public Vector3 UpAxis; | 349 | public Vector3 UpAxis; |
295 | 350 | ||
296 | /// <summary> | 351 | /// <summary> |
297 | /// Signal on a V2 teleport that Scene.IncomingChildAgentDataUpdate(AgentData ad) should wait for the | 352 | /// Signal on a V2 teleport that Scene.IncomingChildAgentDataUpdate(AgentData ad) should wait for the |
298 | /// scene presence to become root (triggered when the viewer sends a CompleteAgentMovement UDP packet after | 353 | /// scene presence to become root (triggered when the viewer sends a CompleteAgentMovement UDP packet after |
299 | /// establishing the connection triggered by it's receipt of a TeleportFinish EQ message). | 354 | /// establishing the connection triggered by it's receipt of a TeleportFinish EQ message). |
300 | /// </summary> | 355 | /// </summary> |
@@ -310,18 +365,24 @@ namespace OpenSim.Framework | |||
310 | public Quaternion BodyRotation; | 365 | public Quaternion BodyRotation; |
311 | public uint ControlFlags; | 366 | public uint ControlFlags; |
312 | public float EnergyLevel; | 367 | public float EnergyLevel; |
313 | public Byte GodLevel; | 368 | public OSD GodData = null; |
369 | //public Byte GodLevel; | ||
314 | public bool AlwaysRun; | 370 | public bool AlwaysRun; |
315 | public UUID PreyAgent; | 371 | public UUID PreyAgent; |
316 | public Byte AgentAccess; | 372 | public Byte AgentAccess; |
317 | public UUID ActiveGroupID; | 373 | public UUID ActiveGroupID; |
374 | public string ActiveGroupName; | ||
375 | public string ActiveGroupTitle = null; | ||
376 | public UUID agentCOF; | ||
377 | public byte CrossingFlags; | ||
378 | public byte CrossExtraFlags; | ||
318 | 379 | ||
319 | public AgentGroupData[] Groups; | 380 | public Dictionary<ulong, string> ChildrenCapSeeds = null; |
320 | public Animation[] Anims; | 381 | public Animation[] Anims; |
321 | public Animation DefaultAnim = null; | 382 | public Animation DefaultAnim = null; |
322 | public Animation AnimState = null; | 383 | public Animation AnimState = null; |
384 | public Byte MotionState = 0; | ||
323 | 385 | ||
324 | public UUID GranterID; | ||
325 | public UUID ParentPart; | 386 | public UUID ParentPart; |
326 | public Vector3 SitOffset; | 387 | public Vector3 SitOffset; |
327 | 388 | ||
@@ -334,12 +395,6 @@ namespace OpenSim.Framework | |||
334 | MethodBase.GetCurrentMethod().DeclaringType); | 395 | MethodBase.GetCurrentMethod().DeclaringType); |
335 | // DEBUG OFF | 396 | // DEBUG OFF |
336 | 397 | ||
337 | /* | ||
338 | public byte[] AgentTextures; | ||
339 | public byte[] VisualParams; | ||
340 | public UUID[] Wearables; | ||
341 | public AvatarAttachment[] Attachments; | ||
342 | */ | ||
343 | // Scripted | 398 | // Scripted |
344 | public ControllerData[] Controllers; | 399 | public ControllerData[] Controllers; |
345 | 400 | ||
@@ -349,7 +404,9 @@ namespace OpenSim.Framework | |||
349 | public List<ISceneObject> AttachmentObjects; | 404 | public List<ISceneObject> AttachmentObjects; |
350 | public List<string> AttachmentObjectStates; | 405 | public List<string> AttachmentObjectStates; |
351 | 406 | ||
352 | public virtual OSDMap Pack() | 407 | public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>(); |
408 | |||
409 | public virtual OSDMap Pack(EntityTransferContext ctx) | ||
353 | { | 410 | { |
354 | // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); | 411 | // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); |
355 | 412 | ||
@@ -384,19 +441,39 @@ namespace OpenSim.Framework | |||
384 | args["control_flags"] = OSD.FromString(ControlFlags.ToString()); | 441 | args["control_flags"] = OSD.FromString(ControlFlags.ToString()); |
385 | 442 | ||
386 | args["energy_level"] = OSD.FromReal(EnergyLevel); | 443 | args["energy_level"] = OSD.FromReal(EnergyLevel); |
387 | args["god_level"] = OSD.FromString(GodLevel.ToString()); | 444 | //args["god_level"] = OSD.FromString(GodLevel.ToString()); |
445 | if(GodData != null) | ||
446 | { | ||
447 | args["god_data"] = GodData; | ||
448 | OSDMap g = (OSDMap)GodData; | ||
449 | if (g.ContainsKey("ViewerUiIsGod")) | ||
450 | args["god_level"] = g["ViewerUiIsGod"].AsBoolean() ? 200 : 0;; | ||
451 | } | ||
388 | args["always_run"] = OSD.FromBoolean(AlwaysRun); | 452 | args["always_run"] = OSD.FromBoolean(AlwaysRun); |
389 | args["prey_agent"] = OSD.FromUUID(PreyAgent); | 453 | args["prey_agent"] = OSD.FromUUID(PreyAgent); |
390 | args["agent_access"] = OSD.FromString(AgentAccess.ToString()); | 454 | args["agent_access"] = OSD.FromString(AgentAccess.ToString()); |
391 | 455 | ||
456 | args["agent_cof"] = OSD.FromUUID(agentCOF); | ||
457 | args["crossingflags"] = OSD.FromInteger(CrossingFlags); | ||
458 | if(CrossingFlags != 0) | ||
459 | args["crossExtraFlags"] = OSD.FromInteger(CrossExtraFlags); | ||
460 | |||
392 | args["active_group_id"] = OSD.FromUUID(ActiveGroupID); | 461 | args["active_group_id"] = OSD.FromUUID(ActiveGroupID); |
393 | 462 | args["active_group_name"] = OSD.FromString(ActiveGroupName); | |
394 | if ((Groups != null) && (Groups.Length > 0)) | 463 | if(ActiveGroupTitle != null) |
464 | args["active_group_title"] = OSD.FromString(ActiveGroupTitle); | ||
465 | |||
466 | if (ChildrenCapSeeds != null && ChildrenCapSeeds.Count > 0) | ||
395 | { | 467 | { |
396 | OSDArray groups = new OSDArray(Groups.Length); | 468 | OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count); |
397 | foreach (AgentGroupData agd in Groups) | 469 | foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds) |
398 | groups.Add(agd.PackUpdateMessage()); | 470 | { |
399 | args["groups"] = groups; | 471 | OSDMap pair = new OSDMap(); |
472 | pair["handle"] = OSD.FromString(kvp.Key.ToString()); | ||
473 | pair["seed"] = OSD.FromString(kvp.Value); | ||
474 | childrenSeeds.Add(pair); | ||
475 | } | ||
476 | args["children_seeds"] = childrenSeeds; | ||
400 | } | 477 | } |
401 | 478 | ||
402 | if ((Anims != null) && (Anims.Length > 0)) | 479 | if ((Anims != null) && (Anims.Length > 0)) |
@@ -417,57 +494,28 @@ namespace OpenSim.Framework | |||
417 | args["animation_state"] = AnimState.PackUpdateMessage(); | 494 | args["animation_state"] = AnimState.PackUpdateMessage(); |
418 | } | 495 | } |
419 | 496 | ||
420 | if (Appearance != null) | 497 | if (MovementAnimationOverRides.Count > 0) |
421 | args["packed_appearance"] = Appearance.Pack(); | ||
422 | |||
423 | //if ((AgentTextures != null) && (AgentTextures.Length > 0)) | ||
424 | //{ | ||
425 | // OSDArray textures = new OSDArray(AgentTextures.Length); | ||
426 | // foreach (UUID uuid in AgentTextures) | ||
427 | // textures.Add(OSD.FromUUID(uuid)); | ||
428 | // args["agent_textures"] = textures; | ||
429 | //} | ||
430 | |||
431 | // The code to pack textures, visuals, wearables and attachments | ||
432 | // should be removed; packed appearance contains the full appearance | ||
433 | // This is retained for backward compatibility only | ||
434 | if (Appearance.Texture != null) | ||
435 | { | 498 | { |
436 | byte[] rawtextures = Appearance.Texture.GetBytes(); | 499 | OSDArray AOs = new OSDArray(MovementAnimationOverRides.Count); |
437 | args["texture_entry"] = OSD.FromBinary(rawtextures); | 500 | { |
501 | foreach (KeyValuePair<string, UUID> kvp in MovementAnimationOverRides) | ||
502 | { | ||
503 | OSDMap ao = new OSDMap(2); | ||
504 | ao["state"] = OSD.FromString(kvp.Key); | ||
505 | ao["uuid"] = OSD.FromUUID(kvp.Value); | ||
506 | AOs.Add(ao); | ||
507 | } | ||
508 | } | ||
509 | args["movementAO"] = AOs; | ||
438 | } | 510 | } |
439 | 511 | ||
440 | if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0)) | 512 | if (MotionState != 0) |
441 | args["visual_params"] = OSD.FromBinary(Appearance.VisualParams); | ||
442 | |||
443 | // We might not pass this in all cases... | ||
444 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) | ||
445 | { | 513 | { |
446 | int wearsCount; | 514 | args["motion_state"] = OSD.FromInteger(MotionState); |
447 | if(Appearance.PackLegacyWearables) | ||
448 | wearsCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; | ||
449 | else | ||
450 | wearsCount = AvatarWearable.MAX_WEARABLES; | ||
451 | |||
452 | if(wearsCount > Appearance.Wearables.Length) | ||
453 | wearsCount = Appearance.Wearables.Length; | ||
454 | |||
455 | OSDArray wears = new OSDArray(wearsCount); | ||
456 | for(int i = 0; i < wearsCount ; i++) | ||
457 | wears.Add(Appearance.Wearables[i].Pack()); | ||
458 | |||
459 | args["wearables"] = wears; | ||
460 | } | 515 | } |
461 | 516 | ||
462 | List<AvatarAttachment> attachments = Appearance.GetAttachments(); | 517 | if (Appearance != null) |
463 | if ((attachments != null) && (attachments.Count > 0)) | 518 | args["packed_appearance"] = Appearance.Pack(ctx); |
464 | { | ||
465 | OSDArray attachs = new OSDArray(attachments.Count); | ||
466 | foreach (AvatarAttachment att in attachments) | ||
467 | attachs.Add(att.Pack()); | ||
468 | args["attachments"] = attachs; | ||
469 | } | ||
470 | // End of code to remove | ||
471 | 519 | ||
472 | if ((Controllers != null) && (Controllers.Length > 0)) | 520 | if ((Controllers != null) && (Controllers.Length > 0)) |
473 | { | 521 | { |
@@ -516,7 +564,7 @@ namespace OpenSim.Framework | |||
516 | /// Avoiding reflection makes it painful to write, but that's the price! | 564 | /// Avoiding reflection makes it painful to write, but that's the price! |
517 | /// </summary> | 565 | /// </summary> |
518 | /// <param name="hash"></param> | 566 | /// <param name="hash"></param> |
519 | public virtual void Unpack(OSDMap args, IScene scene) | 567 | public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx) |
520 | { | 568 | { |
521 | //m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); | 569 | //m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); |
522 | 570 | ||
@@ -580,8 +628,11 @@ namespace OpenSim.Framework | |||
580 | if (args["energy_level"] != null) | 628 | if (args["energy_level"] != null) |
581 | EnergyLevel = (float)(args["energy_level"].AsReal()); | 629 | EnergyLevel = (float)(args["energy_level"].AsReal()); |
582 | 630 | ||
583 | if (args["god_level"] != null) | 631 | //if (args["god_level"] != null) |
584 | Byte.TryParse(args["god_level"].AsString(), out GodLevel); | 632 | // Byte.TryParse(args["god_level"].AsString(), out GodLevel); |
633 | |||
634 | if (args.ContainsKey("god_data") && args["god_data"] != null) | ||
635 | GodData = args["god_data"]; | ||
585 | 636 | ||
586 | if (args["always_run"] != null) | 637 | if (args["always_run"] != null) |
587 | AlwaysRun = args["always_run"].AsBoolean(); | 638 | AlwaysRun = args["always_run"].AsBoolean(); |
@@ -592,19 +643,46 @@ namespace OpenSim.Framework | |||
592 | if (args["agent_access"] != null) | 643 | if (args["agent_access"] != null) |
593 | Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); | 644 | Byte.TryParse(args["agent_access"].AsString(), out AgentAccess); |
594 | 645 | ||
595 | if (args["active_group_id"] != null) | 646 | if (args.ContainsKey("agent_cof") && args["agent_cof"] != null) |
647 | agentCOF = args["agent_cof"].AsUUID(); | ||
648 | |||
649 | if (args.ContainsKey("crossingflags") && args["crossingflags"] != null) | ||
650 | CrossingFlags = (byte)args["crossingflags"].AsInteger(); | ||
651 | |||
652 | if(CrossingFlags != 0) | ||
653 | { | ||
654 | if (args.ContainsKey("crossExtraFlags") && args["crossExtraFlags"] != null) | ||
655 | CrossExtraFlags = (byte)args["crossExtraFlags"].AsInteger(); | ||
656 | } | ||
657 | |||
658 | if (args.ContainsKey("active_group_id") && args["active_group_id"] != null) | ||
596 | ActiveGroupID = args["active_group_id"].AsUUID(); | 659 | ActiveGroupID = args["active_group_id"].AsUUID(); |
597 | 660 | ||
598 | if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array) | 661 | if (args.ContainsKey("active_group_name") && args["active_group_name"] != null) |
662 | ActiveGroupName = args["active_group_name"].AsString(); | ||
663 | |||
664 | if(args.ContainsKey("active_group_title") && args["active_group_title"] != null) | ||
665 | ActiveGroupTitle = args["active_group_title"].AsString(); | ||
666 | |||
667 | if (args.ContainsKey("children_seeds") && (args["children_seeds"] != null) && | ||
668 | (args["children_seeds"].Type == OSDType.Array)) | ||
599 | { | 669 | { |
600 | OSDArray groups = (OSDArray)(args["groups"]); | 670 | OSDArray childrenSeeds = (OSDArray)(args["children_seeds"]); |
601 | Groups = new AgentGroupData[groups.Count]; | 671 | ChildrenCapSeeds = new Dictionary<ulong, string>(); |
602 | int i = 0; | 672 | foreach (OSD o in childrenSeeds) |
603 | foreach (OSD o in groups) | ||
604 | { | 673 | { |
605 | if (o.Type == OSDType.Map) | 674 | if (o.Type == OSDType.Map) |
606 | { | 675 | { |
607 | Groups[i++] = new AgentGroupData((OSDMap)o); | 676 | ulong handle = 0; |
677 | string seed = ""; | ||
678 | OSDMap pair = (OSDMap)o; | ||
679 | if (pair["handle"] != null) | ||
680 | if (!UInt64.TryParse(pair["handle"].AsString(), out handle)) | ||
681 | continue; | ||
682 | if (pair["seed"] != null) | ||
683 | seed = pair["seed"].AsString(); | ||
684 | if (!ChildrenCapSeeds.ContainsKey(handle)) | ||
685 | ChildrenCapSeeds.Add(handle, seed); | ||
608 | } | 686 | } |
609 | } | 687 | } |
610 | } | 688 | } |
@@ -647,6 +725,28 @@ namespace OpenSim.Framework | |||
647 | } | 725 | } |
648 | } | 726 | } |
649 | 727 | ||
728 | MovementAnimationOverRides.Clear(); | ||
729 | |||
730 | if (args["movementAO"] != null && args["movementAO"].Type == OSDType.Array) | ||
731 | { | ||
732 | OSDArray AOs = (OSDArray)(args["movementAO"]); | ||
733 | int count = AOs.Count; | ||
734 | |||
735 | for (int i = 0; i < count; i++) | ||
736 | { | ||
737 | OSDMap ao = (OSDMap)AOs[i]; | ||
738 | if (ao["state"] != null && ao["uuid"] != null) | ||
739 | { | ||
740 | string state = ao["state"].AsString(); | ||
741 | UUID id = ao["uuid"].AsUUID(); | ||
742 | MovementAnimationOverRides[state] = id; | ||
743 | } | ||
744 | } | ||
745 | } | ||
746 | |||
747 | if (args.ContainsKey("motion_state")) | ||
748 | MotionState = (byte)args["motion_state"].AsInteger(); | ||
749 | |||
650 | //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) | 750 | //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) |
651 | //{ | 751 | //{ |
652 | // OSDArray textures = (OSDArray)(args["agent_textures"]); | 752 | // OSDArray textures = (OSDArray)(args["agent_textures"]); |
@@ -656,58 +756,67 @@ namespace OpenSim.Framework | |||
656 | // AgentTextures[i++] = o.AsUUID(); | 756 | // AgentTextures[i++] = o.AsUUID(); |
657 | //} | 757 | //} |
658 | 758 | ||
659 | Appearance = new AvatarAppearance(); | ||
660 | 759 | ||
661 | // The code to unpack textures, visuals, wearables and attachments | 760 | // packed_appearence should contain all appearance information |
662 | // should be removed; packed appearance contains the full appearance | 761 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) |
663 | // This is retained for backward compatibility only | ||
664 | if (args["texture_entry"] != null) | ||
665 | { | 762 | { |
666 | byte[] rawtextures = args["texture_entry"].AsBinary(); | 763 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] got packed appearance"); |
667 | Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length); | 764 | Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); |
668 | Appearance.SetTextureEntries(textures); | ||
669 | } | 765 | } |
766 | else | ||
767 | { | ||
768 | // if missing try the old pack method | ||
769 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance, checking old method"); | ||
670 | 770 | ||
671 | if (args["visual_params"] != null) | 771 | Appearance = new AvatarAppearance(); |
672 | Appearance.SetVisualParams(args["visual_params"].AsBinary()); | ||
673 | 772 | ||
674 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 773 | // The code to unpack textures, visuals, wearables and attachments |
675 | { | 774 | // should be removed; packed appearance contains the full appearance |
676 | OSDArray wears = (OSDArray)(args["wearables"]); | 775 | // This is retained for backward compatibility only |
776 | if (args["texture_entry"] != null) | ||
777 | { | ||
778 | byte[] rawtextures = args["texture_entry"].AsBinary(); | ||
779 | Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures, 0, rawtextures.Length); | ||
780 | Appearance.SetTextureEntries(textures); | ||
781 | } | ||
677 | 782 | ||
678 | int count = wears.Count; | 783 | if (args["visual_params"] != null) |
679 | if (count > AvatarWearable.MAX_WEARABLES) | 784 | Appearance.SetVisualParams(args["visual_params"].AsBinary()); |
680 | count = AvatarWearable.MAX_WEARABLES; | ||
681 | 785 | ||
682 | for (int i = 0; i < count / 2; i++) | 786 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
683 | { | 787 | { |
684 | AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); | 788 | OSDArray wears = (OSDArray)(args["wearables"]); |
685 | Appearance.SetWearable(i,awear); | 789 | |
790 | for (int i = 0; i < wears.Count / 2; i++) | ||
791 | { | ||
792 | AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]); | ||
793 | Appearance.SetWearable(i, awear); | ||
794 | } | ||
686 | } | 795 | } |
687 | } | ||
688 | 796 | ||
689 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | 797 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) |
690 | { | ||
691 | OSDArray attachs = (OSDArray)(args["attachments"]); | ||
692 | foreach (OSD o in attachs) | ||
693 | { | 798 | { |
694 | if (o.Type == OSDType.Map) | 799 | OSDArray attachs = (OSDArray)(args["attachments"]); |
800 | foreach (OSD o in attachs) | ||
695 | { | 801 | { |
696 | // We know all of these must end up as attachments so we | 802 | if (o.Type == OSDType.Map) |
697 | // append rather than replace to ensure multiple attachments | 803 | { |
698 | // per point continues to work | 804 | // We know all of these must end up as attachments so we |
699 | // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); | 805 | // append rather than replace to ensure multiple attachments |
700 | Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); | 806 | // per point continues to work |
807 | // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID); | ||
808 | Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); | ||
809 | } | ||
701 | } | 810 | } |
702 | } | 811 | } |
812 | // end of code to remove | ||
703 | } | 813 | } |
704 | // end of code to remove | 814 | /* moved above |
705 | |||
706 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) | 815 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) |
707 | Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); | 816 | Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]); |
708 | else | 817 | else |
709 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); | 818 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); |
710 | 819 | */ | |
711 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) | 820 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) |
712 | { | 821 | { |
713 | OSDArray controls = (OSDArray)(args["controllers"]); | 822 | OSDArray controls = (OSDArray)(args["controllers"]); |
@@ -771,14 +880,14 @@ namespace OpenSim.Framework | |||
771 | 880 | ||
772 | public class CompleteAgentData : AgentData | 881 | public class CompleteAgentData : AgentData |
773 | { | 882 | { |
774 | public override OSDMap Pack() | 883 | public override OSDMap Pack(EntityTransferContext ctx) |
775 | { | 884 | { |
776 | return base.Pack(); | 885 | return base.Pack(ctx); |
777 | } | 886 | } |
778 | 887 | ||
779 | public override void Unpack(OSDMap map, IScene scene) | 888 | public override void Unpack(OSDMap map, IScene scene, EntityTransferContext ctx) |
780 | { | 889 | { |
781 | base.Unpack(map, scene); | 890 | base.Unpack(map, scene, ctx); |
782 | } | 891 | } |
783 | } | 892 | } |
784 | } | 893 | } |