diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/AgentCircuitData.cs | 65 | ||||
-rw-r--r-- | OpenSim/Framework/ChildAgentDataUpdate.cs | 70 |
2 files changed, 73 insertions, 62 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index be98380..30a9548 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -206,16 +206,18 @@ namespace OpenSim.Framework | |||
206 | 206 | ||
207 | args["service_session_id"] = OSD.FromString(ServiceSessionID); | 207 | args["service_session_id"] = OSD.FromString(ServiceSessionID); |
208 | args["start_pos"] = OSD.FromString(startpos.ToString()); | 208 | args["start_pos"] = OSD.FromString(startpos.ToString()); |
209 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); | ||
210 | args["client_ip"] = OSD.FromString(IPAddress); | 209 | args["client_ip"] = OSD.FromString(IPAddress); |
211 | args["viewer"] = OSD.FromString(Viewer); | 210 | args["viewer"] = OSD.FromString(Viewer); |
212 | args["channel"] = OSD.FromString(Channel); | 211 | args["channel"] = OSD.FromString(Channel); |
213 | args["mac"] = OSD.FromString(Mac); | 212 | args["mac"] = OSD.FromString(Mac); |
214 | args["id0"] = OSD.FromString(Id0); | 213 | args["id0"] = OSD.FromString(Id0); |
215 | 214 | ||
216 | /* | 215 | // Eventually this code should be deprecated, use full appearance |
216 | // packing in packed_appearance | ||
217 | if (Appearance != null) | 217 | if (Appearance != null) |
218 | { | 218 | { |
219 | args["appearance_serial"] = OSD.FromInteger(Appearance.Serial); | ||
220 | |||
219 | //System.Console.WriteLine("XXX Before packing Wearables"); | 221 | //System.Console.WriteLine("XXX Before packing Wearables"); |
220 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) | 222 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) |
221 | { | 223 | { |
@@ -230,20 +232,19 @@ namespace OpenSim.Framework | |||
230 | } | 232 | } |
231 | 233 | ||
232 | //System.Console.WriteLine("XXX Before packing Attachments"); | 234 | //System.Console.WriteLine("XXX Before packing Attachments"); |
233 | Dictionary<int, AvatarAttachment> attachments = Appearance.Attachments; | 235 | List<AvatarAttachment> attachments = Appearance.GetAttachments(); |
234 | if ((attachments != null) && (attachments.Count > 0)) | 236 | if ((attachments != null) && (attachments.Count > 0)) |
235 | { | 237 | { |
236 | OSDArray attachs = new OSDArray(attachments.Count); | 238 | OSDArray attachs = new OSDArray(attachments.Count); |
237 | foreach (KeyValuePair<int, AvatarAttachment> kvp in attachments) | 239 | foreach (AvatarAttachment attach in attachments) |
238 | { | 240 | { |
239 | AvatarAttachment adata = new AvatarAttachment(kvp.Value); | 241 | attachs.Add(attach.Pack()); |
240 | attachs.Add(adata.Pack()); | ||
241 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); | 242 | //System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]); |
242 | } | 243 | } |
243 | args["attachments"] = attachs; | 244 | args["attachments"] = attachs; |
244 | } | 245 | } |
245 | } | 246 | } |
246 | */ | 247 | |
247 | if (Appearance != null) | 248 | if (Appearance != null) |
248 | { | 249 | { |
249 | OSDMap appmap = Appearance.Pack(); | 250 | OSDMap appmap = Appearance.Pack(); |
@@ -339,27 +340,9 @@ namespace OpenSim.Framework | |||
339 | try { | 340 | try { |
340 | // Unpack various appearance elements | 341 | // Unpack various appearance elements |
341 | Appearance = new AvatarAppearance(AgentID); | 342 | Appearance = new AvatarAppearance(AgentID); |
342 | if (args["packed_appearance"] != null) | 343 | |
343 | { | 344 | // Eventually this code should be deprecated, use full appearance |
344 | if (args["packed_appearance"].Type == OSDType.Map) | 345 | // packing in packed_appearance |
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 | /* | ||
363 | if (args["appearance_serial"] != null) | 346 | if (args["appearance_serial"] != null) |
364 | Appearance.Serial = args["appearance_serial"].AsInteger(); | 347 | Appearance.Serial = args["appearance_serial"].AsInteger(); |
365 | 348 | ||
@@ -376,18 +359,34 @@ namespace OpenSim.Framework | |||
376 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | 359 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) |
377 | { | 360 | { |
378 | OSDArray attachs = (OSDArray)(args["attachments"]); | 361 | OSDArray attachs = (OSDArray)(args["attachments"]); |
379 | AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count]; | ||
380 | int i = 0; | ||
381 | foreach (OSD o in attachs) | 362 | foreach (OSD o in attachs) |
382 | { | 363 | { |
383 | if (o.Type == OSDType.Map) | 364 | if (o.Type == OSDType.Map) |
384 | { | 365 | { |
385 | attachments[i++] = new AvatarAttachment((OSDMap)o); | 366 | Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o)); |
386 | } | 367 | } |
387 | } | 368 | } |
388 | Appearance.SetAttachments(attachments); | ||
389 | } | 369 | } |
390 | */ | 370 | |
371 | if (args["packed_appearance"] != null) | ||
372 | { | ||
373 | if (args["packed_appearance"].Type == OSDType.Map) | ||
374 | { | ||
375 | Appearance.Unpack((OSDMap)args["packed_appearance"]); | ||
376 | m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); | ||
377 | } | ||
378 | else | ||
379 | m_log.WarnFormat("[AGENTCIRCUITDATA] packed_appearance is not a map:\n{0}",args["packed_appearance"].ToString()); | ||
380 | } | ||
381 | // DEBUG ON | ||
382 | else | ||
383 | m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); | ||
384 | // DEBUG OFF | ||
385 | } catch (Exception e) | ||
386 | { | ||
387 | m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); | ||
388 | } | ||
389 | |||
391 | ServiceURLs = new Dictionary<string, object>(); | 390 | ServiceURLs = new Dictionary<string, object>(); |
392 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) | 391 | if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array) |
393 | { | 392 | { |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index fdebba3..d7a7d1e 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -387,31 +387,37 @@ namespace OpenSim.Framework | |||
387 | // args["agent_textures"] = textures; | 387 | // args["agent_textures"] = textures; |
388 | //} | 388 | //} |
389 | 389 | ||
390 | /* | 390 | // The code to pack textures, visuals, wearables and attachments |
391 | if ((AgentTextures != null) && (AgentTextures.Length > 0)) | 391 | // should be removed; packed appearance contains the full appearance |
392 | args["texture_entry"] = OSD.FromBinary(AgentTextures); | 392 | // This is retained for backward compatibility only |
393 | if ((Appearance.Texture != null) && (Appearance.Texture.Length > 0)) | ||
394 | args["texture_entry"] = OSD.FromBinary(Appearance.Texture); | ||
393 | 395 | ||
394 | if ((VisualParams != null) && (VisualParams.Length > 0)) | 396 | if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0)) |
395 | args["visual_params"] = OSD.FromBinary(VisualParams); | 397 | args["visual_params"] = OSD.FromBinary(Appearance.VisualParams); |
396 | 398 | ||
397 | // We might not pass this in all cases... | 399 | // We might not pass this in all cases... |
398 | if ((Wearables != null) && (Wearables.Length > 0)) | 400 | if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0)) |
399 | { | 401 | { |
400 | OSDArray wears = new OSDArray(Wearables.Length); | 402 | OSDArray wears = new OSDArray(Appearance.Wearables.Length * 2); |
401 | foreach (UUID uuid in Wearables) | 403 | foreach (AvatarWearable awear in Appearance.Wearables) |
402 | wears.Add(OSD.FromUUID(uuid)); | 404 | { |
405 | wears.Add(OSD.FromUUID(awear.ItemID)); | ||
406 | wears.Add(OSD.FromUUID(awear.AssetID)); | ||
407 | } | ||
403 | args["wearables"] = wears; | 408 | args["wearables"] = wears; |
404 | } | 409 | } |
405 | 410 | ||
406 | 411 | List<AvatarAttachments> attachments = Appearance.GetAttachments(); | |
407 | if ((Attachments != null) && (Attachments.Length > 0)) | 412 | if ((attachments != null) && (attachments.Length > 0)) |
408 | { | 413 | { |
409 | OSDArray attachs = new OSDArray(Attachments.Length); | 414 | OSDArray attachs = new OSDArray(attachments.Length); |
410 | foreach (AvatarAttachment att in Attachments) | 415 | foreach (AvatarAttachment att in attachments) |
411 | attachs.Add(att.Pack()); | 416 | attachs.Add(att.Pack()); |
412 | args["attachments"] = attachs; | 417 | args["attachments"] = attachs; |
413 | } | 418 | } |
414 | */ | 419 | // End of code to remove |
420 | |||
415 | if ((Controllers != null) && (Controllers.Length > 0)) | 421 | if ((Controllers != null) && (Controllers.Length > 0)) |
416 | { | 422 | { |
417 | OSDArray controls = new OSDArray(Controllers.Length); | 423 | OSDArray controls = new OSDArray(Controllers.Length); |
@@ -547,41 +553,47 @@ namespace OpenSim.Framework | |||
547 | // AgentTextures[i++] = o.AsUUID(); | 553 | // AgentTextures[i++] = o.AsUUID(); |
548 | //} | 554 | //} |
549 | 555 | ||
550 | if (args["packed_appearance"] != null) | 556 | |
551 | Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); | 557 | Appearance = new AvatarAppearance(AgentID); |
552 | else | 558 | |
553 | Appearance = new AvatarAppearance(AgentID); | 559 | // The code to pack textures, visuals, wearables and attachments |
554 | 560 | // should be removed; packed appearance contains the full appearance | |
555 | /* | 561 | // This is retained for backward compatibility only |
556 | if (args["texture_entry"] != null) | 562 | if (args["texture_entry"] != null) |
557 | AgentTextures = args["texture_entry"].AsBinary(); | 563 | Appearance.SetTextureEntries(args["texture_entry"].AsBinary()); |
558 | 564 | ||
559 | if (args["visual_params"] != null) | 565 | if (args["visual_params"] != null) |
560 | VisualParams = args["visual_params"].AsBinary(); | 566 | Appearance.SetVisualParams(args["visual_params"].AsBinary()); |
561 | 567 | ||
562 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) | 568 | if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array) |
563 | { | 569 | { |
564 | OSDArray wears = (OSDArray)(args["wearables"]); | 570 | OSDArray wears = (OSDArray)(args["wearables"]); |
565 | Wearables = new UUID[wears.Count]; | 571 | for (int i = 0; i < wears.Count / 2; i++) |
566 | int i = 0; | 572 | { |
567 | foreach (OSD o in wears) | 573 | Appearance.Wearables[i].ItemID = wears[i*2].AsUUID(); |
568 | Wearables[i++] = o.AsUUID(); | 574 | Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID(); |
575 | } | ||
569 | } | 576 | } |
570 | 577 | ||
571 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) | 578 | if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array) |
572 | { | 579 | { |
573 | OSDArray attachs = (OSDArray)(args["attachments"]); | 580 | OSDArray attachs = (OSDArray)(args["attachments"]); |
574 | Attachments = new AvatarAttachment[attachs.Count]; | 581 | AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count]; |
575 | int i = 0; | 582 | int i = 0; |
576 | foreach (OSD o in attachs) | 583 | foreach (OSD o in attachs) |
577 | { | 584 | { |
578 | if (o.Type == OSDType.Map) | 585 | if (o.Type == OSDType.Map) |
579 | { | 586 | { |
580 | Attachments[i++] = new AvatarAttachment((OSDMap)o); | 587 | attachments[i++] = new AvatarAttachment((OSDMap)o); |
581 | } | 588 | } |
582 | } | 589 | } |
590 | Appearance.SetAttachments(attachments); | ||
583 | } | 591 | } |
584 | */ | 592 | // end of code to remove |
593 | |||
594 | if (args["packed_appearance"] != null) | ||
595 | Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); | ||
596 | |||
585 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) | 597 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) |
586 | { | 598 | { |
587 | OSDArray controls = (OSDArray)(args["controllers"]); | 599 | OSDArray controls = (OSDArray)(args["controllers"]); |