mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
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.
This commit is contained in:
@@ -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
|
||||
/// </summary>
|
||||
public class AgentCircuitData
|
||||
{
|
||||
// DEBUG ON
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(
|
||||
MethodBase.GetCurrentMethod().DeclaringType);
|
||||
// DEBUG OFF
|
||||
|
||||
/// <summary>
|
||||
/// Avatar Unique Agent Identifier
|
||||
/// </summary>
|
||||
@@ -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<int, UUID[]> attachments = Appearance.GetAttachmentDictionary();
|
||||
Dictionary<int, AvatarAttachment> attachments = Appearance.Attachments;
|
||||
if ((attachments != null) && (attachments.Count > 0))
|
||||
{
|
||||
OSDArray attachs = new OSDArray(attachments.Count);
|
||||
foreach (KeyValuePair<int, UUID[]> kvp in attachments)
|
||||
foreach (KeyValuePair<int, AvatarAttachment> 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<string, object>();
|
||||
if (args.ContainsKey("service_urls") && args["service_urls"] != null && (args["service_urls"]).Type == OSDType.Array)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user