diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 9544d5a2bc..8d0d69948f 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -321,12 +321,12 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 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.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length - 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 ---------------"); //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; //foreach (Primitive.TextureEntryFace face in faces) @@ -358,6 +358,17 @@ namespace OpenSim.Framework 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() { String s = "[Wearables] =>"; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a60f7d8b01..1891f9d813 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -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) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a6d1ad380b..c78aceb8ae 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -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(cAgent.VisualParams)); } catch (Exception e)