diff options
author | diva | 2009-03-27 20:18:55 +0000 |
---|---|---|
committer | diva | 2009-03-27 20:18:55 +0000 |
commit | bce5ed5812cc4385852a324da8a478086a7a0d37 (patch) | |
tree | 4f7d83e404137e236bd61b021f392eeb34632f3b /OpenSim | |
parent | * minor: remove one mono compiler warning (diff) | |
download | opensim-SC_OLD-bce5ed5812cc4385852a324da8a478086a7a0d37.zip opensim-SC_OLD-bce5ed5812cc4385852a324da8a478086a7a0d37.tar.gz opensim-SC_OLD-bce5ed5812cc4385852a324da8a478086a7a0d37.tar.bz2 opensim-SC_OLD-bce5ed5812cc4385852a324da8a478086a7a0d37.tar.xz |
Moved a method GetDefaultVisualParameters from Scene to AvatarAppearance, where it belongs. Better error handling in ScenePresence.CopyFrom.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/AvatarAppearance.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 |
3 files changed, 19 insertions, 16 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 9544d5a..8d0d699 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs | |||
@@ -321,12 +321,12 @@ namespace OpenSim.Framework | |||
321 | + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height | 321 | + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height |
322 | + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height | 322 | + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height |
323 | + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length | 323 | + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length |
324 | m_hipOffset = (0.615385f // Half of avatar | 324 | m_hipOffset = (0.615385f // Half of avatar |
325 | + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height | 325 | + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height |
326 | + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height | 326 | + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height |
327 | + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length | 327 | + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length |
328 | - m_avatarHeight / 2) * 0.3f - 0.04f; | 328 | - m_avatarHeight / 2) * 0.3f - 0.04f; |
329 | //m_log.Debug(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); | 329 | //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}" + m_avatarHeight + " " + m_hipOffset); |
330 | //m_log.Debug("------------- Set Appearance Texture ---------------"); | 330 | //m_log.Debug("------------- Set Appearance Texture ---------------"); |
331 | //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; | 331 | //Primitive.TextureEntryFace[] faces = Texture.FaceTextures; |
332 | //foreach (Primitive.TextureEntryFace face in faces) | 332 | //foreach (Primitive.TextureEntryFace face in faces) |
@@ -358,6 +358,17 @@ namespace OpenSim.Framework | |||
358 | return textu; | 358 | return textu; |
359 | } | 359 | } |
360 | 360 | ||
361 | public static byte[] GetDefaultVisualParams() | ||
362 | { | ||
363 | byte[] visualParams; | ||
364 | visualParams = new byte[VISUALPARAM_COUNT]; | ||
365 | for (int i = 0; i < VISUALPARAM_COUNT; i++) | ||
366 | { | ||
367 | visualParams[i] = 100; | ||
368 | } | ||
369 | return visualParams; | ||
370 | } | ||
371 | |||
361 | public override String ToString() | 372 | public override String ToString() |
362 | { | 373 | { |
363 | String s = "[Wearables] =>"; | 374 | String s = "[Wearables] =>"; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a60f7d8..1891f9d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3361,21 +3361,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3361 | 3361 | ||
3362 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) | 3362 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) |
3363 | { | 3363 | { |
3364 | visualParams = GetDefaultVisualParams(); | 3364 | visualParams = AvatarAppearance.GetDefaultVisualParams(); |
3365 | wearables = AvatarWearable.DefaultWearables; | 3365 | wearables = AvatarWearable.DefaultWearables; |
3366 | } | 3366 | } |
3367 | 3367 | ||
3368 | private static byte[] GetDefaultVisualParams() | ||
3369 | { | ||
3370 | byte[] visualParams; | ||
3371 | visualParams = new byte[218]; | ||
3372 | for (int i = 0; i < 218; i++) | ||
3373 | { | ||
3374 | visualParams[i] = 100; | ||
3375 | } | ||
3376 | return visualParams; | ||
3377 | } | ||
3378 | |||
3379 | #endregion | 3368 | #endregion |
3380 | 3369 | ||
3381 | public void RegionHandleRequest(IClientAPI client, UUID regionID) | 3370 | public void RegionHandleRequest(IClientAPI client, UUID regionID) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a6d1ad3..c78aceb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2849,6 +2849,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2849 | uint i = 0; | 2849 | uint i = 0; |
2850 | try | 2850 | try |
2851 | { | 2851 | { |
2852 | if (cAgent.Wearables == null) | ||
2853 | cAgent.Wearables = new UUID[0]; | ||
2852 | AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2]; | 2854 | AvatarWearable[] wears = new AvatarWearable[cAgent.Wearables.Length / 2]; |
2853 | for (uint n = 0; n < cAgent.Wearables.Length; n += 2) | 2855 | for (uint n = 0; n < cAgent.Wearables.Length; n += 2) |
2854 | { | 2856 | { |
@@ -2857,12 +2859,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2857 | wears[i++] = new AvatarWearable(itemId, assetId); | 2859 | wears[i++] = new AvatarWearable(itemId, assetId); |
2858 | } | 2860 | } |
2859 | m_appearance.Wearables = wears; | 2861 | m_appearance.Wearables = wears; |
2860 | |||
2861 | byte[] te = null; | 2862 | byte[] te = null; |
2862 | if (cAgent.AgentTextures != null) | 2863 | if (cAgent.AgentTextures != null) |
2863 | te = cAgent.AgentTextures; | 2864 | te = cAgent.AgentTextures; |
2864 | else | 2865 | else |
2865 | te = AvatarAppearance.GetDefaultTexture().ToBytes(); | 2866 | te = AvatarAppearance.GetDefaultTexture().ToBytes(); |
2867 | if ((cAgent.VisualParams == null) || (cAgent.VisualParams.Length < AvatarAppearance.VISUALPARAM_COUNT)) | ||
2868 | cAgent.VisualParams = AvatarAppearance.GetDefaultVisualParams(); | ||
2866 | m_appearance.SetAppearance(te, new List<byte>(cAgent.VisualParams)); | 2869 | m_appearance.SetAppearance(te, new List<byte>(cAgent.VisualParams)); |
2867 | } | 2870 | } |
2868 | catch (Exception e) | 2871 | catch (Exception e) |