This commit fixes all the appearance related null refs. Still can't log in,
client displays a blank error box.viewer-2-initial-appearance
parent
46362cd1c0
commit
ff7da2082d
|
@ -111,6 +111,10 @@ namespace OpenSim.Framework
|
|||
SetDefaultParams();
|
||||
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>>();
|
||||
}
|
||||
|
||||
|
@ -172,10 +176,11 @@ namespace OpenSim.Framework
|
|||
m_serial = appearance.Serial;
|
||||
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)
|
||||
{
|
||||
m_wearables = new AvatarWearable[AvatarWearable.MAX_WEARABLES]; //should be 15 of these
|
||||
for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
|
||||
SetWearable(i,appearance.Wearables[i]);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Framework
|
|||
public static readonly int UNDERPANTS = 11;
|
||||
public static readonly int SKIRT = 12;
|
||||
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;
|
||||
|
||||
|
|
|
@ -51,8 +51,6 @@ namespace OpenSim.Services.AvatarService
|
|||
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)
|
||||
{
|
||||
AvatarData avatar = GetAvatar(principalID);
|
||||
|
@ -68,12 +66,15 @@ namespace OpenSim.Services.AvatarService
|
|||
public AvatarData GetAvatar(UUID principalID)
|
||||
{
|
||||
AvatarBaseData[] av = m_Database.Get("PrincipalID", principalID.ToString());
|
||||
if (av.Length == 0)
|
||||
return null;
|
||||
|
||||
AvatarData ret = new AvatarData();
|
||||
ret.Data = new Dictionary<string,string>();
|
||||
|
||||
if (av.Length == 0)
|
||||
{
|
||||
ret.AvatarType = 1; // SL avatar
|
||||
return ret;
|
||||
}
|
||||
|
||||
foreach (AvatarBaseData b in av)
|
||||
{
|
||||
if (b.Data["Name"] == "AvatarType")
|
||||
|
|
|
@ -190,60 +190,75 @@ namespace OpenSim.Services.Interfaces
|
|||
AvatarAppearance appearance = new AvatarAppearance(owner);
|
||||
try
|
||||
{
|
||||
appearance.Serial = Int32.Parse(Data["Serial"]);
|
||||
if (Data.ContainsKey("Serial"))
|
||||
appearance.Serial = Int32.Parse(Data["Serial"]);
|
||||
|
||||
// Wearables
|
||||
appearance.Wearables[AvatarWearable.BODY].Wear(
|
||||
UUID.Parse(Data["BodyItem"]),
|
||||
UUID.Parse(Data["BodyAsset"]));
|
||||
if (Data.ContainsKey("BodyItem"))
|
||||
appearance.Wearables[AvatarWearable.BODY].Wear(
|
||||
UUID.Parse(Data["BodyItem"]),
|
||||
UUID.Parse(Data["BodyAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.SKIN].Wear(
|
||||
UUID.Parse(Data["SkinItem"]),
|
||||
UUID.Parse(Data["SkinAsset"]));
|
||||
if (Data.ContainsKey("SkinItem"))
|
||||
appearance.Wearables[AvatarWearable.SKIN].Wear(
|
||||
UUID.Parse(Data["SkinItem"]),
|
||||
UUID.Parse(Data["SkinAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.HAIR].Wear(
|
||||
UUID.Parse(Data["HairItem"]),
|
||||
UUID.Parse(Data["HairAsset"]));
|
||||
if (Data.ContainsKey("HairItem"))
|
||||
appearance.Wearables[AvatarWearable.HAIR].Wear(
|
||||
UUID.Parse(Data["HairItem"]),
|
||||
UUID.Parse(Data["HairAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.EYES].Wear(
|
||||
UUID.Parse(Data["EyesItem"]),
|
||||
UUID.Parse(Data["EyesAsset"]));
|
||||
if (Data.ContainsKey("EyesItem"))
|
||||
appearance.Wearables[AvatarWearable.EYES].Wear(
|
||||
UUID.Parse(Data["EyesItem"]),
|
||||
UUID.Parse(Data["EyesAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.SHIRT].Wear(
|
||||
UUID.Parse(Data["ShirtItem"]),
|
||||
UUID.Parse(Data["ShirtAsset"]));
|
||||
if (Data.ContainsKey("ShirtItem"))
|
||||
appearance.Wearables[AvatarWearable.SHIRT].Wear(
|
||||
UUID.Parse(Data["ShirtItem"]),
|
||||
UUID.Parse(Data["ShirtAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.PANTS].Wear(
|
||||
UUID.Parse(Data["PantsItem"]),
|
||||
UUID.Parse(Data["PantsAsset"]));
|
||||
if (Data.ContainsKey("PantsItem"))
|
||||
appearance.Wearables[AvatarWearable.PANTS].Wear(
|
||||
UUID.Parse(Data["PantsItem"]),
|
||||
UUID.Parse(Data["PantsAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.SHOES].Wear(
|
||||
UUID.Parse(Data["ShoesItem"]),
|
||||
UUID.Parse(Data["ShoesAsset"]));
|
||||
if (Data.ContainsKey("ShoesItem"))
|
||||
appearance.Wearables[AvatarWearable.SHOES].Wear(
|
||||
UUID.Parse(Data["ShoesItem"]),
|
||||
UUID.Parse(Data["ShoesAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.SOCKS].Wear(
|
||||
UUID.Parse(Data["SocksItem"]),
|
||||
UUID.Parse(Data["SocksAsset"]));
|
||||
if (Data.ContainsKey("SocksItem"))
|
||||
appearance.Wearables[AvatarWearable.SOCKS].Wear(
|
||||
UUID.Parse(Data["SocksItem"]),
|
||||
UUID.Parse(Data["SocksAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.JACKET].Wear(
|
||||
UUID.Parse(Data["JacketItem"]),
|
||||
UUID.Parse(Data["JacketAsset"]));
|
||||
if (Data.ContainsKey("JacketItem"))
|
||||
appearance.Wearables[AvatarWearable.JACKET].Wear(
|
||||
UUID.Parse(Data["JacketItem"]),
|
||||
UUID.Parse(Data["JacketAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.GLOVES].Wear(
|
||||
UUID.Parse(Data["GlovesItem"]),
|
||||
UUID.Parse(Data["GlovesAsset"]));
|
||||
if (Data.ContainsKey("GlovesItem"))
|
||||
appearance.Wearables[AvatarWearable.GLOVES].Wear(
|
||||
UUID.Parse(Data["GlovesItem"]),
|
||||
UUID.Parse(Data["GlovesAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear(
|
||||
UUID.Parse(Data["UnderShirtItem"]),
|
||||
UUID.Parse(Data["UnderShirtAsset"]));
|
||||
if (Data.ContainsKey("UnderShirtItem"))
|
||||
appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear(
|
||||
UUID.Parse(Data["UnderShirtItem"]),
|
||||
UUID.Parse(Data["UnderShirtAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.UNDERPANTS].Wear(
|
||||
UUID.Parse(Data["UnderPantsItem"]),
|
||||
UUID.Parse(Data["UnderPantsAsset"]));
|
||||
if (Data.ContainsKey("UnderPantsItem"))
|
||||
appearance.Wearables[AvatarWearable.UNDERPANTS].Wear(
|
||||
UUID.Parse(Data["UnderPantsItem"]),
|
||||
UUID.Parse(Data["UnderPantsAsset"]));
|
||||
|
||||
if (Data.ContainsKey("SkirtItem"))
|
||||
appearance.Wearables[AvatarWearable.SKIRT].Wear(
|
||||
UUID.Parse(Data["SkirtItem"]),
|
||||
UUID.Parse(Data["SkirtAsset"]));
|
||||
|
||||
appearance.Wearables[AvatarWearable.SKIRT].Wear(
|
||||
UUID.Parse(Data["SkirtItem"]),
|
||||
UUID.Parse(Data["SkirtAsset"]));
|
||||
|
||||
// Attachments
|
||||
Dictionary<string, string> attchs = new Dictionary<string, string>();
|
||||
|
|
Loading…
Reference in New Issue