Skip to content
Snippets Groups Projects
Commit 37048620 authored by simon's avatar simon
Browse files

MAINT-2879 : Viewer should revoke animation permissions with "Stop Animating Me"

Reviewed by Kelly
parent c6a15ab0
No related branches found
No related tags found
No related merge requests found
...@@ -9697,7 +9697,18 @@ ...@@ -9697,7 +9697,18 @@
<key>Value</key> <key>Value</key>
<integer>1</integer> <integer>1</integer>
</map> </map>
<key>RotateRight</key> <key>RevokePermsOnStopAnimation</key>
<map>
<key>Comment</key>
<string>Clear animation permssions when choosing "Stop Animating Me"</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>RotateRight</key>
<map> <map>
<key>Comment</key> <key>Comment</key>
<string>Make the agent rotate to its right.</string> <string>Make the agent rotate to its right.</string>
......
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
#include "llwindow.h" #include "llwindow.h"
#include "llworld.h" #include "llworld.h"
#include "llworldmap.h" #include "llworldmap.h"
#include "lscript_byteformat.h"
#include "stringize.h" #include "stringize.h"
using namespace LLAvatarAppearanceDefines; using namespace LLAvatarAppearanceDefines;
...@@ -3072,6 +3073,31 @@ void LLAgent::sendAnimationStateReset() ...@@ -3072,6 +3073,31 @@ void LLAgent::sendAnimationStateReset()
sendReliableMessage(); sendReliableMessage();
} }
// Send a message to the region to revoke sepecified permissions on ALL scripts in the region
// If the target is an object in the region, permissions in scripts on that object are cleared.
// If it is the region ID, all scripts clear the permissions for this agent
void LLAgent::sendRevokePermissions(const LLUUID & target, U32 permissions)
{
// Currently only the bits for SCRIPT_PERMISSION_TRIGGER_ANIMATION and SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS
// are supported by the server. Sending any other bits will cause the message to be dropped without changing permissions
if (gAgentID.notNull() && gMessageSystem)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RevokePermissions);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, getID()); // Must be our ID
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
msg->nextBlockFast(_PREHASH_Data);
msg->addUUIDFast(_PREHASH_ObjectID, target); // Must be in the region
msg->addS32Fast(_PREHASH_ObjectPermissions, (S32) permissions);
sendReliableMessage();
}
}
void LLAgent::sendWalkRun(bool running) void LLAgent::sendWalkRun(bool running)
{ {
LLMessageSystem* msgsys = gMessageSystem; LLMessageSystem* msgsys = gMessageSystem;
...@@ -4175,9 +4201,21 @@ void LLAgent::stopCurrentAnimations() ...@@ -4175,9 +4201,21 @@ void LLAgent::stopCurrentAnimations()
sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP); sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP);
// Tell the region to clear any animation state overrides. // Tell the region to clear any animation state overrides
sendAnimationStateReset(); sendAnimationStateReset();
// Revoke all animation permissions
if (mRegionp &&
gSavedSettings.getBOOL("RevokePermsOnStopAnimation"))
{
U32 permissions = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRIGGER_ANIMATION] | LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS];
sendRevokePermissions(mRegionp->getRegionID(), permissions);
if (gAgentAvatarp->isSitting())
{ // Also stand up, since auto-granted sit animation permission has been revoked
gAgent.standUp();
}
}
// re-assert at least the default standing animation, because // re-assert at least the default standing animation, because
// viewers get confused by avs with no associated anims. // viewers get confused by avs with no associated anims.
sendAnimationRequest(ANIM_AGENT_STAND, sendAnimationRequest(ANIM_AGENT_STAND,
......
...@@ -432,6 +432,7 @@ class LLAgent : public LLOldEvents::LLObservable ...@@ -432,6 +432,7 @@ class LLAgent : public LLOldEvents::LLObservable
void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request); void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request);
void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request);
void sendAnimationStateReset(); void sendAnimationStateReset();
void sendRevokePermissions(const LLUUID & target, U32 permissions);
void endAnimationUpdateUI(); void endAnimationUpdateUI();
void unpauseAnimation() { mPauseRequest = NULL; } void unpauseAnimation() { mPauseRequest = NULL; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment