diff options
author | Melanie | 2010-09-27 19:34:16 +0200 |
---|---|---|
committer | Melanie | 2010-09-27 19:34:16 +0200 |
commit | 841c84831fedcfa40e0b0fa9c99990f6754591fa (patch) | |
tree | 6a1471ea4543d453f21fb367280037652b873f3b /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC_OLD-841c84831fedcfa40e0b0fa9c99990f6754591fa.zip opensim-SC_OLD-841c84831fedcfa40e0b0fa9c99990f6754591fa.tar.gz opensim-SC_OLD-841c84831fedcfa40e0b0fa9c99990f6754591fa.tar.bz2 opensim-SC_OLD-841c84831fedcfa40e0b0fa9c99990f6754591fa.tar.xz |
Try to prevent threading issues in SP.SetAppearance by locking it
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 85 |
1 files changed, 45 insertions, 40 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b3df1ea..ec3f004 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -229,6 +229,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
229 | private const int NumMovementsBetweenRayCast = 5; | 229 | private const int NumMovementsBetweenRayCast = 5; |
230 | private List<uint> m_lastColliders = new List<uint>(); | 230 | private List<uint> m_lastColliders = new List<uint>(); |
231 | 231 | ||
232 | private object m_syncRoot = new Object(); | ||
233 | |||
232 | private bool CameraConstraintActive; | 234 | private bool CameraConstraintActive; |
233 | //private int m_moveToPositionStateStatus; | 235 | //private int m_moveToPositionStateStatus; |
234 | //***************************************************** | 236 | //***************************************************** |
@@ -2861,66 +2863,69 @@ namespace OpenSim.Region.Framework.Scenes | |||
2861 | /// <param name="visualParam"></param> | 2863 | /// <param name="visualParam"></param> |
2862 | public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) | 2864 | public void SetAppearance(Primitive.TextureEntry textureEntry, byte[] visualParams) |
2863 | { | 2865 | { |
2864 | if (m_physicsActor != null) | 2866 | lock (m_syncRoot) |
2865 | { | 2867 | { |
2866 | if (!IsChildAgent) | 2868 | if (m_physicsActor != null) |
2867 | { | 2869 | { |
2868 | // This may seem like it's redundant, remove the avatar from the physics scene | 2870 | if (!IsChildAgent) |
2869 | // just to add it back again, but it saves us from having to update | 2871 | { |
2870 | // 3 variables 10 times a second. | 2872 | // This may seem like it's redundant, remove the avatar from the physics scene |
2871 | bool flyingTemp = m_physicsActor.Flying; | 2873 | // just to add it back again, but it saves us from having to update |
2872 | RemoveFromPhysicalScene(); | 2874 | // 3 variables 10 times a second. |
2873 | //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); | 2875 | bool flyingTemp = m_physicsActor.Flying; |
2876 | RemoveFromPhysicalScene(); | ||
2877 | //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); | ||
2874 | 2878 | ||
2875 | //PhysicsActor = null; | 2879 | //PhysicsActor = null; |
2876 | 2880 | ||
2877 | AddToPhysicalScene(flyingTemp); | 2881 | AddToPhysicalScene(flyingTemp); |
2882 | } | ||
2878 | } | 2883 | } |
2879 | } | ||
2880 | 2884 | ||
2881 | #region Bake Cache Check | 2885 | #region Bake Cache Check |
2882 | 2886 | ||
2883 | if (textureEntry != null) | 2887 | if (textureEntry != null) |
2884 | { | ||
2885 | for (int i = 0; i < BAKE_INDICES.Length; i++) | ||
2886 | { | 2888 | { |
2887 | int j = BAKE_INDICES[i]; | 2889 | for (int i = 0; i < BAKE_INDICES.Length; i++) |
2888 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[j]; | ||
2889 | |||
2890 | if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
2891 | { | 2890 | { |
2892 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) | 2891 | int j = BAKE_INDICES[i]; |
2892 | Primitive.TextureEntryFace face = textureEntry.FaceTextures[j]; | ||
2893 | |||
2894 | if (face != null && face.TextureID != AppearanceManager.DEFAULT_AVATAR_TEXTURE) | ||
2893 | { | 2895 | { |
2894 | m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name); | 2896 | if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) |
2895 | this.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | 2897 | { |
2898 | m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name); | ||
2899 | this.ControllingClient.SendRebakeAvatarTextures(face.TextureID); | ||
2900 | } | ||
2896 | } | 2901 | } |
2897 | } | 2902 | } |
2898 | } | ||
2899 | 2903 | ||
2900 | } | 2904 | } |
2901 | 2905 | ||
2902 | 2906 | ||
2903 | #endregion Bake Cache Check | 2907 | #endregion Bake Cache Check |
2904 | 2908 | ||
2905 | m_appearance.SetAppearance(textureEntry, visualParams); | 2909 | m_appearance.SetAppearance(textureEntry, visualParams); |
2906 | if (m_appearance.AvatarHeight > 0) | 2910 | if (m_appearance.AvatarHeight > 0) |
2907 | SetHeight(m_appearance.AvatarHeight); | 2911 | SetHeight(m_appearance.AvatarHeight); |
2908 | 2912 | ||
2909 | // This is not needed, because only the transient data changed | 2913 | // This is not needed, because only the transient data changed |
2910 | //AvatarData adata = new AvatarData(m_appearance); | 2914 | //AvatarData adata = new AvatarData(m_appearance); |
2911 | //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); | 2915 | //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); |
2912 | 2916 | ||
2913 | SendAppearanceToAllOtherAgents(); | 2917 | SendAppearanceToAllOtherAgents(); |
2914 | if (!m_startAnimationSet) | 2918 | if (!m_startAnimationSet) |
2915 | { | 2919 | { |
2916 | Animator.UpdateMovementAnimations(); | 2920 | Animator.UpdateMovementAnimations(); |
2917 | m_startAnimationSet = true; | 2921 | m_startAnimationSet = true; |
2918 | } | 2922 | } |
2919 | 2923 | ||
2920 | Vector3 pos = m_pos; | 2924 | Vector3 pos = m_pos; |
2921 | pos.Z += m_appearance.HipOffset; | 2925 | pos.Z += m_appearance.HipOffset; |
2922 | 2926 | ||
2923 | m_controllingClient.SendAvatarDataImmediate(this); | 2927 | m_controllingClient.SendAvatarDataImmediate(this); |
2928 | } | ||
2924 | } | 2929 | } |
2925 | 2930 | ||
2926 | public void SetWearable(int wearableId, AvatarWearable wearable) | 2931 | public void SetWearable(int wearableId, AvatarWearable wearable) |