From 826d6fc591dace753b053d9b3c28a0e710037964 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 3 Apr 2020 18:06:00 +0300 Subject: SL-12968 Wrong avatar was paused on selection --- indra/newview/llselectmgr.cpp | 47 ++++++++++--------------------------------- 1 file changed, 11 insertions(+), 36 deletions(-) (limited to 'indra') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 9d491e0e00..ae55cbf025 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6882,51 +6882,26 @@ void LLSelectMgr::pauseAssociatedAvatars() mSelectedObjects->mSelectType = getSelectTypeForObject(object); - bool is_attached = false; - if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && - isAgentAvatarValid()) + LLVOAvatar* parent_av = NULL; + if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT) { // Selection can be obsolete, confirm that this is an attachment - LLViewerObject* parent = (LLViewerObject*)object->getParent(); - while (parent != NULL) - { - if (parent->isAvatar()) - { - is_attached = true; - break; - } - else - { - parent = (LLViewerObject*)parent->getParent(); - } - } + // and find parent avatar + parent_av = object->getAvatarAncestor(); } - - if (is_attached) + // Can be both an attachment and animated object + if (parent_av) { - if (object->isAnimatedObject()) - { - // Is an animated object attachment. - // Pause both the control avatar and the avatar it's attached to. - if (object->getControlAvatar()) - { - mPauseRequests.push_back(object->getControlAvatar()->requestPause()); - } - mPauseRequests.push_back(gAgentAvatarp->requestPause()); - } - else - { - // Is a regular attachment. Pause the avatar it's attached to. - mPauseRequests.push_back(gAgentAvatarp->requestPause()); - } + // It's an attachment. Pause the avatar it's attached to. + mPauseRequests.push_back(parent_av->requestPause()); } - else if (object && object->isAnimatedObject() && object->getControlAvatar()) + + if (object->isAnimatedObject() && object->getControlAvatar()) { - // Is a non-attached animated object. Pause the control avatar. + // It's an animated object. Pause the control avatar. mPauseRequests.push_back(object->getControlAvatar()->requestPause()); } - } } -- cgit v1.2.3