Merge branch 'master' of /var/git/opensim/

viewer-2-initial-appearance
opensim mirror account 2010-10-29 19:20:06 -07:00
commit dcd5cf6bde
4 changed files with 69 additions and 48 deletions

View File

@ -111,6 +111,10 @@ namespace OpenSim.Framework
SetDefaultParams(); SetDefaultParams();
SetHeight(); SetHeight();
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES];
for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++ )
m_wearables[i] = new AvatarWearable();
m_attachments = new Dictionary<int, List<AvatarAttachment>>(); m_attachments = new Dictionary<int, List<AvatarAttachment>>();
} }
@ -172,10 +176,11 @@ namespace OpenSim.Framework
m_serial = appearance.Serial; m_serial = appearance.Serial;
m_owner = appearance.Owner; m_owner = appearance.Owner;
m_wearables = null; 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 (appearance.Wearables != null)
{ {
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 15 of these
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++) for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
SetWearable(i,appearance.Wearables[i]); SetWearable(i,appearance.Wearables[i]);
} }

View File

@ -63,7 +63,7 @@ namespace OpenSim.Framework
public static readonly int UNDERPANTS = 11; public static readonly int UNDERPANTS = 11;
public static readonly int SKIRT = 12; public static readonly int SKIRT = 12;
public static readonly int ALPHA = 13; public static readonly int ALPHA = 13;
public static readonly int TATTOO = 15; public static readonly int TATTOO = 14;
public static readonly int MAX_WEARABLES = 15; public static readonly int MAX_WEARABLES = 15;

View File

