From f66b58cf00d4dcbd9d11030809bf9766330966f2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 10 Sep 2014 19:30:57 +0100 Subject: *TEST* add movement states SIT and SITGROUND. ScenePresence on SIT, SITGROUND or STAND, sets directly the state, and desired sitAnimation for default sits --- .../Scenes/Animation/ScenePresenceAnimator.cs | 47 +++++++++++++++------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 28 ++++++++++--- .../Shared/Api/Implementation/LSL_Api.cs | 30 ++++++++------ 3 files changed, 71 insertions(+), 34 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index bbc5745..4d1d913 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -200,21 +200,28 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (overridenAnim != UUID.Zero) { m_animations.SetDefaultAnimation(overridenAnim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID); - m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); + m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION }); SendAnimPack(); ret = true; } - else if (m_animations.TrySetDefaultAnimation( - anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) + else { -// m_log.DebugFormat( -// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", -// anim, m_scenePresence.Name); + // translate sit and sitground state animations + if (anim == "SIT" || anim == "SITGROUND") + anim = m_scenePresence.sitAnimation; - // 16384 is CHANGED_ANIMATION - m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); - SendAnimPack(); - ret = true; + if (m_animations.TrySetDefaultAnimation( + anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) + { + // m_log.DebugFormat( + // "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", + // anim, m_scenePresence.Name); + + // 16384 is CHANGED_ANIMATION + m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION }); + SendAnimPack(); + ret = true; + } } } else @@ -236,6 +243,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation const float JUMP_PERIOD = 800f; #region Inputs + if (m_scenePresence.SitGround) + return "SITGROUND"; + if (m_scenePresence.ParentID != 0 || m_scenePresence.ParentUUID != UUID.Zero) + return "SIT"; + AgentManager.ControlFlags controlFlags = (AgentManager.ControlFlags)m_scenePresence.AgentControlFlags; PhysicsActor actor = m_scenePresence.PhysicsActor; @@ -491,15 +503,20 @@ namespace OpenSim.Region.Framework.Scenes.Animation public bool ForceUpdateMovementAnimations() { - // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name); + lock (m_animations) + { + CurrentMovementAnimation = DetermineMovementAnimation(); + return TrySetMovementAnimation(CurrentMovementAnimation); + } + } - bool ret = false; + public bool SetMovementAnimations(string motionState) + { lock (m_animations) { - string newMovementAnimation = DetermineMovementAnimation(); - ret = TrySetMovementAnimation(newMovementAnimation); + CurrentMovementAnimation = motionState; + return TrySetMovementAnimation(CurrentMovementAnimation); } - return ret; } public UUID[] GetAnimationArray() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5da92f9..fd1bab6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.Framework.Scenes /// Server Side Animation Override /// public MovementAnimationOverrides Overrides { get; private set; } - + public String sitAnimation = "SIT"; /// /// Attachments recorded on this avatar. /// @@ -2779,7 +2779,11 @@ namespace OpenSim.Region.Framework.Scenes SendAvatarDataToAllAgents(); } - Animator.TrySetMovementAnimation("STAND"); + // reset to default sitAnimation + sitAnimation = "SIT"; + +// Animator.TrySetMovementAnimation("STAND"); + Animator.SetMovementAnimations("STAND"); TriggerScenePresenceUpdated(); } @@ -3058,11 +3062,18 @@ namespace OpenSim.Region.Framework.Scenes SendAvatarDataToAllAgents(); +/* if(status == 3) Animator.TrySetMovementAnimation("SIT_GROUND"); else Animator.TrySetMovementAnimation("SIT"); +*/ + if (status == 3) + sitAnimation = "SIT_GROUND"; + else + sitAnimation = "SIT"; + Animator.SetMovementAnimations("SIT"); part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); } @@ -3164,12 +3175,13 @@ namespace OpenSim.Region.Framework.Scenes SendAvatarDataToAllAgents(); - String sitAnimation = "SIT"; + sitAnimation = "SIT"; if (!String.IsNullOrEmpty(part.SitAnimation)) { sitAnimation = part.SitAnimation; } - Animator.TrySetMovementAnimation(sitAnimation); +// Animator.TrySetMovementAnimation(sitAnimation); + Animator.SetMovementAnimations("SIT"); TriggerScenePresenceUpdated(); } } @@ -3181,10 +3193,14 @@ namespace OpenSim.Region.Framework.Scenes // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. m_AngularVelocity = Vector3.Zero; - Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); - TriggerScenePresenceUpdated(); + sitAnimation = "SIT_GROUND_CONSTRAINED"; +// Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); +// TriggerScenePresenceUpdated(); SitGround = true; RemoveFromPhysicalScene(); + + Animator.SetMovementAnimations("SITGROUND"); + TriggerScenePresenceUpdated(); } /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 755646f..ca682d3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -132,25 +132,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api private Dictionary MovementAnimationsForLSL = new Dictionary { + {"CROUCH", "Crouching"}, + {"CROUCHWALK", "CrouchWalking"}, + {"FALLDOWN", "Falling Down"}, {"FLY", "Flying"}, {"FLYSLOW", "FlyingSlow"}, + {"HOVER", "Hovering"}, {"HOVER_UP", "Hovering Up"}, {"HOVER_DOWN", "Hovering Down"}, - {"HOVER", "Hovering"}, + {"JUMP", "Jumping"}, {"LAND", "Landing"}, - {"FALLDOWN", "Falling Down"}, {"PREJUMP", "PreJumping"}, - {"JUMP", "Jumping"}, + {"RUN", "Running"}, + {"SIT","Sitting"}, + {"SITGROUND","Sitting on Ground"}, + {"STAND", "Standing"}, {"STANDUP", "Standing Up"}, + {"STRIDE","Striding"}, {"SOFT_LAND", "Soft Landing"}, - {"STAND", "Standing"}, - {"CROUCHWALK", "CrouchWalking"}, - {"RUN", "Running"}, - {"WALK", "Walking"}, - {"CROUCH", "Crouching"}, {"TURNLEFT", "Turning Left"}, - {"TURNRIGHT", "Turning Right"} + {"TURNRIGHT", "Turning Right"}, + {"WALK", "Walking"} }; + //An array of HTTP/1.1 headers that are not allowed to be used //as custom headers by llHTTPRequest. private string[] HttpStandardHeaders = @@ -4884,10 +4888,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (presence != null) { - if (presence.SitGround) - return "Sitting on Ground"; - if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero) - return "Sitting"; +// if (presence.SitGround) +// return "Sitting on Ground"; +// if (presence.ParentID != 0 || presence.ParentUUID != UUID.Zero) +// return "Sitting"; string movementAnimation = presence.Animator.CurrentMovementAnimation; string lslMovementAnimation; -- cgit v1.1