From e02062051d38e56ec22952e25a558039b5e54ab3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 16 Aug 2009 16:17:19 -0700 Subject: Making attachments work again. Tons of debug more. This needs more testing and a lot of cleaning. --- OpenSim/Framework/AgentCircuitData.cs | 1 + OpenSim/Framework/ChildAgentDataUpdate.cs | 64 ++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 6472f31..c0168e2 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -215,6 +215,7 @@ namespace OpenSim.Framework } } + /// /// Serializable Agent Circuit Data /// diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index aacd127..825ab81 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -226,6 +226,46 @@ namespace OpenSim.Framework } } + public class AttachmentData + { + public int AttachPoint; + public UUID ItemID; + public UUID AssetID; + + public AttachmentData(int point, UUID item, UUID asset) + { + AttachPoint = point; + ItemID = item; + AssetID = asset; + } + + public AttachmentData(OSDMap args) + { + UnpackUpdateMessage(args); + } + + public OSDMap PackUpdateMessage() + { + OSDMap attachdata = new OSDMap(); + attachdata["point"] = OSD.FromInteger(AttachPoint); + attachdata["item"] = OSD.FromUUID(ItemID); + attachdata["asset"] = OSD.FromUUID(AssetID); + + return attachdata; + } + + + public void UnpackUpdateMessage(OSDMap args) + { + if (args["point"] != null) + AttachPoint = args["point"].AsInteger(); + if (args["item"] != null) + ItemID = args["item"].AsUUID(); + if (args["asset"] != null) + AssetID = args["asset"].AsUUID(); + } + } + public class AgentData : IAgentData { private UUID m_id; @@ -272,6 +312,7 @@ namespace OpenSim.Framework public byte[] AgentTextures; public byte[] VisualParams; public UUID[] Wearables; + public AttachmentData[] Attachments; public string CallbackURI; @@ -352,6 +393,13 @@ namespace OpenSim.Framework args["wearables"] = wears; } + if ((Attachments != null) && (Attachments.Length > 0)) + { + OSDArray attachs = new OSDArray(Attachments.Length); + foreach (AttachmentData att in Attachments) + attachs.Add(att.PackUpdateMessage()); + args["attachments"] = attachs; + } if ((CallbackURI != null) && (!CallbackURI.Equals(""))) args["callback_uri"] = OSD.FromString(CallbackURI); @@ -492,7 +540,21 @@ namespace OpenSim.Framework foreach (OSD o in wears) Wearables[i++] = o.AsUUID(); } - + + if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) + { + OSDArray attachs = (OSDArray)(args["attachments"]); + Attachments = new AttachmentData[attachs.Count]; + int i = 0; + foreach (OSD o in attachs) + { + if (o.Type == OSDType.Map) + { + Attachments[i++] = new AttachmentData((OSDMap)o); + } + } + } + if (args["callback_uri"] != null) CallbackURI = args["callback_uri"].AsString(); } -- cgit v1.1