@ -51,8 +51,6 @@ namespace OpenSim.Services.AvatarService
m_log.Debug("[AVATAR SERVICE]: Starting avatar service"); m_log.Debug("[AVATAR SERVICE]: Starting avatar service");
} }
// Get|SetAppearance should preserve existing semantics
// until AvatarData can be removed completely
public AvatarAppearance GetAppearance(UUID principalID) public AvatarAppearance GetAppearance(UUID principalID)
{ {
AvatarData avatar = GetAvatar(principalID); AvatarData avatar = GetAvatar(principalID);
@ -68,12 +66,15 @@ namespace OpenSim.Services.AvatarService
public AvatarData GetAvatar(UUID principalID) public AvatarData GetAvatar(UUID principalID)
{ {
AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString()); AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString());
if (av.Length == 0)
return null;
AvatarData ret = new AvatarData(); AvatarData ret = new AvatarData();
ret.Data = new Dictionary<string,string>(); ret.Data = new Dictionary<string,string>();
if (av.Length == 0)
{
ret.AvatarType = 1; // SL avatar
return ret;
}
foreach (AvatarBaseData b in av) foreach (AvatarBaseData b in av)
{ {
if (b.Data["Name"] == "AvatarType") if (b.Data["Name"] == "AvatarType")

View File

@ -190,61 +190,76 @@ namespace OpenSim.Services.Interfaces
AvatarAppearance appearance = new AvatarAppearance(owner); AvatarAppearance appearance = new AvatarAppearance(owner);
try try
{ {
if (Data.ContainsKey("Serial"))
appearance.Serial = Int32.Parse(Data["Serial"]); appearance.Serial = Int32.Parse(Data["Serial"]);
// Wearables // Wearables
if (Data.ContainsKey("BodyItem"))
appearance.Wearables[AvatarWearable.BODY].Wear( appearance.Wearables[AvatarWearable.BODY].Wear(
UUID.Parse(Data["BodyItem"]), UUID.Parse(Data["BodyItem"]),
UUID.Parse(Data["BodyAsset"])); UUID.Parse(Data["BodyAsset"]));
if (Data.ContainsKey("SkinItem"))
appearance.Wearables[AvatarWearable.SKIN].Wear( appearance.Wearables[AvatarWearable.SKIN].Wear(
UUID.Parse(Data["SkinItem"]), UUID.Parse(Data["SkinItem"]),
UUID.Parse(Data["SkinAsset"])); UUID.Parse(Data["SkinAsset"]));
if (Data.ContainsKey("HairItem"))
appearance.Wearables[AvatarWearable.HAIR].Wear( appearance.Wearables[AvatarWearable.HAIR].Wear(
UUID.Parse(Data["HairItem"]), UUID.Parse(Data["HairItem"]),
UUID.Parse(Data["HairAsset"])); UUID.Parse(Data["HairAsset"]));
if (Data.ContainsKey("EyesItem"))
appearance.Wearables[AvatarWearable.EYES].Wear( appearance.Wearables[AvatarWearable.EYES].Wear(
UUID.Parse(Data["EyesItem"]), UUID.Parse(Data["EyesItem"]),
UUID.Parse(Data["EyesAsset"])); UUID.Parse(Data["EyesAsset"]));
if (Data.ContainsKey("ShirtItem"))
appearance.Wearables[AvatarWearable.SHIRT].Wear( appearance.Wearables[AvatarWearable.SHIRT].Wear(
UUID.Parse(Data["ShirtItem"]), UUID.Parse(Data["ShirtItem"]),
UUID.Parse(Data["ShirtAsset"])); UUID.Parse(Data["ShirtAsset"]));
if (Data.ContainsKey("PantsItem"))
appearance.Wearables[AvatarWearable.PANTS].Wear( appearance.Wearables[AvatarWearable.PANTS].Wear(
UUID.Parse(Data["PantsItem"]), UUID.Parse(Data["PantsItem"]),
UUID.Parse(Data["PantsAsset"])); UUID.Parse(Data["PantsAsset"]));
if (Data.ContainsKey("ShoesItem"))
appearance.Wearables[AvatarWearable.SHOES].Wear( appearance.Wearables[AvatarWearable.SHOES].Wear(
UUID.Parse(Data["ShoesItem"]), UUID.Parse(Data["ShoesItem"]),
UUID.Parse(Data["ShoesAsset"])); UUID.Parse(Data["ShoesAsset"]));
if (Data.ContainsKey("SocksItem"))
appearance.Wearables[AvatarWearable.SOCKS].Wear( appearance.Wearables[AvatarWearable.SOCKS].Wear(
UUID.Parse(Data["SocksItem"]), UUID.Parse(Data["SocksItem"]),
UUID.Parse(Data["SocksAsset"])); UUID.Parse(Data["SocksAsset"]));
if (Data.ContainsKey("JacketItem"))
appearance.Wearables[AvatarWearable.JACKET].Wear( appearance.Wearables[AvatarWearable.JACKET].Wear(
UUID.Parse(Data["JacketItem"]), UUID.Parse(Data["JacketItem"]),
UUID.Parse(Data["JacketAsset"])); UUID.Parse(Data["JacketAsset"]));
if (Data.ContainsKey("GlovesItem"))
appearance.Wearables[AvatarWearable.GLOVES].Wear( appearance.Wearables[AvatarWearable.GLOVES].Wear(
UUID.Parse(Data["GlovesItem"]), UUID.Parse(Data["GlovesItem"]),
UUID.Parse(Data["GlovesAsset"])); UUID.Parse(Data["GlovesAsset"]));
if (Data.ContainsKey("UnderShirtItem"))
appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear( appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear(
UUID.Parse(Data["UnderShirtItem"]), UUID.Parse(Data["UnderShirtItem"]),
UUID.Parse(Data["UnderShirtAsset"])); UUID.Parse(Data["UnderShirtAsset"]));
if (Data.ContainsKey("UnderPantsItem"))
appearance.Wearables[AvatarWearable.UNDERPANTS].Wear( appearance.Wearables[AvatarWearable.UNDERPANTS].Wear(
UUID.Parse(Data["UnderPantsItem"]), UUID.Parse(Data["UnderPantsItem"]),
UUID.Parse(Data["UnderPantsAsset"])); UUID.Parse(Data["UnderPantsAsset"]));
if (Data.ContainsKey("SkirtItem"))
appearance.Wearables[AvatarWearable.SKIRT].Wear( appearance.Wearables[AvatarWearable.SKIRT].Wear(
UUID.Parse(Data["SkirtItem"]), UUID.Parse(Data["SkirtItem"]),
UUID.Parse(Data["SkirtAsset"])); UUID.Parse(Data["SkirtAsset"]));
// Attachments // Attachments
Dictionary<string, string> attchs = new Dictionary<string, string>(); Dictionary<string, string> attchs = new Dictionary<string, string>();
foreach (KeyValuePair<string, string> _kvp in Data) foreach (KeyValuePair<string, string> _kvp in Data)