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:
Master ScienceSim
2010-10-20 16:17:54 -07:00
parent b2478b41c8
commit b1c8d05888
28 changed files with 1056 additions and 880 deletions

View File

@@ -26,14 +26,32 @@
*/
using System;
using System.Runtime.Serialization;
using System.Security.Permissions;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Framework
{
public class AvatarWearable
{
// these are guessed at by the list here -
// http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll
// correct them over time for when were are wrong.
public static readonly int BODY = 0;
public static readonly int SKIN = 1;
public static readonly int HAIR = 2;
public static readonly int EYES = 3;
public static readonly int SHIRT = 4;
public static readonly int PANTS = 5;
public static readonly int SHOES = 6;
public static readonly int SOCKS = 7;
public static readonly int JACKET = 8;
public static readonly int GLOVES = 9;
public static readonly int UNDERSHIRT = 10;
public static readonly int UNDERPANTS = 11;
public static readonly int SKIRT = 12;
public static readonly int MAX_WEARABLES = 13;
public static readonly UUID DEFAULT_BODY_ITEM = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
public static readonly UUID DEFAULT_BODY_ASSET = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
@@ -62,12 +80,32 @@ namespace OpenSim.Framework
ItemID = itemId;
}
public AvatarWearable(OSDMap args)
{
Unpack(args);
}
public OSDMap Pack()
{
OSDMap weardata = new OSDMap();
weardata["item"] = OSD.FromUUID(ItemID);
weardata["asset"] = OSD.FromUUID(AssetID);
return weardata;
}
public void Unpack(OSDMap args)
{
ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero;
AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero;
}
public static AvatarWearable[] DefaultWearables
{
get
{
AvatarWearable[] defaultWearables = new AvatarWearable[13]; //should be 13 of these
for (int i = 0; i < 13; i++)
AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 13 of these
for (int i = 0; i < MAX_WEARABLES; i++)
{
defaultWearables[i] = new AvatarWearable();
}