From ee9f7ec670c4c94f871f7abed68a573b844a69a6 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 3 Sep 2024 00:55:55 +0200 Subject: #2403 Reset Skeleton issues --- indra/newview/llviewermenu.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e1664752e7..a32e5d23e3 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6748,17 +6748,11 @@ class LLAvatarToggleSearch : public view_listener_t } }; -class LLAvatarResetSkeleton: public view_listener_t +class LLAvatarResetSkeleton : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLVOAvatar* avatar = NULL; - LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (obj) - { - avatar = obj->getAvatar(); - } - if(avatar) + if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { avatar->resetSkeleton(false); } @@ -6766,12 +6760,11 @@ class LLAvatarResetSkeleton: public view_listener_t } }; -class LLAvatarEnableResetSkeleton: public view_listener_t +class LLAvatarEnableResetSkeleton : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); - if (obj && obj->getAvatar()) + if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { return true; } @@ -6779,13 +6772,11 @@ class LLAvatarEnableResetSkeleton: public view_listener_t } }; - class LLAvatarResetSkeletonAndAnimations : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); - if (avatar) + if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { avatar->resetSkeleton(true); } @@ -6793,12 +6784,27 @@ class LLAvatarResetSkeletonAndAnimations : public view_listener_t } }; +class LLAvatarResetSelfSkeleton : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) + { + avatar->resetSkeleton(false); + } + else + { + gAgentAvatarp->resetSkeleton(false); + } + return true; + } +}; + class LLAvatarResetSelfSkeletonAndAnimations : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject()); - if (avatar) + if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { avatar->resetSkeleton(true); } @@ -6810,7 +6816,6 @@ class LLAvatarResetSelfSkeletonAndAnimations : public view_listener_t } }; - class LLAvatarAddContact : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -10106,6 +10111,7 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarResetSkeleton(), "Avatar.ResetSkeleton"); view_listener_t::addMenu(new LLAvatarEnableResetSkeleton(), "Avatar.EnableResetSkeleton"); view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations"); + view_listener_t::addMenu(new LLAvatarResetSelfSkeleton(), "Avatar.ResetSelfSkeleton"); view_listener_t::addMenu(new LLAvatarResetSelfSkeletonAndAnimations(), "Avatar.ResetSelfSkeletonAndAnimations"); enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible)); enable.add("Avatar.IsPicksTabOpen", boost::bind(&picks_tab_visible)); -- cgit v1.2.3