diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cecb9cff5d..b6eb4e4433 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -6037,5 +6037,10 @@ namespace OpenSim.Region.Framework.Scenes Overrides.SetOverride(animState, animID); Animator.SendAnimPack(); } + + public UUID GetAnimationOverride(string animState) + { + return Overrides.GetOverriddenAnimation(animState); + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 04ed0d1055..9dcdf5b143 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -13545,6 +13545,102 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api presence.SetAnimationOverride(state, animID); } + + public void llResetAnimationOverride(LSL_String animState) + { + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); + if (presence == null) + return; + + if (m_item.PermsGranter == UUID.Zero) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return; + } + + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS) == 0) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return; + } + + if (animState == "ALL") + { + presence.SetAnimationOverride("ALL", UUID.Zero); + return; + } + + string state = String.Empty; + + foreach (KeyValuePair kvp in MovementAnimationsForLSL) + { + if (kvp.Value.ToLower() == ((string)animState).ToLower()) + { + state = kvp.Key; + break; + } + } + + if (state == String.Empty) + { + return; + } + + presence.SetAnimationOverride(state, UUID.Zero); + } + + public LSL_String llGetAnimationOverride(LSL_String animState) + { + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); + if (presence == null) + return String.Empty; + + if (m_item.PermsGranter == UUID.Zero) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return String.Empty; + } + + if ((m_item.PermsMask & (ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS | ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION)) == 0) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return String.Empty; + } + + string state = String.Empty; + + foreach (KeyValuePair kvp in MovementAnimationsForLSL) + { + if (kvp.Value.ToLower() == ((string)animState).ToLower()) + { + state = kvp.Key; + break; + } + } + + if (state == String.Empty) + { + return String.Empty; + } + + UUID animID = presence.GetAnimationOverride(state); + if (animID == UUID.Zero) + return animState; + + foreach (KeyValuePair kvp in DefaultAvatarAnimations.AnimsUUID) + { + if (kvp.Value == animID) + return MovementAnimationsForLSL[kvp.Key]; + } + + foreach (TaskInventoryItem item in m_host.Inventory.GetInventoryItems()) + { + if (item.AssetID == animID) + return item.Name; + } + + return String.Empty; + } } public class NotecardCache diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 14e659f088..8c515641b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -435,5 +435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); LSL_List llGetPhysicsMaterial(); void llSetAnimationOverride(LSL_String animState, LSL_String anim); + void llResetAnimationOverride(LSL_String anim_state); + LSL_String llGetAnimationOverride(LSL_String anim_state); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 753bbb7cb6..78c41a78d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -2019,5 +2019,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { m_LSL_Functions.llSetAnimationOverride(animState, anim); } + + public void llResetAnimationOverride(LSL_String anim_state) + { + m_LSL_Functions.llResetAnimationOverride(anim_state); + } + + public LSL_String llGetAnimationOverride(LSL_String anim_state) + { + return m_LSL_Functions.llGetAnimationOverride(anim_state); + } } }