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.
0.7.5-pf-bulletsim
Justin Clark-Casey (justincc) 2013-01-18 22:57:09 +00:00
parent 0ba01ce699
commit af5a3f2d73
5 changed files with 27 additions and 8 deletions

View File

@ -87,13 +87,24 @@ namespace OpenSim.Region.Framework.Scenes.Animation
return false; return false;
} }
public bool Remove(UUID animID) /// <summary>
/// Remove the specified animation
/// </summary>
/// <param name='animID'></param>
/// <param name='allowNoDefault'>
/// 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).
/// </param>
public bool Remove(UUID animID, bool allowNoDefault)
{ {
lock (m_animations) lock (m_animations)
{ {
if (m_defaultAnimation.AnimID == animID) 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)) else if (HasAnimation(animID))
{ {

View File

@ -112,7 +112,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
AddAnimation(animID, objectID); AddAnimation(animID, objectID);
} }
public void RemoveAnimation(UUID animID) /// <summary>
/// Remove the specified animation
/// </summary>
/// <param name='animID'></param>
/// <param name='allowNoDefault'>
/// 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).
/// </param>
public void RemoveAnimation(UUID animID, bool allowNoDefault)
{ {
if (m_scenePresence.IsChildAgent) if (m_scenePresence.IsChildAgent)
return; return;
@ -122,7 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
"[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}",
GetAnimName(animID), animID, m_scenePresence.Name); GetAnimName(animID), animID, m_scenePresence.Name);
if (m_animations.Remove(animID)) if (m_animations.Remove(animID, allowNoDefault))
SendAnimPack(); SendAnimPack();
} }
@ -138,7 +146,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (animID == UUID.Zero) if (animID == UUID.Zero)
return; return;
RemoveAnimation(animID); RemoveAnimation(animID, true);
} }
public void ResetAnimations() public void ResetAnimations()

View File

@ -2259,7 +2259,7 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleStopAnim(IClientAPI remoteClient, UUID animID) public void HandleStopAnim(IClientAPI remoteClient, UUID animID)
{ {
Animator.RemoveAnimation(animID); Animator.RemoveAnimation(animID, false);
} }
/// <summary> /// <summary>

View File

@ -3341,7 +3341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (animID == UUID.Zero) if (animID == UUID.Zero)
presence.Animator.RemoveAnimation(anim); presence.Animator.RemoveAnimation(anim);
else else
presence.Animator.RemoveAnimation(animID); presence.Animator.RemoveAnimation(animID, true);
} }
} }
} }

View File

@ -974,7 +974,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (animID == UUID.Zero) if (animID == UUID.Zero)
target.Animator.RemoveAnimation(animation); target.Animator.RemoveAnimation(animation);
else else
target.Animator.RemoveAnimation(animID); target.Animator.RemoveAnimation(animID, true);
} }
} }
} }