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. --- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs') 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() -- cgit v1.1 From 115e1c2abb7755eb7b5ffeafbc0aecd255ccfc4e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Jan 2013 23:22:02 +0000 Subject: Add "debug set set animations true|false" region console command. Setting this logs extra information about animation add/remove, such as uuid and animation name Unfortunately cannot be done per client yet --- .../Scenes/Animation/ScenePresenceAnimator.cs | 33 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 3657dc4..e92a087 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -86,7 +86,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; -// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); + if (m_scenePresence.Scene.DebugAnimations) + m_log.DebugFormat( + "[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", + GetAnimName(animID), animID, m_scenePresence.Name); if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) SendAnimPack(); @@ -122,7 +125,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; -// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Removing animation {0} for {1}", animID, m_scenePresence.Name); + if (m_scenePresence.Scene.DebugAnimations) + m_log.DebugFormat( + "[SCENE PRESENCE ANIMATOR]: Removing animation {0} {1} for {2}", + GetAnimName(animID), animID, m_scenePresence.Name); if (m_animations.Remove(animID, allowNoDefault)) SendAnimPack(); @@ -145,9 +151,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation public void ResetAnimations() { -// m_log.DebugFormat( -// "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", -// m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); + if (m_scenePresence.Scene.DebugAnimations) + m_log.DebugFormat( + "[SCENE PRESENCE ANIMATOR]: Resetting animations for {0} in {1}", + m_scenePresence.Name, m_scenePresence.Scene.RegionInfo.RegionName); m_animations.Clear(); } @@ -558,5 +565,21 @@ namespace OpenSim.Region.Framework.Scenes.Animation SendAnimPack(animIDs, sequenceNums, objectIDs); } + + public string GetAnimName(UUID animId) + { + string animName; + + if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName)) + { + AssetMetadata amd = m_scenePresence.Scene.AssetService.GetMetadata(animId.ToString()); + if (amd != null) + animName = amd.Name; + else + animName = "Unknown"; + } + + return animName; + } } } -- cgit v1.1