summaryrefslogtreecommitdiff
path: root/indra/newview/llagent.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-10-03 18:04:27 -0400
committerOz Linden <oz@lindenlab.com>2013-10-03 18:04:27 -0400
commit4dccf30bf318649c7b371355fd34cde6c143e867 (patch)
tree4acbdefe0bb187a817583e835112f4317e11d596 /indra/newview/llagent.cpp
parentbd18f3c097304504c398df02613229a64f7eac81 (diff)
parentf7158bc5afcec1da8b9d2d5a4ed86921e62d4959 (diff)
merge changes for 3.6.7-release
Diffstat (limited to 'indra/newview/llagent.cpp')
-rwxr-xr-xindra/newview/llagent.cpp71
1 files changed, 70 insertions, 1 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index f4ce3c9118..49f77e6c34 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -91,6 +91,7 @@
#include "llwindow.h"
#include "llworld.h"
#include "llworldmap.h"
+#include "lscript_byteformat.h"
#include "stringize.h"
#include "boost/foreach.hpp"
@@ -3059,6 +3060,55 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request)
sendReliableMessage();
}
+// Send a message to the region to stop the NULL animation state
+// This will reset animation state overrides for the agent.
+void LLAgent::sendAnimationStateReset()
+{
+ if (gAgentID.isNull() || !mRegionp)
+ {
+ return;
+ }
+
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_AgentAnimation);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, getID());
+ msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
+
+ msg->nextBlockFast(_PREHASH_AnimationList);
+ msg->addUUIDFast(_PREHASH_AnimID, LLUUID::null );
+ msg->addBOOLFast(_PREHASH_StartAnim, FALSE);
+
+ msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList);
+ msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0);
+ 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)
{
LLMessageSystem* msgsys = gMessageSystem;
@@ -4137,6 +4187,8 @@ void LLAgent::stopCurrentAnimations()
// avatar, propagating this change back to the server.
if (isAgentAvatarValid())
{
+ LLDynamicArray<LLUUID> anim_ids;
+
for ( LLVOAvatar::AnimIterator anim_it =
gAgentAvatarp->mPlayingAnimations.begin();
anim_it != gAgentAvatarp->mPlayingAnimations.end();
@@ -4154,7 +4206,24 @@ void LLAgent::stopCurrentAnimations()
// stop this animation locally
gAgentAvatarp->stopMotion(anim_it->first, TRUE);
// ...and tell the server to tell everyone.
- sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP);
+ anim_ids.push_back(anim_it->first);
+ }
+ }
+
+ sendAnimationRequests(anim_ids, ANIM_REQUEST_STOP);
+
+ // Tell the region to clear any animation state overrides
+ 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();
}
}