diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 9fedf12016..1526ffaf35 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -652,7 +652,7 @@ bool LLSelectMgr::enableLinkObjects() { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); + RlvSelectIsSittingOn f(gAgentAvatarp); if (hSel->getFirstRootNode(&f, TRUE) != NULL) new_value = false; } @@ -672,7 +672,7 @@ bool LLSelectMgr::enableUnlinkObjects() { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); + RlvSelectIsSittingOn f(gAgentAvatarp); if (hSel->getFirstRootNode(&f, TRUE) != NULL) new_value = false; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index a722cec535..75f7295da9 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4259,7 +4259,7 @@ void handle_take_copy() { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); + RlvSelectIsSittingOn f(gAgentAvatarp); if ( (hSel.notNull()) && (hSel->getFirstRootNode(&f, TRUE) != NULL) ) return; } @@ -4275,7 +4275,7 @@ class LLObjectReturn : public view_listener_t bool handleEvent(const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; -// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b +// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.4.0a) | Modified: RLVa-1.0.0b if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) return true; // [/RLVa:KB] @@ -4315,6 +4315,12 @@ class LLObjectEnableReturn : public view_listener_t // Do not enable if nothing selected return false; } +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a + if ( (rlv_handler_t::isEnabled()) && (!rlvCanDeleteOrReturn()) ) + { + return false; + } +// [/RLVa:KB] #ifdef HACKED_GODLIKE_VIEWER bool new_value = true; #else @@ -4350,9 +4356,6 @@ class LLObjectEnableReturn : public view_listener_t } } #endif -// [RLVa:KB] - Checked: 2010-03-24 (RLVa-1.2.0e) | Modified: RLVa-1.0.0b - new_value &= (!rlv_handler_t::isEnabled()) || (rlvCanDeleteOrReturn()); -// [/RLVa:KB] return new_value; } }; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 2c3094d9b0..dd2b09e048 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -521,6 +521,15 @@ bool LLViewerObject::isReturnable() { return false; } +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + // Block if: @rez=n restricted and owned by us or a group *or* @unsit=n restricted and being sat on by us + if ( (rlv_handler_t::isEnabled()) && + ( ((gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) && ((permYouOwner() || permGroupOwner()))) || + ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (isAgentAvatarValid()) && (getRootEdit()->isChild(gAgentAvatarp))) ) ) + { + return false; + } +// [/RLVa:KB] std::vector boxes; boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned()); for (child_list_t::iterator iter = mChildList.begin(); @@ -634,7 +643,10 @@ void LLViewerObject::addThisAndNonJointChildren(std::vector& ob } } -BOOL LLViewerObject::isChild(LLViewerObject *childp) const +//BOOL LLViewerObject::isChild(LLViewerObject *childp) const +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a +BOOL LLViewerObject::isChild(const LLViewerObject *childp) const +// [/RLVa:KB] { for (child_list_t::const_iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 9aa8e32569..edc866e471 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -247,7 +247,10 @@ public: S32 numChildren() const { return mChildList.size(); } void addThisAndAllChildren(std::vector& objects); void addThisAndNonJointChildren(std::vector& objects); - BOOL isChild(LLViewerObject *childp) const; +// BOOL isChild(LLViewerObject *childp) const; +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a + BOOL isChild(const LLViewerObject *childp) const; +// [/RLVa:KB] BOOL isSeat() const; diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index ae2f4e512f..31e88266b1 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -465,30 +465,19 @@ bool rlvMenuEnableIfNot(const LLSD& sdParam) // Selection functors // -// Checked: 2010-04-11 (RLVa-1.2.0b) | Modified: RLVa-0.2.0g +// Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a bool rlvCanDeleteOrReturn() { - bool fIsAllowed = true; - - if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) ) { - // We'll allow if none of the prims are owned by the avie or group owned - LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsOwnedByOrGroupOwned f(gAgent.getID()); - if ( (handleSel.notNull()) && ((0 == handleSel->getRootObjectCount()) || (NULL != handleSel->getFirstRootNode(&f, FALSE))) ) - fIsAllowed = false; + struct RlvCanDeleteOrReturn : public LLSelectedObjectFunctor + { + /*virtual*/ bool apply(LLViewerObject* pObj) { return pObj->isReturnable(); } + } f; + LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); + return (hSel.notNull()) && (0 != hSel->getRootObjectCount()) && (hSel->applyToRootObjects(&f, false)); } - - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (isAgentAvatarValid()) ) - { - // We'll allow if the avie isn't sitting on any of the selected objects - LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection(); - RlvSelectIsSittingOn f(gAgentAvatarp->getRoot()); - if ( (handleSel.notNull()) && (handleSel->getFirstRootNode(&f, TRUE)) ) - fIsAllowed = false; - } - - return fIsAllowed; + return true; } // Checked: 2010-04-20 (RLVa-1.2.0f) | Modified: RLVa-0.2.0f @@ -504,16 +493,10 @@ bool RlvSelectIsEditable::apply(LLSelectNode* pNode) return (pObj) && (!gRlvHandler.canEdit(pObj)); } -// Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-0.2.0f -bool RlvSelectIsOwnedByOrGroupOwned::apply(LLSelectNode* pNode) -{ - return (pNode->mPermissions->isGroupOwned()) || (pNode->mPermissions->getOwner() == m_idAgent); -} - -// Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-0.2.0f +// Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a bool RlvSelectIsSittingOn::apply(LLSelectNode* pNode) { - return (pNode->getObject()) && (pNode->getObject()->getRootEdit() == m_pObject); + return (pNode->getObject()) && (pNode->getObject()->getRootEdit()->isChild(m_pAvatar)); } // ============================================================================ diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index 1b762971c4..f4f9028341 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -212,20 +212,12 @@ struct RlvSelectIsEditable : public LLSelectedNodeFunctor /*virtual*/ bool apply(LLSelectNode* pNode); }; -struct RlvSelectIsOwnedByOrGroupOwned : public LLSelectedNodeFunctor -{ - RlvSelectIsOwnedByOrGroupOwned(const LLUUID& uuid) : m_idAgent(uuid) {} - virtual bool apply(LLSelectNode* pNode); -protected: - LLUUID m_idAgent; -}; - struct RlvSelectIsSittingOn : public LLSelectedNodeFunctor { - RlvSelectIsSittingOn(LLXform* pObject) : m_pObject(pObject) {} - virtual bool apply(LLSelectNode* pNode); + RlvSelectIsSittingOn(const LLVOAvatar* pAvatar) : m_pAvatar(pAvatar) {} + /*virtual*/ bool apply(LLSelectNode* pNode); protected: - LLXform* m_pObject; + const LLVOAvatar* m_pAvatar; }; // ============================================================================