diff options
Diffstat (limited to 'linden/indra/newview/llfloatertools.cpp')
-rw-r--r-- | linden/indra/newview/llfloatertools.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index d2a8040..4aca133 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp | |||
@@ -667,6 +667,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) | |||
667 | if (mBtnLink) mBtnLink->setVisible( edit_visible ); | 667 | if (mBtnLink) mBtnLink->setVisible( edit_visible ); |
668 | if (mBtnUnlink) mBtnUnlink->setVisible( edit_visible ); | 668 | if (mBtnUnlink) mBtnUnlink->setVisible( edit_visible ); |
669 | 669 | ||
670 | //TODO: Move these into llselectmgr | ||
670 | // Check to see if we can link things | 671 | // Check to see if we can link things |
671 | bool can_link = false; | 672 | bool can_link = false; |
672 | if (!gSavedSettings.getBOOL("EditLinkedParts")) | 673 | if (!gSavedSettings.getBOOL("EditLinkedParts")) |
@@ -689,15 +690,44 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) | |||
689 | 690 | ||
690 | // Check to see if we can unlink things | 691 | // Check to see if we can unlink things |
691 | bool can_unlink = false; | 692 | bool can_unlink = false; |
692 | if (LLSelectMgr::getInstance()->selectGetAllRootsValid() && | 693 | if (tool != LLToolFace::getInstance()) |
693 | LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && | ||
694 | !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment()) | ||
695 | { | 694 | { |
696 | if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() > 0 && | 695 | if (LLSelectMgr::getInstance()->selectGetAllRootsValid() && |
697 | LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != | 696 | LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && |
698 | LLSelectMgr::getInstance()->getSelection()->getObjectCount()) | 697 | !LLSelectMgr::getInstance()->getSelection()->isAttachment()) |
699 | { | 698 | { |
700 | can_unlink = true; | 699 | // LL's viewer unlinks the last linkset selected, |
700 | // regardless of how many linksets or prims are selected total. | ||
701 | // Preserve that behavior when enabling the unlink option. | ||
702 | if (gSavedSettings.getBOOL("EditLinkedParts")) | ||
703 | { | ||
704 | struct f : public LLSelectedNodeFunctor | ||
705 | { | ||
706 | virtual bool apply(LLSelectNode* pNode) | ||
707 | { | ||
708 | // Return the first selection node that is | ||
709 | // 1) not a root prim | ||
710 | // 2) or a root prim that has child prims | ||
711 | // or in other words: any prim that is part of a linkset | ||
712 | return (pNode->getObject() != pNode->getObject()->getRootEdit()) || | ||
713 | (pNode->getObject()->numChildren() != 0); | ||
714 | } | ||
715 | } func; | ||
716 | |||
717 | if (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(&func, TRUE)) | ||
718 | { | ||
719 | // the selection contains at least one prim (child or root) that is part of a linkset | ||
720 | can_unlink = true; | ||
721 | } | ||
722 | } | ||
723 | else | ||
724 | { | ||
725 | if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != | ||
726 | LLSelectMgr::getInstance()->getSelection()->getObjectCount()) | ||
727 | { | ||
728 | can_unlink = true; | ||
729 | } | ||
730 | } | ||
701 | } | 731 | } |
702 | } | 732 | } |
703 | mBtnUnlink->setEnabled(can_unlink); | 733 | mBtnUnlink->setEnabled(can_unlink); |