- internal : added preliminary support for @edit:<uuid>=n|y and @editobj:<uuid>=n|y

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2010-11-29 21:59:31 +01:00
parent 625966fa60
commit 879e4babe9
4 changed files with 59 additions and 17 deletions

View File

@ -525,6 +525,13 @@ bool RlvSelectHasLockedAttach::apply(LLSelectNode* pNode)
return (pNode->getObject()) ? gRlvAttachmentLocks.isLockedAttachment(pNode->getObject()->getRootEdit()) : false;
}
// Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
bool RlvSelectIsEditable::apply(LLSelectNode* pNode)
{
const LLViewerObject* pObj = pNode->getObject();
return (pObj) && (!gRlvHandler.canEdit(pObj));
}
// Checked: 2009-07-05 (RLVa-1.0.0b) | Modified: RLVa-0.2.0f
bool RlvSelectIsOwnedByOrGroupOwned::apply(LLSelectNode* pNode)
{

View File

@ -184,6 +184,13 @@ struct RlvSelectHasLockedAttach : public LLSelectedNodeFunctor
virtual bool apply(LLSelectNode* pNode);
};
// Filters out selected objects that can't be editable (i.e. getFirstNode() will return NULL if the selection is fully editable)
struct RlvSelectIsEditable : public LLSelectedNodeFunctor
{
RlvSelectIsEditable() {}
/*virtual*/ bool apply(LLSelectNode* pNode);
};
struct RlvSelectIsOwnedByOrGroupOwned : public LLSelectedNodeFunctor
{
RlvSelectIsOwnedByOrGroupOwned(const LLUUID& uuid) : m_idAgent(uuid) {}

View File

@ -1053,20 +1053,6 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
pObj->mText->setString( (RLV_TYPE_ADD == eType) ? "" : pObj->mText->getObjectText());
}
break;
#ifdef RLV_EXTENSION_CMD_TOUCHXXX
case RLV_BHVR_TOUCH: // @touch:<uuid>=n - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l
{
// There should be an option and it should specify a valid UUID
LLUUID idException(strOption);
VERIFY_OPTION_REF(idException.notNull());
if (RLV_TYPE_ADD == eType)
addException(rlvCmd.getObjectID(), eBhvr, idException);
else
removeException(rlvCmd.getObjectID(), eBhvr, idException);
}
break;
#endif // RLV_EXTENSION_CMD_TOUCHXXX
// The following block is only valid if there's no option
case RLV_BHVR_SHOWLOC: // @showloc=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
case RLV_BHVR_SHOWNAMES: // @shownames=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
@ -1092,7 +1078,6 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
#ifdef RLV_EXTENSION_CMD_ALLOWIDLE
case RLV_BHVR_ALLOWIDLE: // @allowidle=n|y - Checked: 2010-05-03 (RLVa-1.2.0g) | Modified: RLVa-1.1.0h
#endif // RLV_EXTENSION_CMD_ALLOWIDLE
case RLV_BHVR_EDIT: // @edit=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
case RLV_BHVR_REZ: // @rez=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
case RLV_BHVR_FARTOUCH: // @fartouch=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
#ifdef RLV_EXTENSION_CMD_INTERACT
@ -1117,6 +1102,7 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
case RLV_BHVR_TOUCHATTACH: // @touchattach[:<uuid>=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l
case RLV_BHVR_TOUCHHUD: // @touchhud[:<uuid>=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l
#endif // RLV_EXTENSION_CMD_TOUCHXXX
case RLV_BHVR_EDIT: // @edit[:<uuid>]=n|y - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
{
LLUUID idException(strOption);
if (idException.notNull()) // If there's an option then it should specify a valid UUID
@ -1130,6 +1116,27 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
VERIFY_OPTION_REF(strOption.empty());
}
break;
//
// The following block is only valid if there an option that specifies a valid UUID (reference-counted per option)
//
case RLV_BHVR_EDITOBJ: // @editobj:<uuid>=n|y - Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
#ifdef RLV_EXTENSION_CMD_TOUCHXXX
case RLV_BHVR_TOUCH: // @touch:<uuid>=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l
#endif // RLV_EXTENSION_CMD_TOUCHXXX
{
// There should be an option and it should specify a valid UUID
LLUUID idException(strOption);
VERIFY_OPTION_REF(idException.notNull());
if (RLV_TYPE_ADD == eType)
addException(rlvCmd.getObjectID(), eBhvr, idException);
else
removeException(rlvCmd.getObjectID(), eBhvr, idException);
}
break;
//
// Unknown or invalid
//
case RLV_BHVR_UNKNOWN:
// Pass unknown commands on to registered command handlers
return (notifyCommandHandlers(&RlvCommandHandler::onAddRemCommand, rlvCmd, eRet, false)) ? eRet : RLV_RET_FAILED_UNKNOWN;

