- internal : reviewed and rewrote rlvCanDeleteOrReturn() and reviewed LLObjectEnableReturn and LLObjectReturn
-> added checks to LLViewerObject::isReturnable() and rewrote rlvCanDeleteOrReturn() to use it
-> fixed RlvSelectIsSittingOn which was using an incorrect way of checking for a specific seated avatar
--HG--
branch : RLVa
meow-7.2.2
parent
21c7ecfcdd
commit
5fb4146473
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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<LLBBox> 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<LLViewerObject*>& 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++)
|
||||
|
|
|
|||
|
|
@ -247,7 +247,10 @@ public:
|
|||
S32 numChildren() const { return mChildList.size(); }
|
||||
void addThisAndAllChildren(std::vector<LLViewerObject*>& objects);
|
||||
void addThisAndNonJointChildren(std::vector<LLViewerObject*>& 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;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
|
|
|||
Loading…
Reference in New Issue