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

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

View File

@ -321,12 +321,12 @@ namespace OpenSim.Framework
+ 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height
+ 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height
+ 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length
m_hipOffset = (0.615385f // Half of avatar m_hipOffset = (0.615385f // Half of avatar
+ 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height
+ 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height
+ 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length
- m_avatarHeight / 2) * 0.3f - 0.04f; - m_avatarHeight / 2) * 0.3f - 0.04f;
//m_log.Debug(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}" + m_avatarHeight + " " + m_hipOffset);
//m_log.Debug("------------- Set Appearance Texture ---------------"); //m_log.Debug("------------- Set Appearance Texture ---------------");
//Primitive.TextureEntryFace[] faces = Texture.FaceTextures; //Primitive.TextureEntryFace[] faces = Texture.FaceTextures;
//foreach (Primitive.TextureEntryFace face in faces) //foreach (Primitive.TextureEntryFace face in faces)
@ -358,6 +358,17 @@ namespace OpenSim.Framework
return textu; return textu;
} }
public static byte[] GetDefaultVisualParams()
{
byte[] visualParams;
visualParams = new byte[VISUALPARAM_COUNT];
for (int i = 0; i < VISUALPARAM_COUNT; i++)
{
visualParams[i] = 100;
}
return visualParams;
}
public override String ToString() public override String ToString()
{ {
String s = "[Wearables] =>"; String s = "[Wearables] =>";

View File

@ -3361,21 +3361,10 @@ namespace OpenSim.Region.Framework.Scenes
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
{ {
visualParams = GetDefaultVisualParams(); visualParams = AvatarAppearance.GetDefaultVisualParams();
wearables = AvatarWearable.DefaultWearables; 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 #endregion
public void RegionHandleRequest(IClientAPI client, UUID regionID) public void RegionHandleRequest(IClientAPI client, UUID regionID)

View File

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