diff options
Merge branch 'dev-appearance'
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 61 |
1 files changed, 52 insertions, 9 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index 4f89d78..be98380 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -26,7 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using log4net; | ||
30 | using OpenMetaverse; | 32 | using OpenMetaverse; |
31 | using OpenMetaverse.StructuredData; | 33 | using OpenMetaverse.StructuredData; |
32 | 34 | ||
@@ -38,6 +40,12 @@ namespace OpenSim.Framework | |||
38 | /// </summary> | 40 | /// </summary> |
39 | public class AgentCircuitData | 41 | public class AgentCircuitData |
40 | { | 42 | { |
43 | // DEBUG ON | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | // DEBUG OFF | ||
48 | |||
41 | /// <summary> | 49 | /// <summary> |
42 | /// Avatar Unique Agent Identifier | 50 | /// Avatar Unique Agent Identifier |
43 | /// </summary> | 51 | /// </summary> |
@@ -205,6 +213,7 @@ namespace OpenSim.Framework | |||
205 | args["mac"] = OSD.FromString(Mac); | 213 | args["mac"] = OSD.FromString(Mac); |
206 | args["id0"] = OSD.FromString(Id0); | 214 | args["id0"] = OSD.FromString(Id0); |
207 | 215 | ||
216 | /* | ||
208 | if (Appearance != null) | 217 | if (Appearance != null) |
209 | { | 218 | { |
210 | //System.Console.WriteLine("XXX Before packing Wearables"); | 219 | //System.Console.WriteLine("XXX Before packing Wearables"); |
@@ -221,20 +230,26 @@ namespace OpenSim.Framework | |||
221 | } | 230 | } |
222 | 231 | ||
223 | //System.Console.WriteLine("XXX Before packing Attachments"); | 232 | //System.Console.WriteLine("XXX Before packing Attachments"); |
224 | Dictionary<int, UUID[]> attachments = Appearance.GetAttachmentDictionary(); | 233 | Dictionary<int, AvatarAttachment> attachments = Appearance.Attachments; |
225 | if ((attachments != null) && (attachments.Count > 0)) | 234 | if ((attachments != null) && (attachments.Count > 0)) |
226 | { | 235 | { |
227 | OSDArray attachs = new OSDArray(attachments.Count); | 236 | OSDArray attachs = new OSDArray(attachments.Count); |
228 | foreach (KeyValuePair<int, UUID[]> kvp in attachments) | 237 | foreach (KeyValuePair<int, AvatarAttachment> kvp in attachments) |
229 | { | 238 | { |
230 | AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]); | 239 | AvatarAttachment adata = new AvatarAttachment(kvp.Value); |
231 | attachs.Add(adata.PackUpdateMessage()); | 240 | attachs.Add(adata.Pack()); |
232 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); | 241 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); |
233 | } | 242 | } |
234 | args["attachments"] = attachs; | 243 | args["attachments"] = attachs; |
235 | } | 244 | } |
236 | } | 245 | } |
237 | 246 | */ | |
247 | if (Appearance != null) | ||
248 | { | ||
249 | OSDMap appmap = Appearance.Pack(); | ||
250 | args["packed_appearance"] = appmap; | ||
251 | } | ||
252 | |||
238 | if (ServiceURLs != null && ServiceURLs.Count > 0) | 253 | if (ServiceURLs != null && ServiceURLs.Count > 0) |
239 | { | 254 | { |
240 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); | 255 | OSDArray urls = new OSDArray(ServiceURLs.Count * 2); |
@@ -317,9 +332,37 @@ namespace OpenSim.Framework | |||
317 | if (args["start_pos"] != null) | 332 | if (args["start_pos"] != null) |
318 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); | 333 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); |
319 | 334 | ||
335 | // DEBUG ON | ||
336 | m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); | ||
337 | // DEBUG OFF | ||
338 | |||
339 | try { | ||
340 | // Unpack various appearance elements | ||
320 | Appearance = new AvatarAppearance(AgentID); | 341 | Appearance = new AvatarAppearance(AgentID); |
342 | if (args["packed_appearance"] != null) | ||
343 | { | ||
344 | if (args["packed_appearance"].Type == OSDType.Map) | ||
345 | { | ||
346 | Appearance.Unpack((OSDMap)args["packed_appearance"]); | ||
347 | m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); | ||
348 | } | ||
349 | else | ||
350 | m_log.WarnFormat("[AGENTCIRCUITDATA] packed_appearance is not a map:\n{0}",args["packed_appearance"].ToString()); | ||
351 | } | ||
352 | // DEBUG ON | ||
353 | else | ||
354 | m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); | ||
355 | // DEBUG OFF | ||
356 | } catch (Exception e) | ||
357 | { | ||
358 | m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); | ||
359 | } | ||
360 | |||
361 | |||
362 | /* | ||
321 | if (args["appearance_serial"] != null) | 363 | if (args["appearance_serial"] != null) |
322 | Appearance.Serial = args["appearance_serial"].AsInteger(); | 364 | Appearance.Serial = args["appearance_serial"].AsInteger(); |
365 | |||
323 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 366 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
324 | { | 367 | { |
325 | OSDArray wears = (OSDArray)(args["wearables"]); | 368 | OSDArray wears = (OSDArray)(args["wearables"]); |
@@ -328,23 +371,23 @@ namespace OpenSim.Framework | |||
328 | Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); | 371 | Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); |
329 | Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); | 372 | Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); |
330 | } | 373 | } |
331 | } | 374 | } |
332 | 375 | ||
333 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | 376 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) |
334 | { | 377 | { |
335 | OSDArray attachs = (OSDArray)(args["attachments"]); | 378 | OSDArray attachs = (OSDArray)(args["attachments"]); |
336 | AttachmentData[] attachments = new AttachmentData[attachs.Count]; | 379 | AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count]; |
337 | int i = 0; | 380 | int i = 0; |
338 | foreach (OSD o in attachs) | 381 | foreach (OSD o in attachs) |
339 | { | 382 | { |
340 | if (o.Type == OSDType.Map) | 383 | if (o.Type == OSDType.Map) |
341 | { | 384 | { |
342 | attachments[i++] = new AttachmentData((OSDMap)o); | 385 | attachments[i++] = new AvatarAttachment((OSDMap)o); |
343 | } | 386 | } |
344 | } | 387 | } |
345 | Appearance.SetAttachments(attachments); | 388 | Appearance.SetAttachments(attachments); |
346 | } | 389 | } |
347 | 390 | */ | |
348 | ServiceURLs = new Dictionary<string, object>(); | 391 | ServiceURLs = new Dictionary<string, object>(); |
349 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | 392 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) |
350 | { | 393 | { |