From 2a6597f61e6a21a6950a0b951e56a13c54e49e21 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Dec 2011 22:14:47 +0000 Subject: Remove pointless Animator.TrySetMovementAnimation("STAND") in ScenePresnece constructor. Comment was right - it is indeed useless since SP always starts off as child and TrySetMovementAnimation screens out child SP --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c2d3501..1c2025c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -782,9 +782,6 @@ namespace OpenSim.Region.Framework.Scenes AdjustKnownSeeds(); - // TODO: I think, this won't send anything, as we are still a child here... - Animator.TrySetMovementAnimation("STAND"); - // we created a new ScenePresence (a new child agent) in a fresh region. // Request info about all the (root) agents in this region // Note: This won't send data *to* other clients in that region (children don't send) -- cgit v1.1 From 054ebe8878cbd1552fe96c0df631f50d5c2409d3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 2 Dec 2011 23:56:01 +0000 Subject: Stop some places where we're trying to reset animations in child agents where such requests are ignored. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 25 +++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1c2025c..b93b67d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -995,13 +995,17 @@ namespace OpenSim.Region.Framework.Scenes /// /// This turns a root agent into a child agent + /// + /// /// when an agent departs this region for a neighbor, this gets called. /// /// It doesn't get called for a teleport. Reason being, an agent that /// teleports out may not end up anywhere near this region - /// + /// public void MakeChildAgent() { + m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); + // Reset these so that teleporting in and walking out isn't seen // as teleporting back TeleportFlags = TeleportFlags.Default; @@ -2295,11 +2299,6 @@ namespace OpenSim.Region.Framework.Scenes { m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); - - // TODO: This doesn't prevent the user from walking yet. - // Setting parent ID would fix this, if we knew what value - // to use. Or we could add a m_isSitting variable. - //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); SitGround = true; RemoveFromPhysicalScene(); } @@ -2908,9 +2907,12 @@ namespace OpenSim.Region.Framework.Scenes public void Reset() { +// m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); + // Put the child agent back at the center AbsolutePosition = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); + Animator.ResetAnimations(); } @@ -3133,7 +3135,7 @@ namespace OpenSim.Region.Framework.Scenes } } - public void CopyFrom(AgentData cAgent) + private void CopyFrom(AgentData cAgent) { m_originRegionID = cAgent.RegionID; @@ -3192,13 +3194,8 @@ namespace OpenSim.Region.Framework.Scenes } } catch { } - // Animations - try - { - Animator.ResetAnimations(); - Animator.Animations.FromArray(cAgent.Anims); - } - catch { } + + Animator.Animations.FromArray(cAgent.Anims); if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) { -- cgit v1.1 From 96c191f4fdbd64009fc210b8c911c832723bb10e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Dec 2011 00:09:18 +0000 Subject: Stop SP.HandleAgentUpdate() and PhysicsCollisionUpdate() from being processed if we're dealing with a child ScenePresence. Neither of these can have any effect on child agents Now leaving warning about trying to set animation on a child agent active. Might temporarily pop up now and again. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b93b67d..c517978 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1293,11 +1293,11 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE PRESENCE]: In {0} received agent update from {1}", // Scene.RegionInfo.RegionName, remoteClient.Name); - //if (IsChildAgent) - //{ + if (IsChildAgent) + { // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); - // return; - //} + return; + } ++m_movementUpdateCount; if (m_movementUpdateCount < 1) @@ -3280,6 +3280,9 @@ namespace OpenSim.Region.Framework.Scenes // Event called by the physics plugin to tell the avatar about a collision. private void PhysicsCollisionUpdate(EventArgs e) { + if (IsChildAgent) + return; + //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( // as of this comment the interval is set in AddToPhysicalScene -- cgit v1.1 From 8185ce8b4afab459655f5cd362b2c6bbb98c28c3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Dec 2011 00:30:13 +0000 Subject: Do a cagent.Anims != null check in SP.CopyFrom() --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c517978..7156137 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3195,7 +3195,9 @@ namespace OpenSim.Region.Framework.Scenes } catch { } - Animator.Animations.FromArray(cAgent.Anims); + // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object? + if (cAgent.Anims != null) + Animator.Animations.FromArray(cAgent.Anims); if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) { -- cgit v1.1 From f08aad8a403e18625c01c0b3b4b6d4248476a64b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Dec 2011 01:47:12 +0000 Subject: 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() --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7156137..663c9ae 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) { -- cgit v1.1 From feef1dd73243cfdd5322632fb67e64cabc1ad4bc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Dec 2011 02:05:11 +0000 Subject: Stop calling Animator.UpdateMovementAnimations() at the end of HandleAgentUpdate(). There's no point doing this if it's being called via PhysicsCollisionUpdate --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 663c9ae..8865b3d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1582,8 +1582,8 @@ namespace OpenSim.Region.Framework.Scenes // } // } - if (update_movementflag && ParentID == 0) - Animator.UpdateMovementAnimations(); +// if (update_movementflag && ParentID == 0) +// Animator.UpdateMovementAnimations(); } m_scene.EventManager.TriggerOnClientMovement(this); -- cgit v1.1 From a009871827c250cc677bd42aed2351a3c2cec021 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Dec 2011 02:39:21 +0000 Subject: Add basic TestFlyingAnimation() regression test --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8865b3d..0533106 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3279,8 +3279,11 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); } - // Event called by the physics plugin to tell the avatar about a collision. - private void PhysicsCollisionUpdate(EventArgs e) + /// + /// Event called by the physics plugin to tell the avatar about a collision. + /// + /// + public void PhysicsCollisionUpdate(EventArgs e) { if (IsChildAgent) return; -- cgit v1.1 From b66fe3e9ffd968c2c8aaa0fba108e86b8c4f04d9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Dec 2011 02:45:02 +0000 Subject: Add method doc to SP.PhysicsCollisionUpdate() to make it clear that it's called continuously even where there are no collisions --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0533106..1fe8048 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3282,6 +3282,10 @@ namespace OpenSim.Region.Framework.Scenes /// /// Event called by the physics plugin to tell the avatar about a collision. /// + /// + /// This function is called continuously, even when there are no collisions which might be very inefficient. + /// However, we can't avoid this yet since some of this method might currently rely on being called every frame. + /// /// public void PhysicsCollisionUpdate(EventArgs e) { -- cgit v1.1 From 585fc5e79d4b87a5375fa3c2986b5f91d0de1f4e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 3 Dec 2011 02:51:17 +0000 Subject: Update SP.PhysicsCollisionUpdate() doc. It might be inefficient, but there are collisions every frame if the avatar is walking/standing on the ground or a prim surface --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 1fe8048..5b9438b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3283,8 +3283,11 @@ namespace OpenSim.Region.Framework.Scenes /// Event called by the physics plugin to tell the avatar about a collision. /// /// - /// This function is called continuously, even when there are no collisions which might be very inefficient. - /// However, we can't avoid this yet since some of this method might currently rely on being called every frame. + /// This function is called continuously, even when there are no collisions. If the avatar is walking on the + /// ground or a prim then there will be collision information between the avatar and the surface. + /// + /// FIXME: However, we can't safely avoid calling this yet where there are no collisions without analyzing whether + /// any part of this method is relying on an every-frame call. /// /// public void PhysicsCollisionUpdate(EventArgs e) -- cgit v1.1