From 7461fe4554f8104212071e3e01b07786f8eb546f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 12 May 2012 15:27:37 +0100 Subject: ªTEST MESS* reduce animation packets send. Added onchangeanim event with parameters to define if to add or remove, and if to send anims pack on that evocation, etc --- .../Scenes/Animation/ScenePresenceAnimator.cs | 20 ++++++++++++++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 ++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index f5623bd..e577958 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -79,13 +79,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation m_scenePresence = sp; CurrentMovementAnimation = "CROUCH"; } - + public void AddAnimation(UUID animID, UUID objectID) { if (m_scenePresence.IsChildAgent) return; -// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); + // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) SendAnimPack(); @@ -117,6 +117,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation SendAnimPack(); } + public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack) + { + if (m_scenePresence.IsChildAgent) + return; + + if (animID != UUID.Zero) + { + if (addRemove) + m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero); + else + m_animations.Remove(animID); + } + if(sendPack) + SendAnimPack(); + } + // Called from scripts public void RemoveAnimation(string name) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 212720e..ba0ed95 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -781,6 +781,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; ControllingClient.OnStartAnim += HandleStartAnim; ControllingClient.OnStopAnim += HandleStopAnim; + ControllingClient.OnChangeAnim += avnHandleChangeAnim; ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; ControllingClient.OnAutoPilotGo += MoveToTarget; @@ -2432,6 +2433,13 @@ namespace OpenSim.Region.Framework.Scenes Animator.RemoveAnimation(animID); } + public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack) + { + Animator.avnChangeAnim(animID, addRemove, sendPack); + } + + + /// /// Rotate the avatar to the given rotation and apply a movement in the given relative vector /// -- cgit v1.1 From 9b7023a159c69d599248783d88ba96a328a584f2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 12 May 2012 17:58:36 +0100 Subject: display a sleep time of zero if forced spare time to zero, when sim fps is lower than desired, for better display coerence. --- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 94f1b15..a4afd47 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -264,8 +264,12 @@ namespace OpenSim.Region.Framework.Scenes float targetframetime = 1100.0f / (float)m_nominalReportedFps; float sparetime; - if (TotalFrameTime > targetframetime ) + float sleeptime; + if (TotalFrameTime > targetframetime) + { sparetime = 0; + sleeptime = 0; + } else { sparetime = m_frameMS - m_physicsMS - m_agentMS; @@ -274,6 +278,7 @@ namespace OpenSim.Region.Framework.Scenes sparetime = 0; else if (sparetime > TotalFrameTime) sparetime = TotalFrameTime; + sleeptime = m_sleeptimeMS * perframe; } // other MS is actually simulation time @@ -363,7 +368,7 @@ namespace OpenSim.Region.Framework.Scenes sb[21].StatValue = sparetime; sb[22].StatID = (uint)Stats.SimSleepTime; - sb[22].StatValue = m_sleeptimeMS * perframe; + sb[22].StatValue = sleeptime; for (int i = 0; i < 23; i++) { -- cgit v1.1