From 1324082b90a0c52a8f6d61802aff3442fb95df67 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Nov 2009 15:05:40 +0000 Subject: refactor: move most animation methods from ScenePresence into a new ScenePresenceAnimator class --- .../Shared/Api/Implementation/LSL_Api.cs | 23 ++++++++++++---------- .../Shared/Api/Implementation/OSSL_Api.cs | 9 +++++---- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0ea62d7..ff5dd98 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3093,11 +3093,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // Do NOT try to parse UUID, animations cannot be triggered by ID - UUID animID=InventoryKey(anim, (int)AssetType.Animation); + UUID animID = InventoryKey(anim, (int)AssetType.Animation); if (animID == UUID.Zero) - presence.AddAnimation(anim, m_host.UUID); + presence.Animator.AddAnimation(anim, m_host.UUID); else - presence.AddAnimation(animID, m_host.UUID); + presence.Animator.AddAnimation(animID, m_host.UUID); } } } @@ -3137,9 +3137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { if (animID == UUID.Zero) - presence.RemoveAnimation(anim); + presence.Animator.RemoveAnimation(anim); else - presence.RemoveAnimation(animID); + presence.Animator.RemoveAnimation(animID); } } } @@ -3983,12 +3983,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { - AnimationSet currentAnims = presence.Animations; + AnimationSet currentAnims = presence.Animator.Animations; string currentAnimationState = String.Empty; if (animationstateNames.TryGetValue(currentAnims.DefaultAnimation.AnimID, out currentAnimationState)) return currentAnimationState; } } + return String.Empty; } @@ -5322,7 +5323,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api flags |= ScriptBaseClass.AGENT_TYPING; } - string agentMovementAnimation = agent.GetMovementAnimation(); + string agentMovementAnimation = agent.Animator.GetMovementAnimation(); if (agentMovementAnimation == "CROUCH") { @@ -5354,7 +5355,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api flags |= ScriptBaseClass.AGENT_SITTING; } - if (agent.Animations.DefaultAnimation.AnimID == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) + if (agent.Animator.Animations.DefaultAnimation.AnimID + == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { flags |= ScriptBaseClass.AGENT_SITTING; } @@ -7144,7 +7146,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (av == null || av.IsChildAgent) // only if in the region return l; UUID[] anims; - anims = av.GetAnimationArray(); + anims = av.Animator.GetAnimationArray(); foreach (UUID foo in anims) l.Add(foo.ToString()); return l; @@ -7272,7 +7274,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { LSL_Vector lower; LSL_Vector upper; - if (presence.Animations.DefaultAnimation.AnimID == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) + if (presence.Animator.Animations.DefaultAnimation.AnimID + == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { // This is for ground sitting avatars float height = presence.Appearance.AvatarHeight / 2.66666667f; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3ffcff0..7fdbac8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -741,9 +741,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } if (animID == UUID.Zero) - target.AddAnimation(animation, m_host.UUID); + target.Animator.AddAnimation(animation, m_host.UUID); else - target.AddAnimation(animID, m_host.UUID); + target.Animator.AddAnimation(animID, m_host.UUID); } } } @@ -773,10 +773,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } + if (animID == UUID.Zero) - target.RemoveAnimation(animation); + target.Animator.RemoveAnimation(animation); else - target.RemoveAnimation(animID); + target.Animator.RemoveAnimation(animID); } } } -- cgit v1.1 From 61c76d1810fcb430cf9c7441044c70486efd9bc5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 17 Nov 2009 15:20:02 +0000 Subject: refactor: move AnimationSet --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ff5dd98..8eebf02 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -40,10 +40,11 @@ using OpenSim; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.CoreModules; -using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.World.Land; using OpenSim.Region.CoreModules.World.Terrain; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Physics.Manager; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; -- cgit v1.1