Intermediate commit for backward compatability; does not compile yet

viewer-2-initial-appearance
Mic Bowman 2010-10-25 09:41:08 -07:00
parent 267f18925d
commit 657cceb884
2 changed files with 77 additions and 66 deletions

View File

@ -206,16 +206,18 @@ namespace OpenSim.Framework
args["service_session_id"] = OSD.FromString(ServiceSessionID);
args["start_pos"] = OSD.FromString(startpos.ToString());
args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
args["client_ip"] = OSD.FromString(IPAddress);
args["viewer"] = OSD.FromString(Viewer);
args["channel"] = OSD.FromString(Channel);
args["mac"] = OSD.FromString(Mac);
args["id0"] = OSD.FromString(Id0);
/*
// Eventually this code should be deprecated, use full appearance
// packing in packed_appearance
if (Appearance != null)
{
args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
//System.Console.WriteLine("XXX Before packing Wearables");
if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
{
@ -230,20 +232,19 @@ namespace OpenSim.Framework
}
//System.Console.WriteLine("XXX Before packing Attachments");
Dictionary<int, AvatarAttachment> attachments = Appearance.Attachments;
List<AvatarAttachment> attachments = Appearance.GetAttachments();
if ((attachments != null) && (attachments.Count > 0))
{
OSDArray attachs = new OSDArray(attachments.Count);
foreach (KeyValuePair<int, AvatarAttachment> kvp in attachments)
foreach (AvatarAttachment attach in attachments)
{
AvatarAttachment adata = new AvatarAttachment(kvp.Value);
attachs.Add(adata.Pack());
attachs.Add(attach.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();
@ -339,6 +340,34 @@ namespace OpenSim.Framework
try {
// Unpack various appearance elements
Appearance = new AvatarAppearance(AgentID);
// Eventually this code should be deprecated, use full appearance
// packing in packed_appearance
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"]);
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
{
Appearance.AppendAttachment(new AvatarAttachment((OSDMap)o));
}
}
}
if (args["packed_appearance"] != null)
{
if (args["packed_appearance"].Type == OSDType.Map)
@ -358,36 +387,6 @@ namespace OpenSim.Framework
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"]);
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"]);
AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count];
int i = 0;
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
{
attachments[i++] = new AvatarAttachment((OSDMap)o);
}
}
Appearance.SetAttachments(attachments);
}
*/
ServiceURLs = new Dictionary<string, object>();
if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
{

View File

@ -387,31 +387,37 @@ namespace OpenSim.Framework
// args["agent_textures"] = textures;
//}
/*
if ((AgentTextures != null) && (AgentTextures.Length > 0))
args["texture_entry"] = OSD.FromBinary(AgentTextures);
// The code to pack textures, visuals, wearables and attachments
// should be removed; packed appearance contains the full appearance
// This is retained for backward compatibility only
if ((Appearance.Texture != null) && (Appearance.Texture.Length > 0))
args["texture_entry"] = OSD.FromBinary(Appearance.Texture);
if ((VisualParams != null) && (VisualParams.Length > 0))
args["visual_params"] = OSD.FromBinary(VisualParams);
if ((Appearance.VisualParams != null) && (Appearance.VisualParams.Length > 0))
args["visual_params"] = OSD.FromBinary(Appearance.VisualParams);
// We might not pass this in all cases...
if ((Wearables != null) && (Wearables.Length > 0))
if ((Appearance.Wearables != null) && (Appearance.Wearables.Length > 0))
{
OSDArray wears = new OSDArray(Wearables.Length);
foreach (UUID uuid in Wearables)
wears.Add(OSD.FromUUID(uuid));
OSDArray wears = new OSDArray(Appearance.Wearables.Length * 2);
foreach (AvatarWearable awear in Appearance.Wearables)
{
wears.Add(OSD.FromUUID(awear.ItemID));
wears.Add(OSD.FromUUID(awear.AssetID));
}
args["wearables"] = wears;
}
if ((Attachments != null) && (Attachments.Length > 0))
List<AvatarAttachments> attachments = Appearance.GetAttachments();
if ((attachments != null) && (attachments.Length > 0))
{
OSDArray attachs = new OSDArray(Attachments.Length);
foreach (AvatarAttachment att in Attachments)
OSDArray attachs = new OSDArray(attachments.Length);
foreach (AvatarAttachment att in attachments)
attachs.Add(att.Pack());
args["attachments"] = attachs;
}
*/
// End of code to remove
if ((Controllers != null) && (Controllers.Length > 0))
{
OSDArray controls = new OSDArray(Controllers.Length);
@ -547,41 +553,47 @@ namespace OpenSim.Framework
// AgentTextures[i++] = o.AsUUID();
//}
if (args["packed_appearance"] != null)
Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
else
Appearance = new AvatarAppearance(AgentID);
/*
Appearance = new AvatarAppearance(AgentID);
// The code to pack textures, visuals, wearables and attachments
// should be removed; packed appearance contains the full appearance
// This is retained for backward compatibility only
if (args["texture_entry"] != null)
AgentTextures = args["texture_entry"].AsBinary();
Appearance.SetTextureEntries(args["texture_entry"].AsBinary());
if (args["visual_params"] != null)
VisualParams = args["visual_params"].AsBinary();
Appearance.SetVisualParams(args["visual_params"].AsBinary());
if ((args["wearables"] != null) && (args["wearables"]).Type == OSDType.Array)
{
OSDArray wears = (OSDArray)(args["wearables"]);
Wearables = new UUID[wears.Count];
int i = 0;
foreach (OSD o in wears)
Wearables[i++] = o.AsUUID();
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"]);
Attachments = new AvatarAttachment[attachs.Count];
AvatarAttachment[] attachments = new AvatarAttachment[attachs.Count];
int i = 0;
foreach (OSD o in attachs)
{
if (o.Type == OSDType.Map)
{
Attachments[i++] = new AvatarAttachment((OSDMap)o);
attachments[i++] = new AvatarAttachment((OSDMap)o);
}
}
Appearance.SetAttachments(attachments);
}
*/
// end of code to remove
if (args["packed_appearance"] != null)
Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]);
if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array)
{
OSDArray controls = (OSDArray)(args["controllers"]);