Fixed more appearance woes that showed up using remote connectors. Appearance is now being passed with AgentCircuitData, as it should be.

This commit is contained in:
Diva Canto
2010-01-12 09:22:58 -08:00
parent 77e43f4801
commit 66920a9047
12 changed files with 102 additions and 33 deletions

View File

@@ -155,6 +155,31 @@ namespace OpenSim.Framework
args["secure_session_id"] = OSD.FromUUID(SecureSessionID);
args["session_id"] = OSD.FromUUID(SessionID);
args["start_pos"] = OSD.FromString(startpos.ToString());
args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
// We might not pass this in all cases...
if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
{
OSDArray wears = new OSDArray(Appearance.Wearables.Length);
foreach (AvatarWearable awear in Appearance.Wearables)
{
wears.Add(OSD.FromUUID(awear.ItemID));
wears.Add(OSD.FromUUID(awear.AssetID));
}
args["wearables"] = wears;
}
Dictionary<int, UUID[]> attachments = Appearance.GetAttachmentDictionary();
if ((attachments != null) && (attachments.Count > 0))
{
OSDArray attachs = new OSDArray(attachments.Count);
foreach (KeyValuePair<int, UUID[]> kvp in attachments)
{
AttachmentData adata = new AttachmentData(kvp.Key, kvp.Value[0], kvp.Value[1]);
attachs.Add(adata.PackUpdateMessage());
}
args["attachments"] = attachs;
}
return args;
}
@@ -209,8 +234,35 @@ namespace OpenSim.Framework
if (args["session_id"] != null)
SessionID = args["session_id"].AsUUID();
if (args["start_pos"] != null)
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
Vector3.TryParse(args["start_pos"].AsString(), out startpos);
Appearance = new AvatarAppearance(AgentID);
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"]);
for (int i = 0; i < wears.Count / 2; i++)
{
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];
int i = 0;
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
{
attachments[i++] = new AttachmentData((OSDMap)o);
}
}
Appearance.SetAttachments(attachments);
}
}
}

View File

@@ -566,6 +566,16 @@ namespace OpenSim.Framework
private Dictionary<int, UUID[]> m_attachments = new Dictionary<int, UUID[]>();
public void SetAttachments(AttachmentData[] data)
{
foreach (AttachmentData a in data)
{
m_attachments[a.AttachPoint] = new UUID[2];
m_attachments[a.AttachPoint][0] = a.ItemID;
m_attachments[a.AttachPoint][1] = a.AssetID;
}
}
public void SetAttachments(Hashtable data)
{
m_attachments.Clear();
@@ -595,6 +605,11 @@ namespace OpenSim.Framework
}
}
public Dictionary<int, UUID[]> GetAttachmentDictionary()
{
return m_attachments;
}
public Hashtable GetAttachments()
{
if (m_attachments.Count == 0)

View File

@@ -334,6 +334,7 @@ namespace OpenSim.Framework
args["left_axis"] = OSD.FromString(LeftAxis.ToString());
args["up_axis"] = OSD.FromString(UpAxis.ToString());
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
args["far"] = OSD.FromReal(Far);
args["aspect"] = OSD.FromReal(Aspect);
@@ -353,7 +354,7 @@ namespace OpenSim.Framework
args["agent_access"] = OSD.FromString(AgentAccess.ToString());
args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
if ((Groups != null) && (Groups.Length > 0))
{
OSDArray groups = new OSDArray(Groups.Length);
@@ -378,6 +379,7 @@ namespace OpenSim.Framework
// args["agent_textures"] = textures;
//}
if ((AgentTextures != null) && (AgentTextures.Length > 0))
args["texture_entry"] = OSD.FromBinary(AgentTextures);
@@ -393,6 +395,7 @@ namespace OpenSim.Framework
args["wearables"] = wears;
}
if ((Attachments != null) && (Attachments.Length > 0))
{
OSDArray attachs = new OSDArray(Attachments.Length);
@@ -401,9 +404,11 @@ namespace OpenSim.Framework
args["attachments"] = attachs;
}
if ((CallbackURI != null) && (!CallbackURI.Equals("")))
args["callback_uri"] = OSD.FromString(CallbackURI);
return args;
}