Merge branch 'master' into mantis5110

This commit is contained in:
Jonathan Freedman
2010-10-30 18:28:07 -04:00
8 changed files with 167 additions and 87 deletions

View File

@@ -150,7 +150,11 @@ namespace OpenSim.Framework
m_attachments = new Dictionary<int, List<AvatarAttachment>>();
}
public AvatarAppearance(AvatarAppearance appearance)
public AvatarAppearance(AvatarAppearance appearance) : this(appearance, true)
{
}
public AvatarAppearance(AvatarAppearance appearance, bool copyWearables)
{
// m_log.WarnFormat("[AVATAR APPEARANCE] create from an existing appearance");
@@ -175,7 +179,7 @@ namespace OpenSim.Framework
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
m_wearables[i] = new AvatarWearable();
if (appearance.Wearables != null)
if (copyWearables && (appearance.Wearables != null))
{
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
SetWearable(i,appearance.Wearables[i]);
@@ -198,6 +202,28 @@ namespace OpenSim.Framework
AppendAttachment(new AvatarAttachment(attachment));
}
public void GetAssetsFrom(AvatarAppearance app)
{
for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
{
for (int j = 0 ; j < m_wearables[i].Count ; j++)
{
UUID itemID = m_wearables[i][j].ItemID;
UUID assetID = app.Wearables[i].GetAsset(itemID);
if (assetID != UUID.Zero)
m_wearables[i].Add(itemID, assetID);
}
}
}
public void ClearWearables()
{
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
m_wearables[i] = new AvatarWearable();
}
protected virtual void SetDefaultWearables()
{
m_wearables = AvatarWearable.DefaultWearables;
@@ -205,11 +231,11 @@ namespace OpenSim.Framework
protected virtual void SetDefaultParams()
{
m_visualparams = new byte[VISUALPARAM_COUNT];
for (int i = 0; i < VISUALPARAM_COUNT; i++)
{
m_visualparams[i] = 150;
}
m_visualparams = new byte[] { 56,23,66,0,0,25,0,124,107,0,0,91,137,36,180,79,78,20,32,255,0,63,137,137,63,122,0,71,127,94,63,0,150,150,150,17,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,78,0,0,0,0,0,0,0,0,0,145,216,133,0,0,0,219,107,150,150,165,135,0,150,150,150,63,112,155,150,150,150,150,150,150,150,150,150,150,150,0,0,0,0,188,255,91,219,124,0,150,127,165,127,127,127,127,59,63,107,71,68,89,33,79,114,178,127,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,0,85,131,117,127,147,163,104,0,140,18,0,107,130,0,150,150,198,0,0,40,38,91,165,209,198,127,127,153,204,51,51,150,150,255,204,0,150,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,22,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150 };
// for (int i = 0; i < VISUALPARAM_COUNT; i++)
// {
// m_visualparams[i] = 150;
// }
}
protected virtual void SetDefaultTexture()

View File

@@ -82,12 +82,13 @@ namespace OpenSim.Framework
public static readonly UUID DEFAULT_PANTS_ITEM = new UUID("77c41e39-38f9-f75a-0000-5859892f1111");
public static readonly UUID DEFAULT_PANTS_ASSET = new UUID("00000000-38f9-1111-024e-222222111120");
public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
// public static readonly UUID DEFAULT_ALPHA_ITEM = new UUID("bfb9923c-4838-4d2d-bf07-608c5b1165c8");
// public static readonly UUID DEFAULT_ALPHA_ASSET = new UUID("1578a2b1-5179-4b53-b618-fe00ca5a5594");
public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1");
public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007");
// public static readonly UUID DEFAULT_TATTOO_ITEM = new UUID("c47e22bd-3021-4ba4-82aa-2b5cb34d35e1");
// public static readonly UUID DEFAULT_TATTOO_ASSET = new UUID("00000000-0000-2222-3333-100000001007");
private static AvatarWearable[] defaultWearables = null;
protected Dictionary<UUID, UUID> m_items = new Dictionary<UUID, UUID>();
protected List<UUID> m_ids = new List<UUID>();
@@ -152,6 +153,11 @@ namespace OpenSim.Framework
m_items[itemID] = assetID;
}
public void Wear(WearableItem item)
{
Wear(item.ItemID, item.AssetID);
}
public void Wear(UUID itemID, UUID assetID)
{
Clear();
@@ -204,11 +210,21 @@ namespace OpenSim.Framework
}
}
public UUID GetAsset(UUID itemID)
{
if (!m_items.ContainsKey(itemID))
return UUID.Zero;
return m_items[itemID];
}
public static AvatarWearable[] DefaultWearables
{
get
{
AvatarWearable[] defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these
if (defaultWearables != null)
return defaultWearables;
defaultWearables = new AvatarWearable[MAX_WEARABLES]; //should be 15 of these
for (int i = 0; i < MAX_WEARABLES; i++)
{
defaultWearables[i] = new AvatarWearable();
@@ -229,11 +245,11 @@ namespace OpenSim.Framework
// Pants
defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET);
// Alpha
defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET);
// // Alpha
// defaultWearables[ALPHA].Add(DEFAULT_ALPHA_ITEM, DEFAULT_ALPHA_ASSET);
// Tattoo
defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
// // Tattoo
// defaultWearables[TATTOO].Add(DEFAULT_TATTOO_ITEM, DEFAULT_TATTOO_ASSET);
return defaultWearables;
}