View File

@ -57,6 +57,8 @@ public:
// Adds or removes an exception for the specified behaviour
void addException(const LLUUID& idObj, ERlvBehaviour eBhvr, const RlvExceptionOption& varOption);
void removeException(const LLUUID& idObj, ERlvBehaviour eBhvr, const RlvExceptionOption& varOption);
// Returns TRUE if the specified behaviour has an added exception
bool hasException(ERlvBehaviour eBhvr) const;
// Returns TRUE if the specified option was added as an exception for the specified behaviour
bool isException(ERlvBehaviour eBhvr, const RlvExceptionOption& varOption, ERlvExceptionCheck typeCheck = RLV_CHECK_DEFAULT) const;
// Returns TRUE if the specified behaviour should behave "permissive" (rather than "strict"/"secure")
@ -92,7 +94,8 @@ public:
void setSitSource(const LLVector3d& posSource) { m_posSitSource = posSource; } // @standtp
// Command specific helper functions
bool canShowHoverText(LLViewerObject* pObj) const; // @showhovertext* command family
bool canEdit(const LLViewerObject* pObj) const; // @edit and @editobj
bool canShowHoverText(const LLViewerObject* pObj) const; // @showhovertext* command family
bool canSit(LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const;
bool canStand() const;
bool canTouch(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; // @touch
@ -229,8 +232,20 @@ inline void RlvHandler::addException(const LLUUID& idObj, ERlvBehaviour eBhvr, c
m_Exceptions.insert(std::pair<ERlvBehaviour, RlvException>(eBhvr, RlvException(idObj, eBhvr, varOption)));
}
// Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
inline bool RlvHandler::canEdit(const LLViewerObject* pObj) const
{
// The specified object can be edited if:
// - not generally restricted from editing (or the object's root is an exception)
// - not specifically restricted from editing this object's root
return
(pObj) &&
((!hasBehaviour(RLV_BHVR_EDIT)) || (isException(RLV_BHVR_EDIT, pObj->getRootEdit()->getID()))) &&
((!hasBehaviour(RLV_BHVR_EDITOBJ)) || (!isException(RLV_BHVR_EDITOBJ, pObj->getRootEdit()->getID())));
}
// Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.0.0f
inline bool RlvHandler::canShowHoverText(LLViewerObject *pObj) const
inline bool RlvHandler::canShowHoverText(const LLViewerObject *pObj) const
{
return ( (!pObj) || (LL_PCODE_VOLUME != pObj->getPCode()) ||
!( (hasBehaviour(RLV_BHVR_SHOWHOVERTEXTALL)) ||
@ -319,6 +334,12 @@ inline bool RlvHandler::hasBehaviourExcept(ERlvBehaviour eBehaviour, const LLUUI
return hasBehaviourExcept(eBehaviour, std::string(), idObj);
}
// Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
inline bool RlvHandler::hasException(ERlvBehaviour eBhvr) const
{
return (m_Exceptions.find(eBhvr) != m_Exceptions.end());
}
inline bool RlvHandler::isPermissive(ERlvBehaviour eBhvr) const
{
return (RlvCommand::hasStrictVariant(eBhvr))