Moved a method GetDefaultVisualParameters from Scene to AvatarAppearance, where it belongs. Better error handling in ScenePresence.CopyFrom.

This commit is contained in:
diva
2009-03-27 20:18:55 +00:00
parent 3fe010d716
commit bce5ed5812
3 changed files with 19 additions and 16 deletions

View File

@@ -3361,21 +3361,10 @@ namespace OpenSim.Region.Framework.Scenes
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
{
visualParams = GetDefaultVisualParams();
visualParams = AvatarAppearance.GetDefaultVisualParams();
wearables = AvatarWearable.DefaultWearables;
}
private static byte[] GetDefaultVisualParams()
{
byte[] visualParams;
visualParams = new byte[218];
for (int i = 0; i < 218; i++)
{
visualParams[i] = 100;
}
return visualParams;
}
#endregion
public void RegionHandleRequest(IClientAPI client, UUID regionID)

View File

@@ -2849,6 +2849,8 @@ namespace OpenSim.Region.Framework.Scenes
uint i = 0;
try
{
if (cAgent.Wearables == null)
cAgent.Wearables = new UUID[0];
AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2];
for (uint n = 0; n < cAgent.Wearables.Length; n += 2)
{
@@ -2857,12 +2859,13 @@ namespace OpenSim.Region.Framework.Scenes
wears[i++] = new AvatarWearable(itemId, assetId);
}
m_appearance.Wearables = wears;
byte[] te = null;
if (cAgent.AgentTextures != null)
te = cAgent.AgentTextures;
else
te = AvatarAppearance.GetDefaultTexture().ToBytes();
te = AvatarAppearance.GetDefaultTexture().ToBytes();
if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT))
cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams();
m_appearance.SetAppearance(te, new List<byte>(cAgent.VisualParams));
}
catch (Exception e)