| Anonymous | Login | Signup for a new account | 2013-05-20 00:33 UTC | ![]() |
| Main | My View | View Issues | Change Log | Roadmap | Summary | My Account |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0006142 | opensim | [REGION] Script Functions | public | 2012-08-09 10:49 | 2012-10-01 17:55 | ||||
| Reporter | SignpostMarv | ||||||||
| Assigned To | melanie | ||||||||
| Priority | normal | Severity | feature | Reproducibility | N/A | ||||
| Status | closed | Resolution | won't fix | ||||||
| Platform | OS | OS Version | |||||||
| Product Version | |||||||||
| Target Version | Fixed in Version | ||||||||
| Summary | 0006142: single function for stopping & starting animations on avatars & npcs. | ||||||||
| Description | Having separate functions for starting & stopping animations for avatars & npcs (and hey, maybe unattached rigged meshes in future :D) requires 1 script call per animation, and different functions depending on whether it's an avatar or an NPC. | ||||||||
| Tags | No tags attached. | ||||||||
| Git Revision or version number | 19417fca41e | ||||||||
| Run Mode | Standalone (1 Region) | ||||||||
| Physics Engine | BulletSim | ||||||||
| Environment | .NET / Windows32 | ||||||||
| Mono Version | None | ||||||||
| Viewer | |||||||||
| Attached Files | From b8e5b54e40184aba3ef4124a1df27ed08d7fdc5a Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Thu, 9 Aug 2012 11:46:13 +0100
Subject: [PATCH] implementing single function for stopping & starting
animations
---
.../Shared/Api/Implementation/OSSL_Api.cs | 59 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 18 +++++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++
3 files changed, 87 insertions(+)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index bcd1a6f..0e02d32 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -977,6 +977,65 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.Moderate, "osAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, false);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, true);
+ }
+
+ private void Animate(string target, LSL_List start, LSL_List stop, bool force)
+ {
+ UUID targetUUID;
+ ScenePresence targetPresence;
+ if ((start.Length > 0 || stop.Length > 0) && UUID.TryParse(target, out targetUUID) && targetUUID != UUID.Zero && World.TryGetScenePresence(targetUUID, out targetPresence))
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID, World);
+ if (
+ force || // if this is true, the other checks will be bypassed
+ (
+ (// if NPC, check for NPC perms
+ isNPC &&
+ npcModule.CheckPermissions(targetUUID, m_host.OwnerID)
+ ) ||
+ ( // if not NPC,
+ // check the perms granter is the avatar
+ // and that we have animation perms
+ !isNPC &&
+ m_item.PermsGranter == targetUUID &&
+ (m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
+ )
+ )
+ )
+ {
+ foreach (object thing in stop.Data)
+ {
+ targetPresence.Animator.RemoveAnimation((LSL_String)thing);
+ }
+ foreach (object thing in start.Data)
+ {
+ targetPresence.Animator.AddAnimation((LSL_String)thing, m_host.UUID);
+ }
+ }
+ else
+ {
+ OSSLShoutError(string.Format("Cannot animate {0}", targetUUID));
+ }
+ }
+ }
+
//Texture draw functions
public string osMovePen(string drawList, int x, int y)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 1f000a3..3fdd45d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -98,6 +98,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarPlayAnimation(string avatar, string animation);
void osAvatarStopAnimation(string avatar, string animation);
+ /// <summary>
+ /// Starts and Stops the listed animations, requiring PERMISSION_TRIGGER_ANIMATION for agents.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osAnimate(string target, LSL_List start, LSL_List stop);
+
+ /// <summary>
+ /// Starts and Stops the listed animations, bypassing permissions checks.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osForceAnimate(string target, LSL_List start, LSL_List stop);
+
// Attachment commands
/// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 94405d2..5b1e561 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -289,6 +289,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osAnimate(target, start, stop);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osForceAnimate(target, start, stop);
+ }
+
// Avatar functions
public void osForceAttachToAvatar(int attachmentPoint)
--
1.7.11.msysgit.1
From b8c69c158db21d949c9236172b5e8a7195a60751 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Thu, 9 Aug 2012 11:46:13 +0100
Subject: [PATCH 1/2] implementing single function for stopping & starting
animations
---
.../Shared/Api/Implementation/OSSL_Api.cs | 59 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 18 +++++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++
3 files changed, 87 insertions(+)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8b73cd9..adc85bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -979,6 +979,65 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.Moderate, "osAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, false);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, true);
+ }
+
+ private void Animate(string target, LSL_List start, LSL_List stop, bool force)
+ {
+ UUID targetUUID;
+ ScenePresence targetPresence;
+ if ((start.Length > 0 || stop.Length > 0) && UUID.TryParse(target, out targetUUID) && targetUUID != UUID.Zero && World.TryGetScenePresence(targetUUID, out targetPresence))
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID, World);
+ if (
+ force || // if this is true, the other checks will be bypassed
+ (
+ (// if NPC, check for NPC perms
+ isNPC &&
+ npcModule.CheckPermissions(targetUUID, m_host.OwnerID)
+ ) ||
+ ( // if not NPC,
+ // check the perms granter is the avatar
+ // and that we have animation perms
+ !isNPC &&
+ m_item.PermsGranter == targetUUID &&
+ (m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
+ )
+ )
+ )
+ {
+ foreach (object thing in stop.Data)
+ {
+ targetPresence.Animator.RemoveAnimation((LSL_String)thing);
+ }
+ foreach (object thing in start.Data)
+ {
+ targetPresence.Animator.AddAnimation((LSL_String)thing, m_host.UUID);
+ }
+ }
+ else
+ {
+ OSSLShoutError(string.Format("Cannot animate {0}", targetUUID));
+ }
+ }
+ }
+
//Texture draw functions
public string osMovePen(string drawList, int x, int y)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 3985e66..40e2735 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -157,6 +157,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarPlayAnimation(string avatar, string animation);
void osAvatarStopAnimation(string avatar, string animation);
+ /// <summary>
+ /// Starts and Stops the listed animations, requiring PERMISSION_TRIGGER_ANIMATION for agents.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osAnimate(string target, LSL_List start, LSL_List stop);
+
+ /// <summary>
+ /// Starts and Stops the listed animations, bypassing permissions checks.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osForceAnimate(string target, LSL_List start, LSL_List stop);
+
#region Attachment commands
/// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 52ca3da..6e11302 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -289,6 +289,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osAnimate(target, start, stop);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osForceAnimate(target, start, stop);
+ }
+
#region Attachment commands
public void osForceAttachToAvatar(int attachmentPoint)
--
1.7.11.msysgit.1
From fefc1df7e06f770c8c40e5d3b82c92f18be116c0 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 11:19:59 +0100
Subject: [PATCH 2/2] 80 character length terminal tweaks
---
.../Shared/Api/Implementation/OSSL_Api.cs | 44 +++++++++++++---------
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 6 ++-
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index adc85bf..6e9d030 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -988,7 +988,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Animate(target, start, stop, false);
}
- public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ public void osForceAnimate(string target, LSL_List start,
+ LSL_List stop)
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAnimate");
@@ -997,43 +998,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Animate(target, start, stop, true);
}
- private void Animate(string target, LSL_List start, LSL_List stop, bool force)
+ private void Animate(string target, LSL_List start, LSL_List stop,
+ bool force)
{
UUID targetUUID;
ScenePresence targetPresence;
- if ((start.Length > 0 || stop.Length > 0) && UUID.TryParse(target, out targetUUID) && targetUUID != UUID.Zero && World.TryGetScenePresence(targetUUID, out targetPresence))
+ if ((start.Length > 0 || stop.Length > 0) &&
+ UUID.TryParse(target, out targetUUID) &&
+ targetUUID != UUID.Zero &&
+ World.TryGetScenePresence(targetUUID, out targetPresence))
{
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
- bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID, World);
+ bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID,
+ World);
+ // if force is true, the other checks will be bypassed
if (
- force || // if this is true, the other checks will be bypassed
+ force ||
(
- (// if NPC, check for NPC perms
- isNPC &&
- npcModule.CheckPermissions(targetUUID, m_host.OwnerID)
- ) ||
- ( // if not NPC,
- // check the perms granter is the avatar
- // and that we have animation perms
- !isNPC &&
- m_item.PermsGranter == targetUUID &&
- (m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
+ // if NPC, check for NPC perms
+ (isNPC && npcModule.CheckPermissions(targetUUID,
+ m_host.OwnerID)) ||
+ // if not NPC, check the perms granter is the avatar and
+ // that we have animation perms
+ (!isNPC && m_item.PermsGranter == targetUUID &&
+ (m_item.PermsMask &
+ ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
)
)
)
{
foreach (object thing in stop.Data)
{
- targetPresence.Animator.RemoveAnimation((LSL_String)thing);
+ targetPresence.Animator.RemoveAnimation(
+ (LSL_String)thing);
}
foreach (object thing in start.Data)
{
- targetPresence.Animator.AddAnimation((LSL_String)thing, m_host.UUID);
+ targetPresence.Animator.AddAnimation(
+ (LSL_String)thing, m_host.UUID);
}
}
else
{
- OSSLShoutError(string.Format("Cannot animate {0}", targetUUID));
+ OSSLShoutError(string.Format("Cannot animate {0}",
+ targetUUID));
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 40e2735..f387f0c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -158,7 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarStopAnimation(string avatar, string animation);
/// <summary>
- /// Starts and Stops the listed animations, requiring PERMISSION_TRIGGER_ANIMATION for agents.
+ /// Starts and Stops the listed animations, requiring
+ /// PERMISSION_TRIGGER_ANIMATION for agents.
/// </summary>
/// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
@@ -167,7 +168,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAnimate(string target, LSL_List start, LSL_List stop);
/// <summary>
- /// Starts and Stops the listed animations, bypassing permissions checks.
+ /// Starts and Stops the listed animations, bypassing permissions
+ /// checks.
/// </summary>
/// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
--
1.7.11.msysgit.1
From b8c69c158db21d949c9236172b5e8a7195a60751 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Thu, 9 Aug 2012 11:46:13 +0100
Subject: [PATCH 1/7] implementing single function for stopping & starting
animations
---
.../Shared/Api/Implementation/OSSL_Api.cs | 59 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 18 +++++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++
3 files changed, 87 insertions(+)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8b73cd9..adc85bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -979,6 +979,65 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.Moderate, "osAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, false);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, true);
+ }
+
+ private void Animate(string target, LSL_List start, LSL_List stop, bool force)
+ {
+ UUID targetUUID;
+ ScenePresence targetPresence;
+ if ((start.Length > 0 || stop.Length > 0) && UUID.TryParse(target, out targetUUID) && targetUUID != UUID.Zero && World.TryGetScenePresence(targetUUID, out targetPresence))
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID, World);
+ if (
+ force || // if this is true, the other checks will be bypassed
+ (
+ (// if NPC, check for NPC perms
+ isNPC &&
+ npcModule.CheckPermissions(targetUUID, m_host.OwnerID)
+ ) ||
+ ( // if not NPC,
+ // check the perms granter is the avatar
+ // and that we have animation perms
+ !isNPC &&
+ m_item.PermsGranter == targetUUID &&
+ (m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
+ )
+ )
+ )
+ {
+ foreach (object thing in stop.Data)
+ {
+ targetPresence.Animator.RemoveAnimation((LSL_String)thing);
+ }
+ foreach (object thing in start.Data)
+ {
+ targetPresence.Animator.AddAnimation((LSL_String)thing, m_host.UUID);
+ }
+ }
+ else
+ {
+ OSSLShoutError(string.Format("Cannot animate {0}", targetUUID));
+ }
+ }
+ }
+
//Texture draw functions
public string osMovePen(string drawList, int x, int y)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 3985e66..40e2735 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -157,6 +157,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarPlayAnimation(string avatar, string animation);
void osAvatarStopAnimation(string avatar, string animation);
+ /// <summary>
+ /// Starts and Stops the listed animations, requiring PERMISSION_TRIGGER_ANIMATION for agents.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osAnimate(string target, LSL_List start, LSL_List stop);
+
+ /// <summary>
+ /// Starts and Stops the listed animations, bypassing permissions checks.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osForceAnimate(string target, LSL_List start, LSL_List stop);
+
#region Attachment commands
/// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 52ca3da..6e11302 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -289,6 +289,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osAnimate(target, start, stop);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osForceAnimate(target, start, stop);
+ }
+
#region Attachment commands
public void osForceAttachToAvatar(int attachmentPoint)
--
1.7.11.msysgit.1
From fefc1df7e06f770c8c40e5d3b82c92f18be116c0 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 11:19:59 +0100
Subject: [PATCH 2/7] 80 character length terminal tweaks
---
.../Shared/Api/Implementation/OSSL_Api.cs | 44 +++++++++++++---------
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 6 ++-
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index adc85bf..6e9d030 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -988,7 +988,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Animate(target, start, stop, false);
}
- public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ public void osForceAnimate(string target, LSL_List start,
+ LSL_List stop)
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAnimate");
@@ -997,43 +998,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Animate(target, start, stop, true);
}
- private void Animate(string target, LSL_List start, LSL_List stop, bool force)
+ private void Animate(string target, LSL_List start, LSL_List stop,
+ bool force)
{
UUID targetUUID;
ScenePresence targetPresence;
- if ((start.Length > 0 || stop.Length > 0) && UUID.TryParse(target, out targetUUID) && targetUUID != UUID.Zero && World.TryGetScenePresence(targetUUID, out targetPresence))
+ if ((start.Length > 0 || stop.Length > 0) &&
+ UUID.TryParse(target, out targetUUID) &&
+ targetUUID != UUID.Zero &&
+ World.TryGetScenePresence(targetUUID, out targetPresence))
{
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
- bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID, World);
+ bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID,
+ World);
+ // if force is true, the other checks will be bypassed
if (
- force || // if this is true, the other checks will be bypassed
+ force ||
(
- (// if NPC, check for NPC perms
- isNPC &&
- npcModule.CheckPermissions(targetUUID, m_host.OwnerID)
- ) ||
- ( // if not NPC,
- // check the perms granter is the avatar
- // and that we have animation perms
- !isNPC &&
- m_item.PermsGranter == targetUUID &&
- (m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
+ // if NPC, check for NPC perms
+ (isNPC && npcModule.CheckPermissions(targetUUID,
+ m_host.OwnerID)) ||
+ // if not NPC, check the perms granter is the avatar and
+ // that we have animation perms
+ (!isNPC && m_item.PermsGranter == targetUUID &&
+ (m_item.PermsMask &
+ ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
)
)
)
{
foreach (object thing in stop.Data)
{
- targetPresence.Animator.RemoveAnimation((LSL_String)thing);
+ targetPresence.Animator.RemoveAnimation(
+ (LSL_String)thing);
}
foreach (object thing in start.Data)
{
- targetPresence.Animator.AddAnimation((LSL_String)thing, m_host.UUID);
+ targetPresence.Animator.AddAnimation(
+ (LSL_String)thing, m_host.UUID);
}
}
else
{
- OSSLShoutError(string.Format("Cannot animate {0}", targetUUID));
+ OSSLShoutError(string.Format("Cannot animate {0}",
+ targetUUID));
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 40e2735..f387f0c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -158,7 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarStopAnimation(string avatar, string animation);
/// <summary>
- /// Starts and Stops the listed animations, requiring PERMISSION_TRIGGER_ANIMATION for agents.
+ /// Starts and Stops the listed animations, requiring
+ /// PERMISSION_TRIGGER_ANIMATION for agents.
/// </summary>
/// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
@@ -167,7 +168,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAnimate(string target, LSL_List start, LSL_List stop);
/// <summary>
- /// Starts and Stops the listed animations, bypassing permissions checks.
+ /// Starts and Stops the listed animations, bypassing permissions
+ /// checks.
/// </summary>
/// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
--
1.7.11.msysgit.1
From e61cd284f68696567eb5111e53abe6f2924a5b5d Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 13:53:42 +0100
Subject: [PATCH 3/7] stop resending movement animation if it was previously
used in case it was stopped by an AO
---
.../Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index ff53f45..d3c671b 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -55,6 +55,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// The current movement animation
/// </value>
public string CurrentMovementAnimation { get; private set; }
+
+ /// <summary>
+ /// The previous movement animation.
+ /// </summary>
+ private string PreviousMovementAnimation { get; set; }
private int m_animTickFall;
public int m_animTickJump; // ScenePresence has to see this to control +Z force
@@ -78,6 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
m_scenePresence = sp;
CurrentMovementAnimation = "CROUCH";
+ PreviousMovementAnimation = "";
}
public void AddAnimation(UUID animID, UUID objectID)
@@ -414,7 +420,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()",
// CurrentMovementAnimation, m_scenePresence.Name);
+ if(PreviousMovementAnimation != CurrentMovementAnimation)
TrySetMovementAnimation(CurrentMovementAnimation);
+
+ PreviousMovementAnimation = CurrentMovementAnimation;
}
}
--
1.7.11.msysgit.1
From 455099854ab380537b63b2b765170cf525e81e85 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 13:54:28 +0100
Subject: [PATCH 4/7] formatting
---
OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index d3c671b..68368a8 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -421,7 +421,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
// CurrentMovementAnimation, m_scenePresence.Name);
if(PreviousMovementAnimation != CurrentMovementAnimation)
- TrySetMovementAnimation(CurrentMovementAnimation);
+ TrySetMovementAnimation(CurrentMovementAnimation);
PreviousMovementAnimation = CurrentMovementAnimation;
}
--
1.7.11.msysgit.1
From 0c15596b4120a32bd19a27dc08375af9abeb8f56 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 13:59:00 +0100
Subject: [PATCH 5/7] making methods static so OSSL_Api can access them
without instantiating the LSL_Api
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 52d96bc..1525a2d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -295,7 +295,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID InventoryKey(string name, int type)
{
- TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
+ return InventoryKey(m_host, name, type);
+ }
+
+ public static UUID InventoryKey(SceneObjectPart host, string name, int type)
+ {
+ TaskInventoryItem item = host.Inventory.GetInventoryItem(name);
if (item != null && item.Type == type)
return item.AssetID;
@@ -312,6 +317,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
protected UUID KeyOrName(string k)
{
+ return KeyOrName(m_host, k);
+ }
+
+ public static UUID KeyOrName(SceneObjectPart host, string k)
+ {
UUID key;
// if we can parse the string as a key, use it.
@@ -319,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// not found returns UUID.Zero
if (!UUID.TryParse(k, out key))
{
- TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
+ TaskInventoryItem item = host.Inventory.GetInventoryItem(k);
if (item != null)
key = item.AssetID;
--
1.7.11.msysgit.1
From 99d5f5167db042a8b351ea1bed131f12b99a813d Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 14:00:43 +0100
Subject: [PATCH 6/7] formatting
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1525a2d..606075d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -325,8 +325,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID key;
// if we can parse the string as a key, use it.
- // else try to locate the name in inventory of object. found returns key,
- // not found returns UUID.Zero
+ // else try to locate the name in inventory of object.
+ // found returns key, not found returns UUID.Zero.
if (!UUID.TryParse(k, out key))
{
TaskInventoryItem item = host.Inventory.GetInventoryItem(k);
--
1.7.11.msysgit.1
From a5bbe003c42651454320bda530fffd7a7f5f6fb0 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 14:06:12 +0100
Subject: [PATCH 7/7] swap processing order to more intuitively match the
method argument order and use the same argument
processing as llStartAnimation & llStopAnimation
---
.../Shared/Api/Implementation/OSSL_Api.cs | 30 +++++++++++++++++-----
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 --
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6e9d030..4bf09d6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1027,15 +1027,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
)
)
{
- foreach (object thing in stop.Data)
+ foreach (object thing in start.Data)
{
- targetPresence.Animator.RemoveAnimation(
- (LSL_String)thing);
+ UUID animID = LSL_Api.InventoryKey(m_host,
+ (LSL_String)thing, (int)AssetType.Animation);
+ if (animID == UUID.Zero)
+ {
+ targetPresence.Animator.AddAnimation(
+ (LSL_String)thing, m_host.UUID);
+ }
+ else
+ {
+ targetPresence.Animator.AddAnimation(animID,
+ m_host.UUID);
+ }
}
- foreach (object thing in start.Data)
+ foreach (object thing in stop.Data)
{
- targetPresence.Animator.AddAnimation(
- (LSL_String)thing, m_host.UUID);
+ UUID animID = LSL_Api.KeyOrName(m_host, (LSL_String)thing);
+ if (animID == UUID.Zero)
+ {
+ targetPresence.Animator.RemoveAnimation(
+ (LSL_String)thing);
+ }
+ else
+ {
+ targetPresence.Animator.RemoveAnimation(animID);
+ }
}
}
else
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index f387f0c..40ebf23 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -161,7 +161,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// Starts and Stops the listed animations, requiring
/// PERMISSION_TRIGGER_ANIMATION for agents.
/// </summary>
- /// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
/// <param name="start">list of animations to start</param>
/// <param name="stop">list of animations to stop</param>
@@ -171,7 +170,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// Starts and Stops the listed animations, bypassing permissions
/// checks.
/// </summary>
- /// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
/// <param name="start">list of animations to start</param>
/// <param name="stop">list of animations to stop</param>
--
1.7.11.msysgit.1
From b8c69c158db21d949c9236172b5e8a7195a60751 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Thu, 9 Aug 2012 11:46:13 +0100
Subject: [PATCH 1/8] implementing single function for stopping & starting
animations
---
.../Shared/Api/Implementation/OSSL_Api.cs | 59 ++++++++++++++++++++++
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 18 +++++++
.../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++
3 files changed, 87 insertions(+)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 8b73cd9..adc85bf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -979,6 +979,65 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.Moderate, "osAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, false);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAnimate");
+
+ m_host.AddScriptLPS(1);
+
+ Animate(target, start, stop, true);
+ }
+
+ private void Animate(string target, LSL_List start, LSL_List stop, bool force)
+ {
+ UUID targetUUID;
+ ScenePresence targetPresence;
+ if ((start.Length > 0 || stop.Length > 0) && UUID.TryParse(target, out targetUUID) && targetUUID != UUID.Zero && World.TryGetScenePresence(targetUUID, out targetPresence))
+ {
+ INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
+ bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID, World);
+ if (
+ force || // if this is true, the other checks will be bypassed
+ (
+ (// if NPC, check for NPC perms
+ isNPC &&
+ npcModule.CheckPermissions(targetUUID, m_host.OwnerID)
+ ) ||
+ ( // if not NPC,
+ // check the perms granter is the avatar
+ // and that we have animation perms
+ !isNPC &&
+ m_item.PermsGranter == targetUUID &&
+ (m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
+ )
+ )
+ )
+ {
+ foreach (object thing in stop.Data)
+ {
+ targetPresence.Animator.RemoveAnimation((LSL_String)thing);
+ }
+ foreach (object thing in start.Data)
+ {
+ targetPresence.Animator.AddAnimation((LSL_String)thing, m_host.UUID);
+ }
+ }
+ else
+ {
+ OSSLShoutError(string.Format("Cannot animate {0}", targetUUID));
+ }
+ }
+ }
+
//Texture draw functions
public string osMovePen(string drawList, int x, int y)
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 3985e66..40e2735 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -157,6 +157,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarPlayAnimation(string avatar, string animation);
void osAvatarStopAnimation(string avatar, string animation);
+ /// <summary>
+ /// Starts and Stops the listed animations, requiring PERMISSION_TRIGGER_ANIMATION for agents.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osAnimate(string target, LSL_List start, LSL_List stop);
+
+ /// <summary>
+ /// Starts and Stops the listed animations, bypassing permissions checks.
+ /// </summary>
+ /// <remarks>Stop list is processed before Start list</remarks>
+ /// <param name="target">avatar key</param>
+ /// <param name="start">list of animations to start</param>
+ /// <param name="stop">list of animations to stop</param>
+ void osForceAnimate(string target, LSL_List start, LSL_List stop);
+
#region Attachment commands
/// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 52ca3da..6e11302 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -289,6 +289,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osAvatarStopAnimation(avatar, animation);
}
+ public void osAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osAnimate(target, start, stop);
+ }
+
+ public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ {
+ m_OSSL_Functions.osForceAnimate(target, start, stop);
+ }
+
#region Attachment commands
public void osForceAttachToAvatar(int attachmentPoint)
--
1.7.11.msysgit.1
From fefc1df7e06f770c8c40e5d3b82c92f18be116c0 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 11:19:59 +0100
Subject: [PATCH 2/8] 80 character length terminal tweaks
---
.../Shared/Api/Implementation/OSSL_Api.cs | 44 +++++++++++++---------
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 6 ++-
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index adc85bf..6e9d030 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -988,7 +988,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Animate(target, start, stop, false);
}
- public void osForceAnimate(string target, LSL_List start, LSL_List stop)
+ public void osForceAnimate(string target, LSL_List start,
+ LSL_List stop)
{
CheckThreatLevel(ThreatLevel.VeryHigh, "osForceAnimate");
@@ -997,43 +998,50 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Animate(target, start, stop, true);
}
- private void Animate(string target, LSL_List start, LSL_List stop, bool force)
+ private void Animate(string target, LSL_List start, LSL_List stop,
+ bool force)
{
UUID targetUUID;
ScenePresence targetPresence;
- if ((start.Length > 0 || stop.Length > 0) && UUID.TryParse(target, out targetUUID) && targetUUID != UUID.Zero && World.TryGetScenePresence(targetUUID, out targetPresence))
+ if ((start.Length > 0 || stop.Length > 0) &&
+ UUID.TryParse(target, out targetUUID) &&
+ targetUUID != UUID.Zero &&
+ World.TryGetScenePresence(targetUUID, out targetPresence))
{
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
- bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID, World);
+ bool isNPC = npcModule != null && npcModule.IsNPC(targetUUID,
+ World);
+ // if force is true, the other checks will be bypassed
if (
- force || // if this is true, the other checks will be bypassed
+ force ||
(
- (// if NPC, check for NPC perms
- isNPC &&
- npcModule.CheckPermissions(targetUUID, m_host.OwnerID)
- ) ||
- ( // if not NPC,
- // check the perms granter is the avatar
- // and that we have animation perms
- !isNPC &&
- m_item.PermsGranter == targetUUID &&
- (m_item.PermsMask & ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
+ // if NPC, check for NPC perms
+ (isNPC && npcModule.CheckPermissions(targetUUID,
+ m_host.OwnerID)) ||
+ // if not NPC, check the perms granter is the avatar and
+ // that we have animation perms
+ (!isNPC && m_item.PermsGranter == targetUUID &&
+ (m_item.PermsMask &
+ ScriptBaseClass.PERMISSION_TRIGGER_ANIMATION) != 0
)
)
)
{
foreach (object thing in stop.Data)
{
- targetPresence.Animator.RemoveAnimation((LSL_String)thing);
+ targetPresence.Animator.RemoveAnimation(
+ (LSL_String)thing);
}
foreach (object thing in start.Data)
{
- targetPresence.Animator.AddAnimation((LSL_String)thing, m_host.UUID);
+ targetPresence.Animator.AddAnimation(
+ (LSL_String)thing, m_host.UUID);
}
}
else
{
- OSSLShoutError(string.Format("Cannot animate {0}", targetUUID));
+ OSSLShoutError(string.Format("Cannot animate {0}",
+ targetUUID));
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 40e2735..f387f0c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -158,7 +158,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAvatarStopAnimation(string avatar, string animation);
/// <summary>
- /// Starts and Stops the listed animations, requiring PERMISSION_TRIGGER_ANIMATION for agents.
+ /// Starts and Stops the listed animations, requiring
+ /// PERMISSION_TRIGGER_ANIMATION for agents.
/// </summary>
/// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
@@ -167,7 +168,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osAnimate(string target, LSL_List start, LSL_List stop);
/// <summary>
- /// Starts and Stops the listed animations, bypassing permissions checks.
+ /// Starts and Stops the listed animations, bypassing permissions
+ /// checks.
/// </summary>
/// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
--
1.7.11.msysgit.1
From e61cd284f68696567eb5111e53abe6f2924a5b5d Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 13:53:42 +0100
Subject: [PATCH 3/8] stop resending movement animation if it was previously
used in case it was stopped by an AO
---
.../Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index ff53f45..d3c671b 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -55,6 +55,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// The current movement animation
/// </value>
public string CurrentMovementAnimation { get; private set; }
+
+ /// <summary>
+ /// The previous movement animation.
+ /// </summary>
+ private string PreviousMovementAnimation { get; set; }
private int m_animTickFall;
public int m_animTickJump; // ScenePresence has to see this to control +Z force
@@ -78,6 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
m_scenePresence = sp;
CurrentMovementAnimation = "CROUCH";
+ PreviousMovementAnimation = "";
}
public void AddAnimation(UUID animID, UUID objectID)
@@ -414,7 +420,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()",
// CurrentMovementAnimation, m_scenePresence.Name);
+ if(PreviousMovementAnimation != CurrentMovementAnimation)
TrySetMovementAnimation(CurrentMovementAnimation);
+
+ PreviousMovementAnimation = CurrentMovementAnimation;
}
}
--
1.7.11.msysgit.1
From 455099854ab380537b63b2b765170cf525e81e85 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 13:54:28 +0100
Subject: [PATCH 4/8] formatting
---
OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index d3c671b..68368a8 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -421,7 +421,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
// CurrentMovementAnimation, m_scenePresence.Name);
if(PreviousMovementAnimation != CurrentMovementAnimation)
- TrySetMovementAnimation(CurrentMovementAnimation);
+ TrySetMovementAnimation(CurrentMovementAnimation);
PreviousMovementAnimation = CurrentMovementAnimation;
}
--
1.7.11.msysgit.1
From 0c15596b4120a32bd19a27dc08375af9abeb8f56 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 13:59:00 +0100
Subject: [PATCH 5/8] making methods static so OSSL_Api can access them
without instantiating the LSL_Api
---
.../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 52d96bc..1525a2d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -295,7 +295,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected UUID InventoryKey(string name, int type)
{
- TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name);
+ return InventoryKey(m_host, name, type);
+ }
+
+ public static UUID InventoryKey(SceneObjectPart host, string name, int type)
+ {
+ TaskInventoryItem item = host.Inventory.GetInventoryItem(name);
if (item != null && item.Type == type)
return item.AssetID;
@@ -312,6 +317,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <returns></returns>
protected UUID KeyOrName(string k)
{
+ return KeyOrName(m_host, k);
+ }
+
+ public static UUID KeyOrName(SceneObjectPart host, string k)
+ {
UUID key;
// if we can parse the string as a key, use it.
@@ -319,7 +329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// not found returns UUID.Zero
if (!UUID.TryParse(k, out key))
{
- TaskInventoryItem item = m_host.Inventory.GetInventoryItem(k);
+ TaskInventoryItem item = host.Inventory.GetInventoryItem(k);
if (item != null)
key = item.AssetID;
--
1.7.11.msysgit.1
From 99d5f5167db042a8b351ea1bed131f12b99a813d Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 14:00:43 +0100
Subject: [PATCH 6/8] formatting
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 1525a2d..606075d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -325,8 +325,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID key;
// if we can parse the string as a key, use it.
- // else try to locate the name in inventory of object. found returns key,
- // not found returns UUID.Zero
+ // else try to locate the name in inventory of object.
+ // found returns key, not found returns UUID.Zero.
if (!UUID.TryParse(k, out key))
{
TaskInventoryItem item = host.Inventory.GetInventoryItem(k);
--
1.7.11.msysgit.1
From a5bbe003c42651454320bda530fffd7a7f5f6fb0 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 14:06:12 +0100
Subject: [PATCH 7/8] swap processing order to more intuitively match the
method argument order and use the same argument
processing as llStartAnimation & llStopAnimation
---
.../Shared/Api/Implementation/OSSL_Api.cs | 30 +++++++++++++++++-----
.../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 --
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 6e9d030..4bf09d6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1027,15 +1027,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
)
)
{
- foreach (object thing in stop.Data)
+ foreach (object thing in start.Data)
{
- targetPresence.Animator.RemoveAnimation(
- (LSL_String)thing);
+ UUID animID = LSL_Api.InventoryKey(m_host,
+ (LSL_String)thing, (int)AssetType.Animation);
+ if (animID == UUID.Zero)
+ {
+ targetPresence.Animator.AddAnimation(
+ (LSL_String)thing, m_host.UUID);
+ }
+ else
+ {
+ targetPresence.Animator.AddAnimation(animID,
+ m_host.UUID);
+ }
}
- foreach (object thing in start.Data)
+ foreach (object thing in stop.Data)
{
- targetPresence.Animator.AddAnimation(
- (LSL_String)thing, m_host.UUID);
+ UUID animID = LSL_Api.KeyOrName(m_host, (LSL_String)thing);
+ if (animID == UUID.Zero)
+ {
+ targetPresence.Animator.RemoveAnimation(
+ (LSL_String)thing);
+ }
+ else
+ {
+ targetPresence.Animator.RemoveAnimation(animID);
+ }
}
}
else
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index f387f0c..40ebf23 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -161,7 +161,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// Starts and Stops the listed animations, requiring
/// PERMISSION_TRIGGER_ANIMATION for agents.
/// </summary>
- /// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
/// <param name="start">list of animations to start</param>
/// <param name="stop">list of animations to stop</param>
@@ -171,7 +170,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
/// Starts and Stops the listed animations, bypassing permissions
/// checks.
/// </summary>
- /// <remarks>Stop list is processed before Start list</remarks>
/// <param name="target">avatar key</param>
/// <param name="start">list of animations to start</param>
/// <param name="stop">list of animations to stop</param>
--
1.7.11.msysgit.1
From d53920a42a9d1015d5a5e5300045bdaa7bbebc13 Mon Sep 17 00:00:00 2001
From: SignpostMarv <github@signpostmarv.name>
Date: Mon, 1 Oct 2012 16:13:20 +0100
Subject: [PATCH 8/8] An additional SendAnimPack seems to give default
animation supression a kick in the butt. Experiments
with not calling SendAnimPack in AddAnimation and
RemoveAnimation had opposite effect.
---
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 4bf09d6..3f4ffbf 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1055,6 +1055,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
targetPresence.Animator.RemoveAnimation(animID);
}
}
+
+ targetPresence.Animator.SendAnimPack();
}
else
{
--
1.7.11.msysgit.1
| ||||||||
Notes |
|
|
(0022759) SignpostMarv (reporter) 2012-10-01 10:20 |
Rebased and tweaked for 80 character length terminals. |
|
(0022760) SignpostMarv (reporter) 2012-10-01 13:12 |
Fixed some bugs that stopped osAnimate from working as expected. Included is a change (patch 3/7) that appears to put opensim more in line with Second Life with regards to movement animations. |
|
(0022761) SignpostMarv (reporter) 2012-10-01 15:19 edited on: 2012-10-01 15:34 |
It seems that an additional SendAnimPack is needed. An experiment in optionally *not* calling SendAnimPack in the Add/Remove animation methods and using just the extra SendAnimPack call as a manual call resulted in the opposite effect of no animations playing whatsoever. Without this extra call, built-in animations take several seconds to be turned off. |
|
(0022762) melanie (administrator) 2012-10-01 17:33 |
Parts of this patch are harmful. The PreviousMovementAnimation logic is deeply flawed since AOs do NOT have the abinility to set the movement animation - only client actions (AgentUpdate) can do this. |
|
(0022763) melanie (administrator) 2012-10-01 17:55 |
-1 but the fixes to sending the movement animation in the anim pack as SL does are welcome in another form. The OSSL functions are unneeded because they duplicate existing functionality. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-08-09 10:49 | SignpostMarv | New Issue | |
| 2012-08-09 10:49 | SignpostMarv | File Added: osAnimate.patch | |
| 2012-08-09 10:49 | SignpostMarv | Status | new => patch included |
| 2012-08-18 11:32 | DMX04 | Issue cloned: 0006225 | |
| 2012-10-01 10:20 | SignpostMarv | File Added: osAnimate-rebased.patch | |
| 2012-10-01 10:20 | SignpostMarv | Note Added: 0022759 | |
| 2012-10-01 13:10 | SignpostMarv | File Added: osAnimate-bug-fixes.patch | |
| 2012-10-01 13:11 | SignpostMarv | File Deleted: osAnimate-bug-fixes.patch | |
| 2012-10-01 13:11 | SignpostMarv | File Added: osAnimate-bug-fixes.patch | |
| 2012-10-01 13:12 | SignpostMarv | Note Added: 0022760 | |
| 2012-10-01 15:19 | SignpostMarv | Note Added: 0022761 | |
| 2012-10-01 15:31 | SignpostMarv | File Added: osAniamte-bugfixes-2.patch | |
| 2012-10-01 15:34 | SignpostMarv | Note Edited: 0022761 | View Revisions |
| 2012-10-01 17:33 | melanie | Note Added: 0022762 | |
| 2012-10-01 17:55 | melanie | Note Added: 0022763 | |
| 2012-10-01 17:55 | melanie | Status | patch included => closed |
| 2012-10-01 17:55 | melanie | Assigned To | => melanie |
| 2012-10-01 17:55 | melanie | Resolution | open => won't fix |
| Copyright © 2000 - 2012 MantisBT Group |




