clockwerk-opensim – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 vero 1 /*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27  
28 using System;
29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
32 using log4net;
33 using OpenMetaverse;
34 using OpenMetaverse.StructuredData;
35  
36 namespace OpenSim.Framework
37 {
38 // Soon to be dismissed
39 [Serializable]
40 public class ChildAgentDataUpdate
41 {
42 public Guid ActiveGroupID;
43 public Guid AgentID;
44 public bool alwaysrun;
45 public float AVHeight;
46 public Vector3 cameraPosition;
47 public float drawdistance;
48 public float godlevel;
49 public uint GroupAccess;
50 public Vector3 Position;
51 public ulong regionHandle;
52 public byte[] throttles;
53 public Vector3 Velocity;
54  
55 public ChildAgentDataUpdate()
56 {
57 }
58 }
59  
60 public interface IAgentData
61 {
62 UUID AgentID { get; set; }
63  
64 OSDMap Pack();
65 void Unpack(OSDMap map, IScene scene);
66 }
67  
68 /// <summary>
69 /// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
70 /// </summary>
71 public class AgentPosition : IAgentData
72 {
73 private UUID m_id;
74 public UUID AgentID
75 {
76 get { return m_id; }
77 set { m_id = value; }
78 }
79  
80 public ulong RegionHandle;
81 public uint CircuitCode;
82 public UUID SessionID;
83  
84 public float Far;
85 public Vector3 Position;
86 public Vector3 Velocity;
87 public Vector3 Center;
88 public Vector3 Size;
89 public Vector3 AtAxis;
90 public Vector3 LeftAxis;
91 public Vector3 UpAxis;
92 public bool ChangedGrid;
93  
94 // This probably shouldn't be here
95 public byte[] Throttles;
96  
97  
98 public OSDMap Pack()
99 {
100 OSDMap args = new OSDMap();
101 args["message_type"] = OSD.FromString("AgentPosition");
102  
103 args["region_handle"] = OSD.FromString(RegionHandle.ToString());
104 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
105 args["agent_uuid"] = OSD.FromUUID(AgentID);
106 args["session_uuid"] = OSD.FromUUID(SessionID);
107  
108 args["position"] = OSD.FromString(Position.ToString());
109 args["velocity"] = OSD.FromString(Velocity.ToString());
110 args["center"] = OSD.FromString(Center.ToString());
111 args["size"] = OSD.FromString(Size.ToString());
112 args["at_axis"] = OSD.FromString(AtAxis.ToString());
113 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
114 args["up_axis"] = OSD.FromString(UpAxis.ToString());
115  
116 args["far"] = OSD.FromReal(Far);
117 args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
118  
119 if ((Throttles != null) && (Throttles.Length > 0))
120 args["throttles"] = OSD.FromBinary(Throttles);
121  
122 return args;
123 }
124  
125 public void Unpack(OSDMap args, IScene scene)
126 {
127 if (args.ContainsKey("region_handle"))
128 UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
129  
130 if (args["circuit_code"] != null)
131 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
132  
133 if (args["agent_uuid"] != null)
134 AgentID = args["agent_uuid"].AsUUID();
135  
136 if (args["session_uuid"] != null)
137 SessionID = args["session_uuid"].AsUUID();
138  
139 if (args["position"] != null)
140 Vector3.TryParse(args["position"].AsString(), out Position);
141  
142 if (args["velocity"] != null)
143 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
144  
145 if (args["center"] != null)
146 Vector3.TryParse(args["center"].AsString(), out Center);
147  
148 if (args["size"] != null)
149 Vector3.TryParse(args["size"].AsString(), out Size);
150  
151 if (args["at_axis"] != null)
152 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
153  
154 if (args["left_axis"] != null)
155 Vector3.TryParse(args["left_axis"].AsString(), out LeftAxis);
156  
157 if (args["up_axis"] != null)
158 Vector3.TryParse(args["up_axis"].AsString(), out UpAxis);
159  
160 if (args["changed_grid"] != null)
161 ChangedGrid = args["changed_grid"].AsBoolean();
162  
163 if (args["far"] != null)
164 Far = (float)(args["far"].AsReal());
165  
166 if (args["throttles"] != null)
167 Throttles = args["throttles"].AsBinary();
168 }
169  
170 /// <summary>
171 /// Soon to be decommissioned
172 /// </summary>
173 /// <param name="cAgent"></param>
174 public void CopyFrom(ChildAgentDataUpdate cAgent, UUID sid)
175 {
176 AgentID = new UUID(cAgent.AgentID);
177 SessionID = sid;
178  
179 // next: ???
180 Size = new Vector3();
181 Size.Z = cAgent.AVHeight;
182  
183 Center = cAgent.cameraPosition;
184 Far = cAgent.drawdistance;
185 Position = cAgent.Position;
186 RegionHandle = cAgent.regionHandle;
187 Throttles = cAgent.throttles;
188 Velocity = cAgent.Velocity;
189 }
190 }
191  
192 public class AgentGroupData
193 {
194 public UUID GroupID;
195 public ulong GroupPowers;
196 public bool AcceptNotices;
197  
198 public AgentGroupData(UUID id, ulong powers, bool notices)
199 {
200 GroupID = id;
201 GroupPowers = powers;
202 AcceptNotices = notices;
203 }
204  
205 public AgentGroupData(OSDMap args)
206 {
207 UnpackUpdateMessage(args);
208 }
209  
210 public OSDMap PackUpdateMessage()
211 {
212 OSDMap groupdata = new OSDMap();
213 groupdata["group_id"] = OSD.FromUUID(GroupID);
214 groupdata["group_powers"] = OSD.FromString(GroupPowers.ToString());
215 groupdata["accept_notices"] = OSD.FromBoolean(AcceptNotices);
216  
217 return groupdata;
218 }
219  
220 public void UnpackUpdateMessage(OSDMap args)
221 {
222 if (args["group_id"] != null)
223 GroupID = args["group_id"].AsUUID();
224 if (args["group_powers"] != null)
225 UInt64.TryParse((string)args["group_powers"].AsString(), out GroupPowers);
226 if (args["accept_notices"] != null)
227 AcceptNotices = args["accept_notices"].AsBoolean();
228 }
229 }
230  
231 public class ControllerData
232 {
233 public UUID ObjectID;
234 public UUID ItemID;
235 public uint IgnoreControls;
236 public uint EventControls;
237  
238 public ControllerData(UUID obj, UUID item, uint ignore, uint ev)
239 {
240 ObjectID = obj;
241 ItemID = item;
242 IgnoreControls = ignore;
243 EventControls = ev;
244 }
245  
246 public ControllerData(OSDMap args)
247 {
248 UnpackUpdateMessage(args);
249 }
250  
251 public OSDMap PackUpdateMessage()
252 {
253 OSDMap controldata = new OSDMap();
254 controldata["object"] = OSD.FromUUID(ObjectID);
255 controldata["item"] = OSD.FromUUID(ItemID);
256 controldata["ignore"] = OSD.FromInteger(IgnoreControls);
257 controldata["event"] = OSD.FromInteger(EventControls);
258  
259 return controldata;
260 }
261  
262  
263 public void UnpackUpdateMessage(OSDMap args)
264 {
265 if (args["object"] != null)
266 ObjectID = args["object"].AsUUID();
267 if (args["item"] != null)
268 ItemID = args["item"].AsUUID();
269 if (args["ignore"] != null)
270 IgnoreControls = (uint)args["ignore"].AsInteger();
271 if (args["event"] != null)
272 EventControls = (uint)args["event"].AsInteger();
273 }
274 }
275  
276 public class AgentData : IAgentData
277 {
278 private UUID m_id;
279 public UUID AgentID
280 {
281 get { return m_id; }
282 set { m_id = value; }
283 }
284 public UUID RegionID;
285 public uint CircuitCode;
286 public UUID SessionID;
287  
288 public Vector3 Position;
289 public Vector3 Velocity;
290 public Vector3 Center;
291 public Vector3 Size;
292 public Vector3 AtAxis;
293 public Vector3 LeftAxis;
294 public Vector3 UpAxis;
295  
296 /// <summary>
297 /// 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
299 /// establishing the connection triggered by it's receipt of a TeleportFinish EQ message).
300 /// </summary>
301 public bool SenderWantsToWaitForRoot;
302  
303 public float Far;
304 public float Aspect;
305 //public int[] Throttles;
306 public byte[] Throttles;
307  
308 public uint LocomotionState;
309 public Quaternion HeadRotation;
310 public Quaternion BodyRotation;
311 public uint ControlFlags;
312 public float EnergyLevel;
313 public Byte GodLevel;
314 public bool AlwaysRun;
315 public UUID PreyAgent;
316 public Byte AgentAccess;
317 public UUID ActiveGroupID;
318  
319 public AgentGroupData[] Groups;
320 public Animation[] Anims;
321 public Animation DefaultAnim = null;
322 public Animation AnimState = null;
323  
324 public UUID GranterID;
325 public UUID ParentPart;
326 public Vector3 SitOffset;
327  
328 // Appearance
329 public AvatarAppearance Appearance;
330  
331 // DEBUG ON
332 private static readonly ILog m_log =
333 LogManager.GetLogger(
334 MethodBase.GetCurrentMethod().DeclaringType);
335 // DEBUG OFF
336  
337 /*
338 public byte[] AgentTextures;
339 public byte[] VisualParams;
340 public UUID[] Wearables;
341 public AvatarAttachment[] Attachments;
342 */
343 // Scripted
344 public ControllerData[] Controllers;
345  
346 public string CallbackURI;
347  
348 // These two must have the same Count
349 public List<ISceneObject> AttachmentObjects;
350 public List<string> AttachmentObjectStates;
351  
352 public virtual OSDMap Pack()
353 {
354 // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
355  
356 OSDMap args = new OSDMap();
357 args["message_type"] = OSD.FromString("AgentData");
358  
359 args["region_id"] = OSD.FromString(RegionID.ToString());
360 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
361 args["agent_uuid"] = OSD.FromUUID(AgentID);
362 args["session_uuid"] = OSD.FromUUID(SessionID);
363  
364 args["position"] = OSD.FromString(Position.ToString());
365 args["velocity"] = OSD.FromString(Velocity.ToString());
366 args["center"] = OSD.FromString(Center.ToString());
367 args["size"] = OSD.FromString(Size.ToString());
368 args["at_axis"] = OSD.FromString(AtAxis.ToString());
369 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
370 args["up_axis"] = OSD.FromString(UpAxis.ToString());
371  
372 //backwards compatibility
373 args["changed_grid"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
374 args["wait_for_root"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
375 args["far"] = OSD.FromReal(Far);
376 args["aspect"] = OSD.FromReal(Aspect);
377  
378 if ((Throttles != null) && (Throttles.Length > 0))
379 args["throttles"] = OSD.FromBinary(Throttles);
380  
381 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
382 args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
383 args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
384 args["control_flags"] = OSD.FromString(ControlFlags.ToString());
385  
386 args["energy_level"] = OSD.FromReal(EnergyLevel);
387 args["god_level"] = OSD.FromString(GodLevel.ToString());
388 args["always_run"] = OSD.FromBoolean(AlwaysRun);
389 args["prey_agent"] = OSD.FromUUID(PreyAgent);
390 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
391  
392 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
393  
394 if ((Groups != null) && (Groups.Length > 0))
395 {
396 OSDArray groups = new OSDArray(Groups.Length);
397 foreach (AgentGroupData agd in Groups)
398 groups.Add(agd.PackUpdateMessage());
399 args["groups"] = groups;
400 }
401  
402 if ((Anims != null) && (Anims.Length > 0))
403 {
404 OSDArray anims = new OSDArray(Anims.Length);
405 foreach (Animation aanim in Anims)
406 anims.Add(aanim.PackUpdateMessage());
407 args["animations"] = anims;
408 }
409  
410 if (DefaultAnim != null)
411 {
412 args["default_animation"] = DefaultAnim.PackUpdateMessage();
413 }
414  
415 if (AnimState != null)
416 {
417 args["animation_state"] = AnimState.PackUpdateMessage();
418 }
419  
420 if (Appearance != null)
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 {
436 byte[] rawtextures = Appearance.Texture.GetBytes();
437 args["texture_entry"] = OSD.FromBinary(rawtextures);
438 }
439  
440 if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 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 {
446 OSDArray wears = new OSDArray(Appearance.Wearables.Length);
447 foreach (AvatarWearable awear in Appearance.Wearables)
448 wears.Add(awear.Pack());
449  
450 args["wearables"] = wears;
451 }
452  
453 List<AvatarAttachment> attachments = Appearance.GetAttachments();
454 if ((attachments != null) && (attachments.Count > 0))
455 {
456 OSDArray attachs = new OSDArray(attachments.Count);
457 foreach (AvatarAttachment att in attachments)
458 attachs.Add(att.Pack());
459 args["attachments"] = attachs;
460 }
461 // End of code to remove
462  
463 if ((Controllers != null) && (Controllers.Length > 0))
464 {
465 OSDArray controls = new OSDArray(Controllers.Length);
466 foreach (ControllerData ctl in Controllers)
467 controls.Add(ctl.PackUpdateMessage());
468 args["controllers"] = controls;
469 }
470  
471 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
472 args["callback_uri"] = OSD.FromString(CallbackURI);
473  
474 // Attachment objects for fatpack messages
475 if (AttachmentObjects != null)
476 {
477 int i = 0;
478 OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
479 foreach (ISceneObject so in AttachmentObjects)
480 {
481 OSDMap info = new OSDMap(4);
482 info["sog"] = OSD.FromString(so.ToXml2());
483 info["extra"] = OSD.FromString(so.ExtraToXmlString());
484 info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
485 try
486 {
487 info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
488 }
489 catch (IndexOutOfRangeException)
490 {
491 m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list.");
492 }
493  
494 attObjs.Add(info);
495 }
496 args["attach_objects"] = attObjs;
497 }
498  
499 args["parent_part"] = OSD.FromUUID(ParentPart);
500 args["sit_offset"] = OSD.FromString(SitOffset.ToString());
501  
502 return args;
503 }
504  
505 /// <summary>
506 /// Deserialization of agent data.
507 /// Avoiding reflection makes it painful to write, but that's the price!
508 /// </summary>
509 /// <param name="hash"></param>
510 public virtual void Unpack(OSDMap args, IScene scene)
511 {
512 //m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
513  
514 if (args.ContainsKey("region_id"))
515 UUID.TryParse(args["region_id"].AsString(), out RegionID);
516  
517 if (args["circuit_code"] != null)
518 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
519  
520 if (args["agent_uuid"] != null)
521 AgentID = args["agent_uuid"].AsUUID();
522  
523 if (args["session_uuid"] != null)
524 SessionID = args["session_uuid"].AsUUID();
525  
526 if (args["position"] != null)
527 Vector3.TryParse(args["position"].AsString(), out Position);
528  
529 if (args["velocity"] != null)
530 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
531  
532 if (args["center"] != null)
533 Vector3.TryParse(args["center"].AsString(), out Center);
534  
535 if (args["size"] != null)
536 Vector3.TryParse(args["size"].AsString(), out Size);
537  
538 if (args["at_axis"] != null)
539 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
540  
541 if (args["left_axis"] != null)
542 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
543  
544 if (args["up_axis"] != null)
545 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
546  
547 if (args.ContainsKey("wait_for_root") && args["wait_for_root"] != null)
548 SenderWantsToWaitForRoot = args["wait_for_root"].AsBoolean();
549  
550 if (args["far"] != null)
551 Far = (float)(args["far"].AsReal());
552  
553 if (args["aspect"] != null)
554 Aspect = (float)args["aspect"].AsReal();
555  
556 if (args["throttles"] != null)
557 Throttles = args["throttles"].AsBinary();
558  
559 if (args["locomotion_state"] != null)
560 UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
561  
562 if (args["head_rotation"] != null)
563 Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
564  
565 if (args["body_rotation"] != null)
566 Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
567  
568 if (args["control_flags"] != null)
569 UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
570  
571 if (args["energy_level"] != null)
572 EnergyLevel = (float)(args["energy_level"].AsReal());
573  
574 if (args["god_level"] != null)
575 Byte.TryParse(args["god_level"].AsString(), out GodLevel);
576  
577 if (args["always_run"] != null)
578 AlwaysRun = args["always_run"].AsBoolean();
579  
580 if (args["prey_agent"] != null)
581 PreyAgent = args["prey_agent"].AsUUID();
582  
583 if (args["agent_access"] != null)
584 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
585  
586 if (args["active_group_id"] != null)
587 ActiveGroupID = args["active_group_id"].AsUUID();
588  
589 if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array)
590 {
591 OSDArray groups = (OSDArray)(args["groups"]);
592 Groups = new AgentGroupData[groups.Count];
593 int i = 0;
594 foreach (OSD o in groups)
595 {
596 if (o.Type == OSDType.Map)
597 {
598 Groups[i++] = new AgentGroupData((OSDMap)o);
599 }
600 }
601 }
602  
603 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
604 {
605 OSDArray anims = (OSDArray)(args["animations"]);
606 Anims = new Animation[anims.Count];
607 int i = 0;
608 foreach (OSD o in anims)
609 {
610 if (o.Type == OSDType.Map)
611 {
612 Anims[i++] = new Animation((OSDMap)o);
613 }
614 }
615 }
616  
617 if (args["default_animation"] != null)
618 {
619 try
620 {
621 DefaultAnim = new Animation((OSDMap)args["default_animation"]);
622 }
623 catch
624 {
625 DefaultAnim = null;
626 }
627 }
628  
629 if (args["animation_state"] != null)
630 {
631 try
632 {
633 AnimState = new Animation((OSDMap)args["animation_state"]);
634 }
635 catch
636 {
637 AnimState = null;
638 }
639 }
640  
641 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
642 //{
643 // OSDArray textures = (OSDArray)(args["agent_textures"]);
644 // AgentTextures = new UUID[textures.Count];
645 // int i = 0;
646 // foreach (OSD o in textures)
647 // AgentTextures[i++] = o.AsUUID();
648 //}
649  
650 Appearance = new AvatarAppearance();
651  
652 // The code to unpack textures, visuals, wearables and attachments
653 // should be removed; packed appearance contains the full appearance
654 // This is retained for backward compatibility only
655 if (args["texture_entry"] != null)
656 {
657 byte[] rawtextures = args["texture_entry"].AsBinary();
658 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length);
659 Appearance.SetTextureEntries(textures);
660 }
661  
662 if (args["visual_params"] != null)
663 Appearance.SetVisualParams(args["visual_params"].AsBinary());
664  
665 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
666 {
667 OSDArray wears = (OSDArray)(args["wearables"]);
668 for (int i = 0; i < wears.Count / 2; i++)
669 {
670 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
671 Appearance.SetWearable(i,awear);
672 }
673 }
674  
675 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
676 {
677 OSDArray attachs = (OSDArray)(args["attachments"]);
678 foreach (OSD o in attachs)
679 {
680 if (o.Type == OSDType.Map)
681 {
682 // We know all of these must end up as attachments so we
683 // append rather than replace to ensure multiple attachments
684 // per point continues to work
685 // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
686 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
687 }
688 }
689 }
690 // end of code to remove
691  
692 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
693 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
694 else
695 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
696  
697 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
698 {
699 OSDArray controls = (OSDArray)(args["controllers"]);
700 Controllers = new ControllerData[controls.Count];
701 int i = 0;
702 foreach (OSD o in controls)
703 {
704 if (o.Type == OSDType.Map)
705 {
706 Controllers[i++] = new ControllerData((OSDMap)o);
707 }
708 }
709 }
710  
711 if (args["callback_uri"] != null)
712 CallbackURI = args["callback_uri"].AsString();
713  
714 // Attachment objects
715 if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
716 {
717 OSDArray attObjs = (OSDArray)(args["attach_objects"]);
718 AttachmentObjects = new List<ISceneObject>();
719 AttachmentObjectStates = new List<string>();
720 foreach (OSD o in attObjs)
721 {
722 if (o.Type == OSDType.Map)
723 {
724 OSDMap info = (OSDMap)o;
725 ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
726 so.ExtraFromXmlString(info["extra"].AsString());
727 so.HasGroupChanged = info["modified"].AsBoolean();
728 AttachmentObjects.Add(so);
729 AttachmentObjectStates.Add(info["state"].AsString());
730 }
731 }
732 }
733  
734 if (args["parent_part"] != null)
735 ParentPart = args["parent_part"].AsUUID();
736 if (args["sit_offset"] != null)
737 Vector3.TryParse(args["sit_offset"].AsString(), out SitOffset);
738 }
739  
740 public AgentData()
741 {
742 }
743  
744 public AgentData(Hashtable hash)
745 {
746 //UnpackUpdateMessage(hash);
747 }
748  
749 public void Dump()
750 {
751 System.Console.WriteLine("------------ AgentData ------------");
752 System.Console.WriteLine("UUID: " + AgentID);
753 System.Console.WriteLine("Region: " + RegionID);
754 System.Console.WriteLine("Position: " + Position);
755 }
756 }
757  
758 public class CompleteAgentData : AgentData
759 {
760 public override OSDMap Pack()
761 {
762 return base.Pack();
763 }
764  
765 public override void Unpack(OSDMap map, IScene scene)
766 {
767 base.Unpack(map, scene);
768 }
769 }
770 }