diff options
Diffstat (limited to '')
5 files changed, 236 insertions, 145 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 4cf854e..43cfd80 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -54,11 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
54 | /// <value> | 54 | /// <value> |
55 | /// The current movement animation | 55 | /// The current movement animation |
56 | /// </value> | 56 | /// </value> |
57 | public string CurrentMovementAnimation | 57 | public string CurrentMovementAnimation { get; private set; } |
58 | { | 58 | |
59 | get { return m_movementAnimation; } | ||
60 | } | ||
61 | protected string m_movementAnimation = "CROUCH"; | ||
62 | private int m_animTickFall; | 59 | private int m_animTickFall; |
63 | public int m_animTickJump; // ScenePresence has to see this to control +Z force | 60 | public int m_animTickJump; // ScenePresence has to see this to control +Z force |
64 | public bool m_jumping = false; | 61 | public bool m_jumping = false; |
@@ -79,6 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
79 | public ScenePresenceAnimator(ScenePresence sp) | 76 | public ScenePresenceAnimator(ScenePresence sp) |
80 | { | 77 | { |
81 | m_scenePresence = sp; | 78 | m_scenePresence = sp; |
79 | CurrentMovementAnimation = "CROUCH"; | ||
82 | } | 80 | } |
83 | 81 | ||
84 | public void AddAnimation(UUID animID, UUID objectID) | 82 | public void AddAnimation(UUID animID, UUID objectID) |
@@ -131,8 +129,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
131 | 129 | ||
132 | public void ResetAnimations() | 130 | public void ResetAnimations() |
133 | { | 131 | { |
132 | // m_log.DebugFormat( | ||
133 | // "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", | ||
134 | // m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); | ||
135 | |||
134 | m_animations.Clear(); | 136 | m_animations.Clear(); |
135 | TrySetMovementAnimation("STAND"); | ||
136 | } | 137 | } |
137 | 138 | ||
138 | /// <summary> | 139 | /// <summary> |
@@ -143,6 +144,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
143 | { | 144 | { |
144 | if (!m_scenePresence.IsChildAgent) | 145 | if (!m_scenePresence.IsChildAgent) |
145 | { | 146 | { |
147 | // m_log.DebugFormat( | ||
148 | // "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}", | ||
149 | // anim, m_scenePresence.Name); | ||
150 | |||
146 | if (m_animations.TrySetDefaultAnimation( | 151 | if (m_animations.TrySetDefaultAnimation( |
147 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) | 152 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) |
148 | { | 153 | { |
@@ -155,12 +160,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
155 | SendAnimPack(); | 160 | SendAnimPack(); |
156 | } | 161 | } |
157 | } | 162 | } |
163 | else | ||
164 | { | ||
165 | m_log.WarnFormat( | ||
166 | "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", | ||
167 | anim, m_scenePresence.Name); | ||
168 | } | ||
158 | } | 169 | } |
159 | 170 | ||
160 | /// <summary> | 171 | /// <summary> |
161 | /// This method determines the proper movement related animation | 172 | /// This method determines the proper movement related animation |
162 | /// </summary> | 173 | /// </summary> |
163 | public string GetMovementAnimation() | 174 | private string DetermineMovementAnimation() |
164 | { | 175 | { |
165 | const float FALL_DELAY = 800f; | 176 | const float FALL_DELAY = 800f; |
166 | const float PREJUMP_DELAY = 200f; | 177 | const float PREJUMP_DELAY = 200f; |
@@ -263,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
263 | return "FALLDOWN"; | 274 | return "FALLDOWN"; |
264 | } | 275 | } |
265 | 276 | ||
266 | return m_movementAnimation; | 277 | return CurrentMovementAnimation; |
267 | } | 278 | } |
268 | 279 | ||
269 | #endregion Falling/Floating/Landing | 280 | #endregion Falling/Floating/Landing |
@@ -274,7 +285,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
274 | int jumptime; | 285 | int jumptime; |
275 | jumptime = Environment.TickCount - m_animTickJump; | 286 | jumptime = Environment.TickCount - m_animTickJump; |
276 | 287 | ||
277 | |||
278 | if ((move.Z > 0f) && (!m_jumping)) | 288 | if ((move.Z > 0f) && (!m_jumping)) |
279 | { | 289 | { |
280 | // Start jumping, prejump | 290 | // Start jumping, prejump |
@@ -318,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
318 | 328 | ||
319 | #region Ground Movement | 329 | #region Ground Movement |
320 | 330 | ||
321 | if (m_movementAnimation == "FALLDOWN") | 331 | if (CurrentMovementAnimation == "FALLDOWN") |
322 | { | 332 | { |
323 | m_falling = false; | 333 | m_falling = false; |
324 | m_animTickFall = Environment.TickCount; | 334 | m_animTickFall = Environment.TickCount; |
@@ -331,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
331 | else | 341 | else |
332 | return "LAND"; | 342 | return "LAND"; |
333 | } | 343 | } |
334 | else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP")) | 344 | else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP")) |
335 | { | 345 | { |
336 | int landElapsed = Environment.TickCount - m_animTickFall; | 346 | int landElapsed = Environment.TickCount - m_animTickFall; |
337 | int limit = 1000; | 347 | int limit = 1000; |
338 | if(m_movementAnimation == "LAND") limit = 350; | 348 | if (CurrentMovementAnimation == "LAND") |
349 | limit = 350; | ||
339 | // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client | 350 | // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client |
340 | 351 | ||
341 | if ((m_animTickFall != 0) && (landElapsed <= limit)) | 352 | if ((m_animTickFall != 0) && (landElapsed <= limit)) |
342 | { | 353 | { |
343 | return m_movementAnimation; | 354 | return CurrentMovementAnimation; |
344 | } | 355 | } |
345 | else | 356 | else |
346 | { | 357 | { |
@@ -378,7 +389,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
378 | #endregion Ground Movement | 389 | #endregion Ground Movement |
379 | 390 | ||
380 | m_falling = false; | 391 | m_falling = false; |
381 | return m_movementAnimation; | 392 | |
393 | return CurrentMovementAnimation; | ||
382 | } | 394 | } |
383 | 395 | ||
384 | /// <summary> | 396 | /// <summary> |
@@ -386,8 +398,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
386 | /// </summary> | 398 | /// </summary> |
387 | public void UpdateMovementAnimations() | 399 | public void UpdateMovementAnimations() |
388 | { | 400 | { |
389 | m_movementAnimation = GetMovementAnimation(); | 401 | CurrentMovementAnimation = DetermineMovementAnimation(); |
390 | TrySetMovementAnimation(m_movementAnimation); | 402 | |
403 | // m_log.DebugFormat( | ||
404 | // "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", | ||
405 | // CurrentMovementAnimation, m_scenePresence.Name); | ||
406 | |||
407 | TrySetMovementAnimation(CurrentMovementAnimation); | ||
391 | } | 408 | } |
392 | 409 | ||
393 | public UUID[] GetAnimationArray() | 410 | public UUID[] GetAnimationArray() |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 11040b7..3cc72fe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3325,9 +3325,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3325 | if (hasHollow) ret += 1; | 3325 | if (hasHollow) ret += 1; |
3326 | break; | 3326 | break; |
3327 | case PrimType.SCULPT: | 3327 | case PrimType.SCULPT: |
3328 | ret = 1; | 3328 | // Special mesh handling |
3329 | if (Shape.SculptType == (byte)SculptType.Mesh) | ||
3330 | ret = 8; // if it's a mesh then max 8 faces | ||
3331 | else | ||
3332 | ret = 1; // if it's a sculpt then max 1 face | ||
3329 | break; | 3333 | break; |
3330 | } | 3334 | } |
3335 | |||
3331 | return ret; | 3336 | return ret; |
3332 | } | 3337 | } |
3333 | 3338 | ||
@@ -3340,6 +3345,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3340 | { | 3345 | { |
3341 | if (Shape.SculptEntry) | 3346 | if (Shape.SculptEntry) |
3342 | return PrimType.SCULPT; | 3347 | return PrimType.SCULPT; |
3348 | |||
3343 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) | 3349 | if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) |
3344 | { | 3350 | { |
3345 | if (Shape.PathCurve == (byte)Extrusion.Straight) | 3351 | if (Shape.PathCurve == (byte)Extrusion.Straight) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 21c9402..3c97852 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -149,9 +149,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | } | 149 | } |
150 | private bool m_wasFlying; // add for fly velocity control | 150 | private bool m_wasFlying; // add for fly velocity control |
151 | 151 | ||
152 | private int m_lastColCount = -1; //KF: Look for Collision chnages | 152 | // private int m_lastColCount = -1; //KF: Look for Collision chnages |
153 | private int m_updateCount = 0; //KF: Update Anims for a while | 153 | // private int m_updateCount = 0; //KF: Update Anims for a while |
154 | private static readonly int UPDATE_COUNT = 10; // how many frames to update for | 154 | // private static readonly int UPDATE_COUNT = 10; // how many frames to update for |
155 | private List<uint> m_lastColliders = new List<uint>(); | 155 | private List<uint> m_lastColliders = new List<uint>(); |
156 | 156 | ||
157 | private TeleportFlags m_teleportFlags; | 157 | private TeleportFlags m_teleportFlags; |
@@ -794,9 +794,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
794 | 794 | ||
795 | AdjustKnownSeeds(); | 795 | AdjustKnownSeeds(); |
796 | 796 | ||
797 | // TODO: I think, this won't send anything, as we are still a child here... | ||
798 | Animator.TrySetMovementAnimation("STAND"); | ||
799 | |||
800 | // we created a new ScenePresence (a new child agent) in a fresh region. | 797 | // we created a new ScenePresence (a new child agent) in a fresh region. |
801 | // Request info about all the (root) agents in this region | 798 | // Request info about all the (root) agents in this region |
802 | // Note: This won't send data *to* other clients in that region (children don't send) | 799 | // Note: This won't send data *to* other clients in that region (children don't send) |
@@ -1012,13 +1009,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1012 | 1009 | ||
1013 | /// <summary> | 1010 | /// <summary> |
1014 | /// This turns a root agent into a child agent | 1011 | /// This turns a root agent into a child agent |
1012 | /// </summary> | ||
1013 | /// <remarks> | ||
1015 | /// when an agent departs this region for a neighbor, this gets called. | 1014 | /// when an agent departs this region for a neighbor, this gets called. |
1016 | /// | 1015 | /// |
1017 | /// It doesn't get called for a teleport. Reason being, an agent that | 1016 | /// It doesn't get called for a teleport. Reason being, an agent that |
1018 | /// teleports out may not end up anywhere near this region | 1017 | /// teleports out may not end up anywhere near this region |
1019 | /// </summary> | 1018 | /// </remarks> |
1020 | public void MakeChildAgent() | 1019 | public void MakeChildAgent() |
1021 | { | 1020 | { |
1021 | m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); | ||
1022 | |||
1022 | // Reset these so that teleporting in and walking out isn't seen | 1023 | // Reset these so that teleporting in and walking out isn't seen |
1023 | // as teleporting back | 1024 | // as teleporting back |
1024 | TeleportFlags = TeleportFlags.Default; | 1025 | TeleportFlags = TeleportFlags.Default; |
@@ -1308,11 +1309,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1308 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", | 1309 | // "[SCENE PRESENCE]: In {0} received agent update from {1}", |
1309 | // Scene.RegionInfo.RegionName, remoteClient.Name); | 1310 | // Scene.RegionInfo.RegionName, remoteClient.Name); |
1310 | 1311 | ||
1311 | //if (IsChildAgent) | 1312 | if (IsChildAgent) |
1312 | //{ | 1313 | { |
1313 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1314 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
1314 | // return; | 1315 | return; |
1315 | //} | 1316 | } |
1316 | 1317 | ||
1317 | ++m_movementUpdateCount; | 1318 | ++m_movementUpdateCount; |
1318 | if (m_movementUpdateCount < 1) | 1319 | if (m_movementUpdateCount < 1) |
@@ -1381,14 +1382,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1381 | 1382 | ||
1382 | #endregion Inputs | 1383 | #endregion Inputs |
1383 | 1384 | ||
1384 | // Make anims work for client side autopilot | 1385 | // // Make anims work for client side autopilot |
1385 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) | 1386 | // if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) |
1386 | m_updateCount = UPDATE_COUNT; | 1387 | // m_updateCount = UPDATE_COUNT; |
1387 | 1388 | // | |
1388 | // Make turning in place work | 1389 | // // Make turning in place work |
1389 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || | 1390 | // if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || |
1390 | (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) | 1391 | // (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) |
1391 | m_updateCount = UPDATE_COUNT; | 1392 | // m_updateCount = UPDATE_COUNT; |
1392 | 1393 | ||
1393 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 1394 | if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
1394 | { | 1395 | { |
@@ -1597,8 +1598,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1597 | // } | 1598 | // } |
1598 | // } | 1599 | // } |
1599 | 1600 | ||
1600 | if (update_movementflag && ParentID == 0) | 1601 | // if (update_movementflag && ParentID == 0) |
1601 | Animator.UpdateMovementAnimations(); | 1602 | // Animator.UpdateMovementAnimations(); |
1602 | } | 1603 | } |
1603 | 1604 | ||
1604 | m_scene.EventManager.TriggerOnClientMovement(this); | 1605 | m_scene.EventManager.TriggerOnClientMovement(this); |
@@ -2315,13 +2316,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2315 | 2316 | ||
2316 | public void HandleAgentSitOnGround() | 2317 | public void HandleAgentSitOnGround() |
2317 | { | 2318 | { |
2318 | m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. | 2319 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. |
2319 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 2320 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
2320 | |||
2321 | // TODO: This doesn't prevent the user from walking yet. | ||
2322 | // Setting parent ID would fix this, if we knew what value | ||
2323 | // to use. Or we could add a m_isSitting variable. | ||
2324 | //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | ||
2325 | SitGround = true; | 2321 | SitGround = true; |
2326 | RemoveFromPhysicalScene(); | 2322 | RemoveFromPhysicalScene(); |
2327 | } | 2323 | } |
@@ -2933,9 +2929,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2933 | 2929 | ||
2934 | public void Reset() | 2930 | public void Reset() |
2935 | { | 2931 | { |
2932 | // m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); | ||
2933 | |||
2936 | // Put the child agent back at the center | 2934 | // Put the child agent back at the center |
2937 | AbsolutePosition | 2935 | AbsolutePosition |
2938 | = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); | 2936 | = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); |
2937 | |||
2939 | Animator.ResetAnimations(); | 2938 | Animator.ResetAnimations(); |
2940 | } | 2939 | } |
2941 | 2940 | ||
@@ -3158,7 +3157,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3158 | } | 3157 | } |
3159 | } | 3158 | } |
3160 | 3159 | ||
3161 | public void CopyFrom(AgentData cAgent) | 3160 | private void CopyFrom(AgentData cAgent) |
3162 | { | 3161 | { |
3163 | m_originRegionID = cAgent.RegionID; | 3162 | m_originRegionID = cAgent.RegionID; |
3164 | 3163 | ||
@@ -3217,13 +3216,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
3217 | } | 3216 | } |
3218 | } | 3217 | } |
3219 | catch { } | 3218 | catch { } |
3220 | // Animations | 3219 | |
3221 | try | 3220 | // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? |
3222 | { | 3221 | if (cAgent.Anims != null) |
3223 | Animator.ResetAnimations(); | ||
3224 | Animator.Animations.FromArray(cAgent.Anims); | 3222 | Animator.Animations.FromArray(cAgent.Anims); |
3225 | } | ||
3226 | catch { } | ||
3227 | 3223 | ||
3228 | if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) | 3224 | if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) |
3229 | { | 3225 | { |
@@ -3305,19 +3301,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
3305 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); | 3301 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); |
3306 | } | 3302 | } |
3307 | 3303 | ||
3308 | // Event called by the physics plugin to tell the avatar about a collision. | 3304 | /// <summary> |
3309 | private void PhysicsCollisionUpdate(EventArgs e) | 3305 | /// Event called by the physics plugin to tell the avatar about a collision. |
3306 | /// </summary> | ||
3307 | /// <remarks> | ||
3308 | /// This function is called continuously, even when there are no collisions. If the avatar is walking on the | ||
3309 | /// ground or a prim then there will be collision information between the avatar and the surface. | ||
3310 | /// | ||
3311 | /// FIXME: However, we can't safely avoid calling this yet where there are no collisions without analyzing whether | ||
3312 | /// any part of this method is relying on an every-frame call. | ||
3313 | /// </remarks> | ||
3314 | /// <param name="e"></param> | ||
3315 | public void PhysicsCollisionUpdate(EventArgs e) | ||
3310 | { | 3316 | { |
3317 | if (IsChildAgent) | ||
3318 | return; | ||
3319 | |||
3311 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) | 3320 | //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) |
3312 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( | 3321 | // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( |
3313 | // as of this comment the interval is set in AddToPhysicalScene | 3322 | // as of this comment the interval is set in AddToPhysicalScene |
3314 | if (Animator != null) | 3323 | if (Animator != null) |
3315 | { | 3324 | { |
3316 | if (m_updateCount > 0) | 3325 | // if (m_updateCount > 0) |
3317 | { | 3326 | // { |
3318 | Animator.UpdateMovementAnimations(); | 3327 | Animator.UpdateMovementAnimations(); |
3319 | m_updateCount--; | 3328 | // m_updateCount--; |
3320 | } | 3329 | // } |
3321 | } | 3330 | } |
3322 | 3331 | ||
3323 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3332 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
@@ -3325,13 +3334,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3325 | 3334 | ||
3326 | CollisionPlane = Vector4.UnitW; | 3335 | CollisionPlane = Vector4.UnitW; |
3327 | 3336 | ||
3328 | // No collisions at all means we may be flying. Update always | 3337 | // // No collisions at all means we may be flying. Update always |
3329 | // to make falling work | 3338 | // // to make falling work |
3330 | if (m_lastColCount != coldata.Count || coldata.Count == 0) | 3339 | // if (m_lastColCount != coldata.Count || coldata.Count == 0) |
3331 | { | 3340 | // { |
3332 | m_updateCount = UPDATE_COUNT; | 3341 | // m_updateCount = UPDATE_COUNT; |
3333 | m_lastColCount = coldata.Count; | 3342 | // m_lastColCount = coldata.Count; |
3334 | } | 3343 | // } |
3335 | 3344 | ||
3336 | if (coldata.Count != 0 && Animator != null) | 3345 | if (coldata.Count != 0 && Animator != null) |
3337 | { | 3346 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index f0bbf0b..d4c299f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -31,7 +31,7 @@ using System.Reflection; | |||
31 | using System.Text; | 31 | using System.Text; |
32 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Timers; | 33 | using System.Timers; |
34 | using Timer=System.Timers.Timer; | 34 | using Timer = System.Timers.Timer; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
@@ -39,11 +39,13 @@ using OpenSim.Framework; | |||
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.ClientStack.Linden; | ||
42 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | 43 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; |
43 | using OpenSim.Region.CoreModules.World.Serialiser; | 44 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 45 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
48 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
47 | 49 | ||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | 50 | namespace OpenSim.Region.Framework.Scenes.Tests |
49 | { | 51 | { |
@@ -103,21 +105,71 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
103 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 105 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
104 | 106 | ||
105 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); | 107 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); |
108 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | ||
106 | 109 | ||
107 | scene.IncomingCloseAgent(sp.UUID); | 110 | scene.IncomingCloseAgent(sp.UUID); |
108 | 111 | ||
109 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); | 112 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); |
110 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); | 113 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); |
114 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(0)); | ||
115 | } | ||
116 | |||
117 | [Test] | ||
118 | public void TestCreateChildScenePresence() | ||
119 | { | ||
120 | TestHelpers.InMethod(); | ||
121 | // log4net.Config.XmlConfigurator.Configure(); | ||
122 | |||
123 | LocalSimulationConnectorModule lsc = new LocalSimulationConnectorModule(); | ||
124 | |||
125 | IConfigSource configSource = new IniConfigSource(); | ||
126 | IConfig config = configSource.AddConfig("Modules"); | ||
127 | config.Set("SimulationServices", "LocalSimulationConnectorModule"); | ||
128 | |||
129 | TestScene scene = SceneHelpers.SetupScene(); | ||
130 | SceneHelpers.SetupSceneModules(scene, configSource, lsc); | ||
131 | |||
132 | UUID agentId = TestHelpers.ParseTail(0x01); | ||
133 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(agentId); | ||
134 | acd.child = true; | ||
135 | |||
136 | GridRegion region = scene.GridService.GetRegionByName(UUID.Zero, scene.RegionInfo.RegionName); | ||
137 | string reason; | ||
138 | |||
139 | // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and | ||
140 | // establish a child scene presence. We pass in the circuit code that the client has to connect with *** | ||
141 | // XXX: ViaLogin may not be correct here. | ||
142 | scene.SimulationService.CreateAgent(region, acd, (uint)TeleportFlags.ViaLogin, out reason); | ||
143 | |||
144 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); | ||
145 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | ||
146 | |||
147 | // There's no scene presence yet since only an agent circuit has been established. | ||
148 | Assert.That(scene.GetScenePresence(agentId), Is.Null); | ||
149 | |||
150 | // *** This is the second stage, where the client established a child agent/scene presence using the | ||
151 | // circuit code given to the scene in stage 1 *** | ||
152 | TestClient client = new TestClient(acd, scene); | ||
153 | scene.AddNewClient(client, PresenceType.User); | ||
154 | |||
155 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); | ||
156 | Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); | ||
157 | |||
158 | ScenePresence sp = scene.GetScenePresence(agentId); | ||
159 | Assert.That(sp, Is.Not.Null); | ||
160 | Assert.That(sp.UUID, Is.EqualTo(agentId)); | ||
161 | Assert.That(sp.IsChildAgent, Is.True); | ||
111 | } | 162 | } |
112 | 163 | ||
113 | /// <summary> | 164 | /// <summary> |
114 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region | 165 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region |
115 | /// </summary> | 166 | /// </summary> |
116 | /// <remarks> | 167 | /// <remarks> |
117 | /// Please note that unlike the other tests here, this doesn't rely on structures | 168 | /// Please note that unlike the other tests here, this doesn't rely on anything set up in the instance fields. |
169 | /// INCOMPLETE | ||
118 | /// </remarks> | 170 | /// </remarks> |
119 | [Test] | 171 | [Test] |
120 | public void TestChildAgentEstablished() | 172 | public void TestChildAgentEstablishedInNeighbour() |
121 | { | 173 | { |
122 | TestHelpers.InMethod(); | 174 | TestHelpers.InMethod(); |
123 | // log4net.Config.XmlConfigurator.Configure(); | 175 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -125,18 +177,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
125 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 177 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
126 | 178 | ||
127 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); | 179 | TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
128 | // TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); | 180 | TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
129 | 181 | ||
130 | IConfigSource configSource = new IniConfigSource(); | 182 | IConfigSource configSource = new IniConfigSource(); |
131 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); | 183 | IConfig config = configSource.AddConfig("Startup"); |
184 | config.Set("serverside_object_permissions", true); | ||
185 | config.Set("EventQueue", true); | ||
186 | |||
132 | EntityTransferModule etm = new EntityTransferModule(); | 187 | EntityTransferModule etm = new EntityTransferModule(); |
188 | |||
189 | EventQueueGetModule eqgm1 = new EventQueueGetModule(); | ||
190 | SceneHelpers.SetupSceneModules(myScene1, configSource, etm, eqgm1); | ||
191 | |||
192 | EventQueueGetModule eqgm2 = new EventQueueGetModule(); | ||
193 | SceneHelpers.SetupSceneModules(myScene2, configSource, etm, eqgm2); | ||
133 | 194 | ||
134 | SceneHelpers.SetupSceneModules(myScene1, configSource, etm); | 195 | // SceneHelpers.AddScenePresence(myScene1, agent1Id); |
135 | |||
136 | SceneHelpers.AddScenePresence(myScene1, agent1Id); | ||
137 | // ScenePresence childPresence = myScene2.GetScenePresence(agent1); | 196 | // ScenePresence childPresence = myScene2.GetScenePresence(agent1); |
138 | 197 | // | |
139 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents | 198 | // // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents |
140 | // Assert.That(childPresence, Is.Not.Null); | 199 | // Assert.That(childPresence, Is.Not.Null); |
141 | // Assert.That(childPresence.IsChildAgent, Is.True); | 200 | // Assert.That(childPresence.IsChildAgent, Is.True); |
142 | } | 201 | } |
@@ -194,48 +253,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
194 | // Assert.That(presence, Is.Null, "presence is not null"); | 253 | // Assert.That(presence, Is.Null, "presence is not null"); |
195 | // } | 254 | // } |
196 | 255 | ||
197 | [Test] | ||
198 | public void T012_TestAddNeighbourRegion() | ||
199 | { | ||
200 | TestHelpers.InMethod(); | ||
201 | |||
202 | string reason; | ||
203 | |||
204 | if (acd1 == null) | ||
205 | fixNullPresence(); | ||
206 | |||
207 | scene.NewUserConnection(acd1, 0, out reason); | ||
208 | if (testclient == null) | ||
209 | testclient = new TestClient(acd1, scene); | ||
210 | scene.AddNewClient(testclient, PresenceType.User); | ||
211 | |||
212 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
213 | presence.MakeRootAgent(new Vector3(90,90,90),false); | ||
214 | |||
215 | string cap = presence.ControllingClient.RequestClientInfo().CapsPath; | ||
216 | |||
217 | presence.AddNeighbourRegion(region2, cap); | ||
218 | presence.AddNeighbourRegion(region3, cap); | ||
219 | |||
220 | Assert.That(presence.KnownRegionCount, Is.EqualTo(2)); | ||
221 | } | ||
222 | |||
223 | [Test] | ||
224 | public void T013_TestRemoveNeighbourRegion() | ||
225 | { | ||
226 | TestHelpers.InMethod(); | ||
227 | |||
228 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
229 | presence.RemoveNeighbourRegion(region3); | ||
230 | |||
231 | Assert.That(presence.KnownRegionCount,Is.EqualTo(1)); | ||
232 | /* | ||
233 | presence.MakeChildAgent; | ||
234 | presence.MakeRootAgent; | ||
235 | CompleteAvatarMovement | ||
236 | */ | ||
237 | } | ||
238 | |||
239 | // I'm commenting this test because it does not represent | 256 | // I'm commenting this test because it does not represent |
240 | // crossings. The Thread.Sleep's in here are not meaningful mocks, | 257 | // crossings. The Thread.Sleep's in here are not meaningful mocks, |
241 | // and they sometimes fail in panda. | 258 | // and they sometimes fail in panda. |
@@ -338,33 +355,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
338 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); | 355 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); |
339 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); | 356 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); |
340 | } | 357 | } |
341 | |||
342 | public void fixNullPresence() | ||
343 | { | ||
344 | string firstName = "testfirstname"; | ||
345 | |||
346 | AgentCircuitData agent = new AgentCircuitData(); | ||
347 | agent.AgentID = agent1; | ||
348 | agent.firstname = firstName; | ||
349 | agent.lastname = "testlastname"; | ||
350 | agent.SessionID = UUID.Zero; | ||
351 | agent.SecureSessionID = UUID.Zero; | ||
352 | agent.circuitcode = 123; | ||
353 | agent.BaseFolder = UUID.Zero; | ||
354 | agent.InventoryFolder = UUID.Zero; | ||
355 | agent.startpos = Vector3.Zero; | ||
356 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
357 | agent.Appearance = new AvatarAppearance(); | ||
358 | |||
359 | acd1 = agent; | ||
360 | } | ||
361 | |||
362 | public static string GetRandomCapsObjectPath() | ||
363 | { | ||
364 | UUID caps = UUID.Random(); | ||
365 | string capsPath = caps.ToString(); | ||
366 | capsPath = capsPath.Remove(capsPath.Length - 4, 4); | ||
367 | return capsPath; | ||
368 | } | ||
369 | } | 358 | } |
370 | } \ No newline at end of file | 359 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs new file mode 100644 index 0000000..4a0533c --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using System.Text; | ||
32 | using System.Threading; | ||
33 | using System.Timers; | ||
34 | using Nini.Config; | ||
35 | using NUnit.Framework; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Region.Framework.Interfaces; | ||
41 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
42 | using OpenSim.Region.CoreModules.World.Serialiser; | ||
43 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | ||
44 | using OpenSim.Region.Physics.Manager; | ||
45 | using OpenSim.Tests.Common; | ||
46 | using OpenSim.Tests.Common.Mock; | ||
47 | |||
48 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
49 | { | ||
50 | /// <summary> | ||
51 | /// Scene presence animation tests | ||
52 | /// </summary> | ||
53 | [TestFixture] | ||
54 | public class ScenePresenceAnimationTests | ||
55 | { | ||
56 | [Test] | ||
57 | public void TestFlyingAnimation() | ||
58 | { | ||
59 | TestHelpers.InMethod(); | ||
60 | // log4net.Config.XmlConfigurator.Configure(); | ||
61 | |||
62 | TestScene scene = SceneHelpers.SetupScene(); | ||
63 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
64 | sp.PhysicsActor.Flying = true; | ||
65 | sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); | ||
66 | |||
67 | Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER")); | ||
68 | } | ||
69 | } | ||
70 | } \ No newline at end of file | ||