From f08aad8a403e18625c01c0b3b4b6d4248476a64b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 3 Dec 2011 01:47:12 +0000 Subject: [PATCH] For now, disable mechanism to limit avatar animation updates since this causes avatars to never reach the correct animation after some actions. This reverts to situation where animation updates are made each frame on SP.PhysicsCollisionUpdate (though a packet is only sent if the anim actually changes). m_updateCount was not being update on various avatar state changes, causing the correct animations to never be sent. Always setting in HandleAgentUpdate() is not enough since the avatar is continually sending AgentUpdate packets. One would need to identify all the conditions under which animations need to play out and set m_updateCount appropriately in SP.HandleAgentUpdate() --- .../Scenes/Animation/ScenePresenceAnimator.cs | 5 ++ .../Region/Framework/Scenes/ScenePresence.cs | 46 +++++++++---------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 2a6b8eaed2..43cfd807b3 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -399,6 +399,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation public void UpdateMovementAnimations() { CurrentMovementAnimation = DetermineMovementAnimation(); + +// m_log.DebugFormat( +// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", +// CurrentMovementAnimation, m_scenePresence.Name); + TrySetMovementAnimation(CurrentMovementAnimation); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7156137aad..663c9aeaad 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -149,9 +149,9 @@ namespace OpenSim.Region.Framework.Scenes } private bool m_wasFlying; // add for fly velocity control - private int m_lastColCount = -1; //KF: Look for Collision chnages - private int m_updateCount = 0; //KF: Update Anims for a while - private static readonly int UPDATE_COUNT = 10; // how many frames to update for +// private int m_lastColCount = -1; //KF: Look for Collision chnages +// private int m_updateCount = 0; //KF: Update Anims for a while +// private static readonly int UPDATE_COUNT = 10; // how many frames to update for private TeleportFlags m_teleportFlags; public TeleportFlags TeleportFlags @@ -1366,14 +1366,14 @@ namespace OpenSim.Region.Framework.Scenes #endregion Inputs - // Make anims work for client side autopilot - if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) - m_updateCount = UPDATE_COUNT; - - // Make turning in place work - if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || - (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) - m_updateCount = UPDATE_COUNT; +// // Make anims work for client side autopilot +// if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) +// m_updateCount = UPDATE_COUNT; +// +// // Make turning in place work +// if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || +// (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) +// m_updateCount = UPDATE_COUNT; if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) { @@ -2297,7 +2297,7 @@ namespace OpenSim.Region.Framework.Scenes public void HandleAgentSitOnGround() { - m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. +// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); SitGround = true; RemoveFromPhysicalScene(); @@ -3290,11 +3290,11 @@ namespace OpenSim.Region.Framework.Scenes // as of this comment the interval is set in AddToPhysicalScene if (Animator != null) { - if (m_updateCount > 0) - { +// if (m_updateCount > 0) +// { Animator.UpdateMovementAnimations(); - m_updateCount--; - } +// m_updateCount--; +// } } CollisionEventUpdate collisionData = (CollisionEventUpdate)e; @@ -3302,13 +3302,13 @@ namespace OpenSim.Region.Framework.Scenes CollisionPlane = Vector4.UnitW; - // No collisions at all means we may be flying. Update always - // to make falling work - if (m_lastColCount != coldata.Count || coldata.Count == 0) - { - m_updateCount = UPDATE_COUNT; - m_lastColCount = coldata.Count; - } +// // No collisions at all means we may be flying. Update always +// // to make falling work +// if (m_lastColCount != coldata.Count || coldata.Count == 0) +// { +// m_updateCount = UPDATE_COUNT; +// m_lastColCount = coldata.Count; +// } if (coldata.Count != 0 && Animator != null) {