diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 3657dc4ebc..e92a087625 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; + } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4859dffadb..5778176e44 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -67,6 +67,11 @@ namespace OpenSim.Region.Framework.Scenes public bool EmergencyMonitoring = false; + /// + /// Show debug information about animations. + /// + public bool DebugAnimations { get; set; } + /// /// Show debug information about teleports. /// diff --git a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs index e951d9e37c..84211a9ba9 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Animations/AnimationsCommandModule.cs @@ -161,12 +161,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations UUID defaultAnimId = anims.DefaultAnimation.AnimID; cdl.AddRow( "Default anim", - string.Format("{0}, {1}", defaultAnimId, GetAnimName(sp.Scene.AssetService, defaultAnimId))); + string.Format("{0}, {1}", defaultAnimId, sp.Animator.GetAnimName(defaultAnimId))); UUID implicitDefaultAnimId = anims.ImplicitDefaultAnimation.AnimID; cdl.AddRow( "Implicit default anim", - string.Format("{0}, {1}", implicitDefaultAnimId, GetAnimName(sp.Scene.AssetService, implicitDefaultAnimId))); + string.Format("{0}, {1}", + implicitDefaultAnimId, sp.Animator.GetAnimName(implicitDefaultAnimId))); cdl.AddToStringBuilder(sb); @@ -185,7 +186,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations for (int i = 0; i < animIds.Length; i++) { UUID animId = animIds[i]; - string animName = GetAnimName(sp.Scene.AssetService, animId); + string animName = sp.Animator.GetAnimName(animId); int seq = sequenceNumbers[i]; UUID objectId = objectIds[i]; @@ -195,21 +196,5 @@ namespace OpenSim.Region.OptionalModules.Avatar.Animations cdt.AddToStringBuilder(sb); sb.Append("\n"); } - - private string GetAnimName(IAssetService assetService, UUID animId) - { - string animName; - - if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName)) - { - AssetMetadata amd = assetService.GetMetadata(animId.ToString()); - if (amd != null) - animName = amd.Name; - else - animName = "Unknown"; - } - - return animName; - } } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs index 8b8758e59c..521141a851 100644 --- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs @@ -94,6 +94,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments "debug scene get", "List current scene options.", "If active is false then main scene update and maintenance loops are suspended.\n" + + "If animations is true then extra animations debug information is logged.\n" + "If collisions is false then collisions with other objects are turned off.\n" + "If pbackup is false then periodic scene backup is turned off.\n" + "If physics is false then all physics objects are non-physical.\n" @@ -107,6 +108,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments "debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false", "Turn on scene debugging options.", "If active is false then main scene update and maintenance loops are suspended.\n" + + "If animations is true then extra animations debug information is logged.\n" + "If collisions is false then collisions with other objects are turned off.\n" + "If pbackup is false then periodic scene backup is turned off.\n" + "If physics is false then all physics objects are non-physical.\n" @@ -135,6 +137,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments { ConsoleDisplayList cdl = new ConsoleDisplayList(); cdl.AddRow("active", m_scene.Active); + cdl.AddRow("animations", m_scene.DebugAnimations); cdl.AddRow("pbackup", m_scene.PeriodicBackup); cdl.AddRow("physics", m_scene.PhysicsEnabled); cdl.AddRow("scripting", m_scene.ScriptsEnabled); @@ -178,6 +181,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments m_scene.Active = active; } + if (options.ContainsKey("animations")) + { + bool active; + + if (bool.TryParse(options["animations"], out active)) + m_scene.DebugAnimations = active; + } + if (options.ContainsKey("pbackup")) { bool active;