From 972749c04c98685ee9645afb294a478db0858998 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 26 Apr 2009 19:57:52 -0700 Subject: Backported fix from 1.23 for stop animations only being local (VWR-2850) --- linden/indra/newview/llagent.cpp | 51 +++++++++++++++++----- linden/indra/newview/llagent.h | 1 + linden/indra/newview/llviewermenu.cpp | 7 +-- .../skins/default/xui/en-us/menu_viewer.xml | 4 +- 4 files changed, 45 insertions(+), 18 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp index d268397..21de6a3 100644 --- a/linden/indra/newview/llagent.cpp +++ b/linden/indra/newview/llagent.cpp @@ -5750,18 +5750,13 @@ bool LLAgent::teleportCore(bool is_local) return false; } - // Stop all animation before actual teleporting + // Cease sitting on the current object, if any. LLVOAvatar* avatarp = gAgent.getAvatarObject(); if (avatarp) - { - for ( LLVOAvatar::AnimIterator anim_it= avatarp->mPlayingAnimations.begin() - ; anim_it != avatarp->mPlayingAnimations.end() - ; anim_it++) - { - avatarp->stopMotion(anim_it->first); - } - avatarp->processAnimationStateChanges(); - } + avatarp->getOffObject(); + + // Stop all animations before actual teleporting + stopCurrentAnimations(); // Don't call LLFirstUse::useTeleport because we don't know // yet if the teleport will succeed. Look in @@ -5940,6 +5935,42 @@ void LLAgent::setTeleportState(ETeleportState state) } } +void LLAgent::stopCurrentAnimations() +{ + // This function stops all current overriding animations on this + // avatar, propagating this change back to the server. + + LLVOAvatar* avatarp = gAgent.getAvatarObject(); + if (avatarp) + { + for ( LLVOAvatar::AnimIterator anim_it = + avatarp->mPlayingAnimations.begin(); + anim_it != avatarp->mPlayingAnimations.end(); + anim_it++) + { + if (anim_it->first == + ANIM_AGENT_SIT_GROUND_CONSTRAINED) + { + // don't cancel a ground-sit anim, as viewers + // use this animation's status in + // determining whether we're sitting. ick. + } + else + { + // stop this animation locally + avatarp->stopMotion(anim_it->first, TRUE); + // ...and tell the server to tell everyone. + sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP); + } + } + + // re-assert at least the default standing animation, because + // viewers get confused by avs with no associated anims. + sendAnimationRequest(ANIM_AGENT_STAND, + ANIM_REQUEST_START); + } +} + void LLAgent::fidget() { if (!getAFK()) diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h index 97f9aed..1c836b1 100644 --- a/linden/indra/newview/llagent.h +++ b/linden/indra/newview/llagent.h @@ -372,6 +372,7 @@ public: BOOL canFly(); // Animation functions + void stopCurrentAnimations(); void requestStopMotion( LLMotion* motion ); void onAnimStop(const LLUUID& id); diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp index 486e4f1..9e0b6a0 100644 --- a/linden/indra/newview/llviewermenu.cpp +++ b/linden/indra/newview/llviewermenu.cpp @@ -4227,12 +4227,7 @@ class LLToolsStopAllAnimations : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) - { - avatarp->deactivateAllMotions(); - avatarp->startDefaultMotions(); - } + gAgent.stopCurrentAnimations(); return true; } }; diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 4758116..7ef3419 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -509,8 +509,8 @@ - + -- cgit v1.1