diff options
author | Kelly Washington <kelly@lindenlab.com> | 2013-02-25 14:06:38 -0800 |
---|---|---|
committer | Kelly Washington <kelly@lindenlab.com> | 2013-02-25 14:06:38 -0800 |
commit | e82667e3e879d33a2cc94a24cb258a5837c04357 (patch) | |
tree | 959ea6800a2ef33b2aa18ab79ff13632031b3066 /indra | |
parent | eb41cf7f767baeb9ceceaad1c6474be3555d926b (diff) |
MAINT-2407 'Stop animating me' spams server
reviewed with Simon
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llagent.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llagent.h | 2 |
2 files changed, 34 insertions, 1 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index b6fd7bc9c2..f0eee24fef 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3062,6 +3062,30 @@ 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(); +} + void LLAgent::sendWalkRun(bool running) { LLMessageSystem* msgsys = gMessageSystem; @@ -4140,6 +4164,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(); @@ -4157,10 +4183,15 @@ 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(); + // re-assert at least the default standing animation, because // viewers get confused by avs with no associated anims. sendAnimationRequest(ANIM_AGENT_STAND, diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 99904e118c..bec9352f5f 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -431,6 +431,8 @@ public: void onAnimStop(const LLUUID& id); void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request); void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); + void sendAnimationStateReset(); + void endAnimationUpdateUI(); void unpauseAnimation() { mPauseRequest = NULL; } BOOL getCustomAnim() const { return mCustomAnim; } |