From af5a3f2d7392ce6f86ef210c401956ca92cdb8e2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Jan 2013 22:57:09 +0000 Subject: Restore previous client AO behaviour by not allowing them to remove the default animation but continue to allow scripts to do so. This keeps the fix from http://opensimulator.org/mantis/view.php?id=6327 and fixes the behaviour regression in http://opensimulator.org/mantis/view.php?id=6483 Animations may still exhibit different behaviour if both scripts and clients are adjusting animations. A change in the behaviour of client AO to not remove all animations may be a better long term approach. --- OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | 15 +++++++++++++-- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 14 +++++++++++--- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 65ae445..66edfed 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -87,13 +87,24 @@ namespace OpenSim.Region.Framework.Scenes.Animation return false; } - public bool Remove(UUID animID) + /// + /// Remove the specified animation + /// + /// + /// + /// If true, then the default animation can be entirely removed. + /// If false, then removing the default animation will reset it to the simulator default (currently STAND). + /// + public bool Remove(UUID animID, bool allowNoDefault) { lock (m_animations) { if (m_defaultAnimation.AnimID == animID) { - m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); + if (allowNoDefault) + m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero); + else + ResetDefaultAnimation(); } else if (HasAnimation(animID)) { diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 8bd3cf9..e92a087 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -112,7 +112,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation AddAnimation(animID, objectID); } - public void RemoveAnimation(UUID animID) + /// + /// Remove the specified animation + /// + /// + /// + /// If true, then the default animation can be entirely removed. + /// If false, then removing the default animation will reset it to the simulator default (currently STAND). + /// + public void RemoveAnimation(UUID animID, bool allowNoDefault) { if (m_scenePresence.IsChildAgent) return; @@ -122,7 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", GetAnimName(animID), animID, m_scenePresence.Name); - if (m_animations.Remove(animID)) + if (m_animations.Remove(animID, allowNoDefault)) SendAnimPack(); } @@ -138,7 +146,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (animID == UUID.Zero) return; - RemoveAnimation(animID); + RemoveAnimation(animID, true); } public void ResetAnimations() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index db2e95e..a90872e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2259,7 +2259,7 @@ namespace OpenSim.Region.Framework.Scenes public void HandleStopAnim(IClientAPI remoteClient, UUID animID) { - Animator.RemoveAnimation(animID); + Animator.RemoveAnimation(animID, false); } /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2bdf38b..2493a15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3341,7 +3341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (animID == UUID.Zero) presence.Animator.RemoveAnimation(anim); else - presence.Animator.RemoveAnimation(animID); + presence.Animator.RemoveAnimation(animID, true); } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 828288d..dcc85c4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -974,7 +974,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (animID == UUID.Zero) target.Animator.RemoveAnimation(animation); else - target.Animator.RemoveAnimation(animID); + target.Animator.RemoveAnimation(animID, true); } } } -- cgit v1.1