clockwerk-opensim-stable – 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 ItemID;
234 public uint IgnoreControls;
235 public uint EventControls;
236  
237 public ControllerData(UUID item, uint ignore, uint ev)
238 {
239 ItemID = item;
240 IgnoreControls = ignore;
241 EventControls = ev;
242 }
243  
244 public ControllerData(OSDMap args)
245 {
246 UnpackUpdateMessage(args);
247 }
248  
249 public OSDMap PackUpdateMessage()
250 {
251 OSDMap controldata = new OSDMap();
252 controldata["item"] = OSD.FromUUID(ItemID);
253 controldata["ignore"] = OSD.FromInteger(IgnoreControls);
254 controldata["event"] = OSD.FromInteger(EventControls);
255  
256 return controldata;
257 }
258  
259  
260 public void UnpackUpdateMessage(OSDMap args)
261 {
262 if (args["item"] != null)
263 ItemID = args["item"].AsUUID();
264 if (args["ignore"] != null)
265 IgnoreControls = (uint)args["ignore"].AsInteger();
266 if (args["event"] != null)
267 EventControls = (uint)args["event"].AsInteger();
268 }
269 }
270  
271 public class AgentData : IAgentData
272 {
273 private UUID m_id;
274 public UUID AgentID
275 {
276 get { return m_id; }
277 set { m_id = value; }
278 }
279 public UUID RegionID;
280 public uint CircuitCode;
281 public UUID SessionID;
282  
283 public Vector3 Position;
284 public Vector3 Velocity;
285 public Vector3 Center;
286 public Vector3 Size;
287 public Vector3 AtAxis;
288 public Vector3 LeftAxis;
289 public Vector3 UpAxis;
290  
291 /// <summary>
292 /// Signal on a V2 teleport that Scene.IncomingChildAgentDataUpdate(AgentData ad) should wait for the
293 /// scene presence to become root (triggered when the viewer sends a CompleteAgentMovement UDP packet after
294 /// establishing the connection triggered by it's receipt of a TeleportFinish EQ message).
295 /// </summary>
296 public bool SenderWantsToWaitForRoot;
297  
298 public float Far;
299 public float Aspect;
300 //public int[] Throttles;
301 public byte[] Throttles;
302  
303 public uint LocomotionState;
304 public Quaternion HeadRotation;
305 public Quaternion BodyRotation;
306 public uint ControlFlags;
307 public float EnergyLevel;
308 public Byte GodLevel;
309 public bool AlwaysRun;
310 public UUID PreyAgent;
311 public Byte AgentAccess;
312 public UUID ActiveGroupID;
313  
314 public AgentGroupData[] Groups;
315 public Animation[] Anims;
316 public Animation DefaultAnim = null;
317 public Animation AnimState = null;
318  
319 public UUID GranterID;
320  
321 // Appearance
322 public AvatarAppearance Appearance;
323  
324 // DEBUG ON
325 private static readonly ILog m_log =
326 LogManager.GetLogger(
327 MethodBase.GetCurrentMethod().DeclaringType);
328 // DEBUG OFF
329  
330 /*
331 public byte[] AgentTextures;
332 public byte[] VisualParams;
333 public UUID[] Wearables;
334 public AvatarAttachment[] Attachments;
335 */
336 // Scripted
337 public ControllerData[] Controllers;
338  
339 public string CallbackURI;
340  
341 // These two must have the same Count
342 public List<ISceneObject> AttachmentObjects;
343 public List<string> AttachmentObjectStates;
344  
345 public virtual OSDMap Pack()
346 {
347 // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
348  
349 OSDMap args = new OSDMap();
350 args["message_type"] = OSD.FromString("AgentData");
351  
352 args["region_id"] = OSD.FromString(RegionID.ToString());
353 args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
354 args["agent_uuid"] = OSD.FromUUID(AgentID);
355 args["session_uuid"] = OSD.FromUUID(SessionID);
356  
357 args["position"] = OSD.FromString(Position.ToString());
358 args["velocity"] = OSD.FromString(Velocity.ToString());
359 args["center"] = OSD.FromString(Center.ToString());
360 args["size"] = OSD.FromString(Size.ToString());
361 args["at_axis"] = OSD.FromString(AtAxis.ToString());
362 args["left_axis"] = OSD.FromString(LeftAxis.ToString());
363 args["up_axis"] = OSD.FromString(UpAxis.ToString());
364  
365 //backwards compatibility
366 args["changed_grid"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
367 args["wait_for_root"] = OSD.FromBoolean(SenderWantsToWaitForRoot);
368 args["far"] = OSD.FromReal(Far);
369 args["aspect"] = OSD.FromReal(Aspect);
370  
371 if ((Throttles != null) && (Throttles.Length > 0))
372 args["throttles"] = OSD.FromBinary(Throttles);
373  
374 args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
375 args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
376 args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
377 args["control_flags"] = OSD.FromString(ControlFlags.ToString());
378  
379 args["energy_level"] = OSD.FromReal(EnergyLevel);
380 args["god_level"] = OSD.FromString(GodLevel.ToString());
381 args["always_run"] = OSD.FromBoolean(AlwaysRun);
382 args["prey_agent"] = OSD.FromUUID(PreyAgent);
383 args["agent_access"] = OSD.FromString(AgentAccess.ToString());
384  
385 args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
386  
387 if ((Groups != null) && (Groups.Length > 0))
388 {
389 OSDArray groups = new OSDArray(Groups.Length);
390 foreach (AgentGroupData agd in Groups)
391 groups.Add(agd.PackUpdateMessage());
392 args["groups"] = groups;
393 }
394  
395 if ((Anims != null) && (Anims.Length > 0))
396 {
397 OSDArray anims = new OSDArray(Anims.Length);
398 foreach (Animation aanim in Anims)
399 anims.Add(aanim.PackUpdateMessage());
400 args["animations"] = anims;
401 }
402  
403 if (DefaultAnim != null)
404 {
405 args["default_animation"] = DefaultAnim.PackUpdateMessage();
406 }
407  
408 if (AnimState != null)
409 {
410 args["animation_state"] = AnimState.PackUpdateMessage();
411 }
412  
413 if (Appearance != null)
414 args["packed_appearance"] = Appearance.Pack();
415  
416 //if ((AgentTextures != null) && (AgentTextures.Length > 0))
417 //{
418 // OSDArray textures = new OSDArray(AgentTextures.Length);
419 // foreach (UUID uuid in AgentTextures)
420 // textures.Add(OSD.FromUUID(uuid));
421 // args["agent_textures"] = textures;
422 //}
423  
424 // The code to pack textures, visuals, wearables and attachments
425 // should be removed; packed appearance contains the full appearance
426 // This is retained for backward compatibility only
427 if (Appearance.Texture != null)
428 {
429 byte[] rawtextures = Appearance.Texture.GetBytes();
430 args["texture_entry"] = OSD.FromBinary(rawtextures);
431 }
432  
433 if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0))
434 args["visual_params"] = OSD.FromBinary(Appearance.VisualParams);
435  
436 // We might not pass this in all cases...
437 if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
438 {
439 OSDArray wears = new OSDArray(Appearance.Wearables.Length);
440 foreach (AvatarWearable awear in Appearance.Wearables)
441 wears.Add(awear.Pack());
442  
443 args["wearables"] = wears;
444 }
445  
446 List<AvatarAttachment> attachments = Appearance.GetAttachments();
447 if ((attachments != null) && (attachments.Count > 0))
448 {
449 OSDArray attachs = new OSDArray(attachments.Count);
450 foreach (AvatarAttachment att in attachments)
451 attachs.Add(att.Pack());
452 args["attachments"] = attachs;
453 }
454 // End of code to remove
455  
456 if ((Controllers != null) && (Controllers.Length > 0))
457 {
458 OSDArray controls = new OSDArray(Controllers.Length);
459 foreach (ControllerData ctl in Controllers)
460 controls.Add(ctl.PackUpdateMessage());
461 args["controllers"] = controls;
462 }
463  
464 if ((CallbackURI != null) && (!CallbackURI.Equals("")))
465 args["callback_uri"] = OSD.FromString(CallbackURI);
466  
467 // Attachment objects for fatpack messages
468 if (AttachmentObjects != null)
469 {
470 int i = 0;
471 OSDArray attObjs = new OSDArray(AttachmentObjects.Count);
472 foreach (ISceneObject so in AttachmentObjects)
473 {
474 OSDMap info = new OSDMap(4);
475 info["sog"] = OSD.FromString(so.ToXml2());
476 info["extra"] = OSD.FromString(so.ExtraToXmlString());
477 info["modified"] = OSD.FromBoolean(so.HasGroupChanged);
478 try
479 {
480 info["state"] = OSD.FromString(AttachmentObjectStates[i++]);
481 }
482 catch (IndexOutOfRangeException)
483 {
484 m_log.WarnFormat("[CHILD AGENT DATA]: scripts list is shorter than object list.");
485 }
486  
487 attObjs.Add(info);
488 }
489 args["attach_objects"] = attObjs;
490 }
491 return args;
492 }
493  
494 /// <summary>
495 /// Deserialization of agent data.
496 /// Avoiding reflection makes it painful to write, but that's the price!
497 /// </summary>
498 /// <param name="hash"></param>
499 public virtual void Unpack(OSDMap args, IScene scene)
500 {
501 //m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
502  
503 if (args.ContainsKey("region_id"))
504 UUID.TryParse(args["region_id"].AsString(), out RegionID);
505  
506 if (args["circuit_code"] != null)
507 UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
508  
509 if (args["agent_uuid"] != null)
510 AgentID = args["agent_uuid"].AsUUID();
511  
512 if (args["session_uuid"] != null)
513 SessionID = args["session_uuid"].AsUUID();
514  
515 if (args["position"] != null)
516 Vector3.TryParse(args["position"].AsString(), out Position);
517  
518 if (args["velocity"] != null)
519 Vector3.TryParse(args["velocity"].AsString(), out Velocity);
520  
521 if (args["center"] != null)
522 Vector3.TryParse(args["center"].AsString(), out Center);
523  
524 if (args["size"] != null)
525 Vector3.TryParse(args["size"].AsString(), out Size);
526  
527 if (args["at_axis"] != null)
528 Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
529  
530 if (args["left_axis"] != null)
531 Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
532  
533 if (args["up_axis"] != null)
534 Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
535  
536 if (args.ContainsKey("wait_for_root") && args["wait_for_root"] != null)
537 SenderWantsToWaitForRoot = args["wait_for_root"].AsBoolean();
538  
539 if (args["far"] != null)
540 Far = (float)(args["far"].AsReal());
541  
542 if (args["aspect"] != null)
543 Aspect = (float)args["aspect"].AsReal();
544  
545 if (args["throttles"] != null)
546 Throttles = args["throttles"].AsBinary();
547  
548 if (args["locomotion_state"] != null)
549 UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
550  
551 if (args["head_rotation"] != null)
552 Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
553  
554 if (args["body_rotation"] != null)
555 Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
556  
557 if (args["control_flags"] != null)
558 UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
559  
560 if (args["energy_level"] != null)
561 EnergyLevel = (float)(args["energy_level"].AsReal());
562  
563 if (args["god_level"] != null)
564 Byte.TryParse(args["god_level"].AsString(), out GodLevel);
565  
566 if (args["always_run"] != null)
567 AlwaysRun = args["always_run"].AsBoolean();
568  
569 if (args["prey_agent"] != null)
570 PreyAgent = args["prey_agent"].AsUUID();
571  
572 if (args["agent_access"] != null)
573 Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
574  
575 if (args["active_group_id"] != null)
576 ActiveGroupID = args["active_group_id"].AsUUID();
577  
578 if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array)
579 {
580 OSDArray groups = (OSDArray)(args["groups"]);
581 Groups = new AgentGroupData[groups.Count];
582 int i = 0;
583 foreach (OSD o in groups)
584 {
585 if (o.Type == OSDType.Map)
586 {
587 Groups[i++] = new AgentGroupData((OSDMap)o);
588 }
589 }
590 }
591  
592 if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
593 {
594 OSDArray anims = (OSDArray)(args["animations"]);
595 Anims = new Animation[anims.Count];
596 int i = 0;
597 foreach (OSD o in anims)
598 {
599 if (o.Type == OSDType.Map)
600 {
601 Anims[i++] = new Animation((OSDMap)o);
602 }
603 }
604 }
605  
606 if (args["default_animation"] != null)
607 {
608 try
609 {
610 DefaultAnim = new Animation((OSDMap)args["default_animation"]);
611 }
612 catch
613 {
614 DefaultAnim = null;
615 }
616 }
617  
618 if (args["animation_state"] != null)
619 {
620 try
621 {
622 AnimState = new Animation((OSDMap)args["animation_state"]);
623 }
624 catch
625 {
626 AnimState = null;
627 }
628 }
629  
630 //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
631 //{
632 // OSDArray textures = (OSDArray)(args["agent_textures"]);
633 // AgentTextures = new UUID[textures.Count];
634 // int i = 0;
635 // foreach (OSD o in textures)
636 // AgentTextures[i++] = o.AsUUID();
637 //}
638  
639 Appearance = new AvatarAppearance();
640  
641 // The code to unpack textures, visuals, wearables and attachments
642 // should be removed; packed appearance contains the full appearance
643 // This is retained for backward compatibility only
644 if (args["texture_entry"] != null)
645 {
646 byte[] rawtextures = args["texture_entry"].AsBinary();
647 Primitive.TextureEntry textures = new Primitive.TextureEntry(rawtextures,0,rawtextures.Length);
648 Appearance.SetTextureEntries(textures);
649 }
650  
651 if (args["visual_params"] != null)
652 Appearance.SetVisualParams(args["visual_params"].AsBinary());
653  
654 if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
655 {
656 OSDArray wears = (OSDArray)(args["wearables"]);
657 for (int i = 0; i < wears.Count / 2; i++)
658 {
659 AvatarWearable awear = new AvatarWearable((OSDArray)wears[i]);
660 Appearance.SetWearable(i,awear);
661 }
662 }
663  
664 if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
665 {
666 OSDArray attachs = (OSDArray)(args["attachments"]);
667 foreach (OSD o in attachs)
668 {
669 if (o.Type == OSDType.Map)
670 {
671 // We know all of these must end up as attachments so we
672 // append rather than replace to ensure multiple attachments
673 // per point continues to work
674 // m_log.DebugFormat("[CHILDAGENTDATAUPDATE]: Appending attachments for {0}", AgentID);
675 Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
676 }
677 }
678 }
679 // end of code to remove
680  
681 if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map)
682 Appearance = new AvatarAppearance((OSDMap)args["packed_appearance"]);
683 else
684 m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance");
685  
686 if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
687 {
688 OSDArray controls = (OSDArray)(args["controllers"]);
689 Controllers = new ControllerData[controls.Count];
690 int i = 0;
691 foreach (OSD o in controls)
692 {
693 if (o.Type == OSDType.Map)
694 {
695 Controllers[i++] = new ControllerData((OSDMap)o);
696 }
697 }
698 }
699  
700 if (args["callback_uri"] != null)
701 CallbackURI = args["callback_uri"].AsString();
702  
703 // Attachment objects
704 if (args["attach_objects"] != null && args["attach_objects"].Type == OSDType.Array)
705 {
706 OSDArray attObjs = (OSDArray)(args["attach_objects"]);
707 AttachmentObjects = new List<ISceneObject>();
708 AttachmentObjectStates = new List<string>();
709 foreach (OSD o in attObjs)
710 {
711 if (o.Type == OSDType.Map)
712 {
713 OSDMap info = (OSDMap)o;
714 ISceneObject so = scene.DeserializeObject(info["sog"].AsString());
715 so.ExtraFromXmlString(info["extra"].AsString());
716 so.HasGroupChanged = info["modified"].AsBoolean();
717 AttachmentObjects.Add(so);
718 AttachmentObjectStates.Add(info["state"].AsString());
719 }
720 }
721 }
722 }
723  
724 public AgentData()
725 {
726 }
727  
728 public AgentData(Hashtable hash)
729 {
730 //UnpackUpdateMessage(hash);
731 }
732  
733 public void Dump()
734 {
735 System.Console.WriteLine("------------ AgentData ------------");
736 System.Console.WriteLine("UUID: " + AgentID);
737 System.Console.WriteLine("Region: " + RegionID);
738 System.Console.WriteLine("Position: " + Position);
739 }
740 }
741  
742 public class CompleteAgentData : AgentData
743 {
744 public override OSDMap Pack()
745 {
746 return base.Pack();
747 }
748  
749 public override void Unpack(OSDMap map, IScene scene)
750 {
751 base.Unpack(map, scene);
752 }
753 }
754 }