From 74256c0cc47870f6057b64ce117479af79f02ab0 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 5b16b67..3657dc4 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -109,14 +109,22 @@ 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;
// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Removing animation {0} for {1}", animID, m_scenePresence.Name);
- if (m_animations.Remove(animID))
+ if (m_animations.Remove(animID, allowNoDefault))
SendAnimPack();
}
@@ -132,7 +140,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 6979c33..c295305 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2260,7 +2260,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 d47fd6b..a2f1ff2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3364,7 +3364,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 25635ff..5c0ff1c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -986,7 +986,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