From b1c8d0588829dfa76f89460eeb8406d9c4fc479f Mon Sep 17 00:00:00 2001
From: Master ScienceSim
Date: Wed, 20 Oct 2010 16:17:54 -0700
Subject: Major refactoring of appearance handling.
AvatarService -- add two new methods, GetAppearance and SetAppearance
to get around the lossy encoding in AvatarData. Preseve the old
functions to avoid changing the behavior for ROBUST services.
AvatarAppearance -- major refactor, moved the various encoding
methods used by AgentCircuitData, ClientAgentUpdate and
ScenePresence into one location. Changed initialization.
AvatarAttachments -- added a class specifically to handle
attachments in preparation for additional functionality
that will be needed for viewer 2.
AvatarFactory -- removed a number of unused or methods duplicated
in other locations. Moved in all appearance event handling from
ScenePresence. Required a change to IClientAPI that propogated
throughout all the IClientAPI implementations.
---
OpenSim/Framework/AgentCircuitData.cs | 61 +++++++++++++++++++++++++++++------
1 file changed, 52 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Framework/AgentCircuitData.cs')
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 @@
*/
using System;
+using System.Reflection;
using System.Collections.Generic;
+using log4net;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -38,6 +40,12 @@ namespace OpenSim.Framework
///
public class AgentCircuitData
{
+// DEBUG ON
+ private static readonly ILog m_log =
+ LogManager.GetLogger(
+ MethodBase.GetCurrentMethod().DeclaringType);
+// DEBUG OFF
+
///
/// Avatar Unique Agent Identifier
///
@@ -205,6 +213,7 @@ namespace OpenSim.Framework
args["mac"] = OSD.FromString(Mac);
args["id0"] = OSD.FromString(Id0);
+/*
if (Appearance != null)
{
//System.Console.WriteLine("XXX Before packing Wearables");
@@ -221,20 +230,26 @@ namespace OpenSim.Framework
}
//System.Console.WriteLine("XXX Before packing Attachments");
- Dictionary attachments = Appearance.GetAttachmentDictionary();
+ Dictionary attachments = Appearance.Attachments;
if ((attachments != null) && (attachments.Count > 0))
{
OSDArray attachs = new OSDArray(attachments.Count);
- foreach (KeyValuePair kvp in attachments)
+ foreach (KeyValuePair kvp in attachments)
{
- AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]);
- attachs.Add(adata.PackUpdateMessage());
+ AvatarAttachment adata = new AvatarAttachment(kvp.Value);
+ attachs.Add(adata.Pack());
//System.Console.WriteLine("XXX att.pt=" + kvp.Key + "; itemID=" + kvp.Value[0] + "; assetID=" + kvp.Value[1]);
}
args["attachments"] = attachs;
}
}
-
+*/
+ if (Appearance != null)
+ {
+ OSDMap appmap = Appearance.Pack();
+ args["packed_appearance"] = appmap;
+ }
+
if (ServiceURLs != null && ServiceURLs.Count > 0)
{
OSDArray urls = new OSDArray(ServiceURLs.Count * 2);
@@ -317,9 +332,37 @@ namespace OpenSim.Framework
if (args["start_pos"] != null)
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
+// DEBUG ON
+ m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString());
+// DEBUG OFF
+
+ try {
+ // Unpack various appearance elements
Appearance = new AvatarAppearance(AgentID);
+ if (args["packed_appearance"] != null)
+ {
+ if (args["packed_appearance"].Type == OSDType.Map)
+ {
+ Appearance.Unpack((OSDMap)args["packed_appearance"]);
+ m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance");
+ }
+ else
+ m_log.WarnFormat("[AGENTCIRCUITDATA] packed_appearance is not a map:\n{0}",args["packed_appearance"].ToString());
+ }
+// DEBUG ON
+ else
+ m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance");
+// DEBUG OFF
+ } catch (Exception e)
+ {
+ m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message);
+ }
+
+
+/*
if (args["appearance_serial"] != null)
Appearance.Serial = args["appearance_serial"].AsInteger();
+
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
{
OSDArray wears = (OSDArray)(args["wearables"]);
@@ -328,23 +371,23 @@ namespace OpenSim.Framework
Appearance.Wearables[i].ItemID = wears[i*2].AsUUID();
Appearance.Wearables[i].AssetID = wears[(i*2)+1].AsUUID();
}
- }
+ }
if ((args["attachments"] != null) && (args["attachments"]).Type == OSDType.Array)
{
OSDArray attachs = (OSDArray)(args["attachments"]);
- AttachmentData[] attachments = new AttachmentData[attachs.Count];
+ AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count];
int i = 0;
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
{
- attachments[i++] = new AttachmentData((OSDMap)o);
+ attachments[i++] = new AvatarAttachment((OSDMap)o);
}
}
Appearance.SetAttachments(attachments);
}
-
+*/
ServiceURLs = new Dictionary();
if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
{
--
cgit v1.1