From f2390f7c72c70912da8c5d4626064996d42811bc Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 9 Sep 2014 03:01:05 +0200 Subject: [PATCH 1/2] Plumb llSetAnimationOverride --- .../Region/Framework/Scenes/ScenePresence.cs | 4 ++ .../Shared/Api/Implementation/LSL_Api.cs | 43 +++++++++++++++++++ .../Shared/Api/Interface/ILSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Constants.cs | 1 + .../Shared/Api/Runtime/LSL_Stub.cs | 5 +++ 5 files changed, 54 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 47acb0b4ae..4d5f747c99 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -6004,5 +6004,9 @@ namespace OpenSim.Region.Framework.Scenes Animator.SendAnimPackToClient(p.ControllingClient); SendAttachmentsToAgentNF(p); } + + public void SetAnimationOverride(string animState, UUID animID) + { + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b5691943d6..085dfc8273 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -13475,6 +13475,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_UrlModule.HttpContentType(new UUID(id),type); } } + + public void llSetAnimationOverride(LSL_String animState, LSL_String anim) + { + string state = String.Empty; + + foreach (KeyValuePair kvp in MovementAnimationsForLSL) + { + if (kvp.Value == animState) + { + state = kvp.Key; + break; + } + } + + if (state == String.Empty) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "Invalid animation state " + animState); + return; + } + + if (m_item.PermsGranter == UUID.Zero) + return; + + if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS) == 0) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "No permission to override animations"); + return; + } + + ScenePresence presence = World.GetScenePresence(m_item.PermsGranter); + + if (presence == null) + return; + + UUID animID = ScriptUtils.GetAssetIdFromItemName(m_host, anim, (int)AssetType.Animation); + if (animID == UUID.Zero) + { + llShout(ScriptBaseClass.DEBUG_CHANNEL, "Animation not found"); + return; + } + + presence.SetAnimationOverride(state, animID); + } } 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 d211a2b256..14e659f088 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -434,5 +434,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetKeyframedMotion(LSL_List frames, LSL_List options); LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); LSL_List llGetPhysicsMaterial(); + void llSetAnimationOverride(LSL_String animState, LSL_String anim); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index e59c0be75a..e6ab6ecf18 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -81,6 +81,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PERMISSION_TRACK_CAMERA = 1024; public const int PERMISSION_CONTROL_CAMERA = 2048; public const int PERMISSION_TELEPORT = 4096; + public const int PERMISSION_OVERRIDE_ANIMATIONS = 0x8000; public const int AGENT_FLYING = 1; public const int AGENT_ATTACHMENTS = 2; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 4fc8d653b5..753bbb7cb6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -2014,5 +2014,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LSL_Functions.llGetPhysicsMaterial(); } + + public void llSetAnimationOverride(LSL_String animState, LSL_String anim) + { + m_LSL_Functions.llSetAnimationOverride(animState, anim); + } } } From e775e1a31751aa2264e0687cea6ba3a2c3d74ae0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 9 Sep 2014 03:03:27 +0200 Subject: [PATCH 2/2] make PERMISSION_OVERRIDE_ANIMATIONS implicit for attachments --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 085dfc8273..f4809a79ab 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3886,7 +3886,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION | ScriptBaseClass.PERMISSION_CONTROL_CAMERA | ScriptBaseClass.PERMISSION_TRACK_CAMERA | - ScriptBaseClass.PERMISSION_ATTACH; + ScriptBaseClass.PERMISSION_ATTACH | + ScriptBaseClass.PERMISSION_OVERRIDE_ANIMATIONS; } else