diff options
author | Justin Clark-Casey (justincc) | 2011-12-15 21:57:22 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-15 21:57:22 +0000 |
commit | 937c06db54f8152486d37a4ba604ffb3bcdccbb4 (patch) | |
tree | bb8b30c6cdac92c82352fc829ebdf0a6e663cdba /OpenSim/Region/Framework | |
parent | minor: add some currently commented log lines for use in debugging (diff) | |
download | opensim-SC-937c06db54f8152486d37a4ba604ffb3bcdccbb4.zip opensim-SC-937c06db54f8152486d37a4ba604ffb3bcdccbb4.tar.gz opensim-SC-937c06db54f8152486d37a4ba604ffb3bcdccbb4.tar.bz2 opensim-SC-937c06db54f8152486d37a4ba604ffb3bcdccbb4.tar.xz |
Code cleanup related to ScenePresence.PhysicsActor and OdeScene/OdeCharacter
Stop hiding RemoveAvatar failure, add log messages when characters are removed through defects or re-added unexpectedly.
Add commented out log lines for future use.
Use automatic property for PhysicsActor for better code readability and simplicity
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index beff239..6f5b6fe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -285,16 +285,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
285 | 285 | ||
286 | #region Properties | 286 | #region Properties |
287 | 287 | ||
288 | protected PhysicsActor m_physicsActor; | ||
289 | |||
290 | /// <summary> | 288 | /// <summary> |
291 | /// Physical scene representation of this Avatar. | 289 | /// Physical scene representation of this Avatar. |
292 | /// </summary> | 290 | /// </summary> |
293 | public PhysicsActor PhysicsActor | 291 | public PhysicsActor PhysicsActor { get; private set; } |
294 | { | ||
295 | set { m_physicsActor = value; } | ||
296 | get { return m_physicsActor; } | ||
297 | } | ||
298 | 292 | ||
299 | private byte m_movementflag; | 293 | private byte m_movementflag; |
300 | 294 | ||
@@ -1032,18 +1026,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1032 | { | 1026 | { |
1033 | if (PhysicsActor != null) | 1027 | if (PhysicsActor != null) |
1034 | { | 1028 | { |
1035 | try | 1029 | // PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; |
1036 | { | 1030 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; |
1037 | PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; | 1031 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); |
1038 | PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; | 1032 | PhysicsActor.UnSubscribeEvents(); |
1039 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); | 1033 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; |
1040 | PhysicsActor.UnSubscribeEvents(); | 1034 | PhysicsActor = null; |
1041 | PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; | ||
1042 | PhysicsActor = null; | ||
1043 | } | ||
1044 | catch | ||
1045 | { } | ||
1046 | } | 1035 | } |
1036 | // else | ||
1037 | // { | ||
1038 | // m_log.ErrorFormat( | ||
1039 | // "[SCENE PRESENCE]: Attempt to remove physics actor for {0} on {1} but this scene presence has no physics actor", | ||
1040 | // Name, Scene.RegionInfo.RegionName); | ||
1041 | // } | ||
1047 | } | 1042 | } |
1048 | 1043 | ||
1049 | /// <summary> | 1044 | /// <summary> |
@@ -1925,7 +1920,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1925 | // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); | 1920 | // m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); |
1926 | 1921 | ||
1927 | if (PhysicsActor != null) | 1922 | if (PhysicsActor != null) |
1928 | m_sitAvatarHeight = m_physicsActor.Size.Z; | 1923 | m_sitAvatarHeight = PhysicsActor.Size.Z; |
1929 | 1924 | ||
1930 | bool canSit = false; | 1925 | bool canSit = false; |
1931 | pos = part.AbsolutePosition + offset; | 1926 | pos = part.AbsolutePosition + offset; |
@@ -2570,7 +2565,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2570 | // only send update from root agents to other clients; children are only "listening posts" | 2565 | // only send update from root agents to other clients; children are only "listening posts" |
2571 | if (IsChildAgent) | 2566 | if (IsChildAgent) |
2572 | { | 2567 | { |
2573 | m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); | 2568 | m_log.WarnFormat( |
2569 | "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", | ||
2570 | Name, Scene.RegionInfo.RegionName); | ||
2571 | |||
2574 | return; | 2572 | return; |
2575 | } | 2573 | } |
2576 | 2574 | ||
@@ -2628,7 +2626,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2628 | // only send update from root agents to other clients; children are only "listening posts" | 2626 | // only send update from root agents to other clients; children are only "listening posts" |
2629 | if (IsChildAgent) | 2627 | if (IsChildAgent) |
2630 | { | 2628 | { |
2631 | m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent"); | 2629 | m_log.WarnFormat( |
2630 | "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", | ||
2631 | Name, Scene.RegionInfo.RegionName); | ||
2632 | |||
2632 | return; | 2633 | return; |
2633 | } | 2634 | } |
2634 | 2635 | ||
@@ -3039,8 +3040,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3039 | 3040 | ||
3040 | CameraPosition = cAgentData.Center + offset; | 3041 | CameraPosition = cAgentData.Center + offset; |
3041 | 3042 | ||
3042 | //SetHeight(cAgentData.AVHeight); | ||
3043 | |||
3044 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) | 3043 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) |
3045 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); | 3044 | ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); |
3046 | 3045 | ||
@@ -3251,6 +3250,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3251 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", | 3250 | // "[SCENE PRESENCE]: Adding physics actor for {0}, ifFlying = {1} in {2}", |
3252 | // Name, isFlying, Scene.RegionInfo.RegionName); | 3251 | // Name, isFlying, Scene.RegionInfo.RegionName); |
3253 | 3252 | ||
3253 | if (PhysicsActor != null) | ||
3254 | { | ||
3255 | m_log.ErrorFormat( | ||
3256 | "[SCENE PRESENCE]: Adding physics actor for {0} to {1} but this scene presence already has a physics actor", | ||
3257 | Name, Scene.RegionInfo.RegionName); | ||
3258 | } | ||
3259 | |||
3254 | if (Appearance.AvatarHeight == 0) | 3260 | if (Appearance.AvatarHeight == 0) |
3255 | Appearance.SetHeight(); | 3261 | Appearance.SetHeight(); |
3256 | 3262 | ||
@@ -3258,11 +3264,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3258 | 3264 | ||
3259 | Vector3 pVec = AbsolutePosition; | 3265 | Vector3 pVec = AbsolutePosition; |
3260 | 3266 | ||
3261 | // Old bug where the height was in centimeters instead of meters | 3267 | PhysicsActor = scene.AddAvatar( |
3262 | PhysicsActor = scene.AddAvatar(LocalId, Firstname + "." + Lastname, pVec, | 3268 | LocalId, Firstname + "." + Lastname, pVec, |
3263 | new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); | 3269 | new Vector3(0f, 0f, Appearance.AvatarHeight), isFlying); |
3264 | 3270 | ||
3265 | scene.AddPhysicsActorTaint(PhysicsActor); | ||
3266 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3271 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3267 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3272 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
3268 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong | 3273 | PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong |