- internal : cleanup of rez_attachment() and callers

- internal : RlvAttachmentLocks::canAttach() doesn't need to take the "MultipleAttachments" setting into account

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2010-08-25 18:52:03 +02:00
parent f01a8c4d78
commit a25aedbccd
3 changed files with 16 additions and 21 deletions

View File

@ -3956,14 +3956,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
item = (LLViewerInventoryItem*)gInventory.getItem(object_id);
if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID()))
{
// rez_attachment(item, NULL);
// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
// Either nothing is locked, or we need to look up the specific attach point from its name
// RELEASE-RLVa: [SL-2.0.0] This will need rewriting for "ENABLE_MULTIATTACHMENTS"
rez_attachment(item,
( (!rlv_handler_t::isEnabled()) || (!gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
? NULL : RlvAttachPtLookup::getAttachPoint(item));
// [/RLVa:KB]
rez_attachment(item, NULL);
}
else if(item && item->isFinished())
{
@ -4030,6 +4023,14 @@ std::string LLObjectBridge::getLabelSuffix() const
void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment)
{
// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
// If no attachment point was specified, try looking it up from the item name
if ( (rlv_handler_t::isEnabled()) && (!attachment) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
{
attachment = RlvAttachPtLookup::getAttachPoint(item);
}
// [/RLVa:KB]
LLSD payload;
payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
@ -4057,9 +4058,9 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
if (!gSavedSettings.getBOOL("MultipleAttachments") &&
(attachment && attachment->getNumObjects() > 0))
{
// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
// RELEASE-RLVa: [SL-2.0.0] This will need rewriting for "ENABLE_MULTIATTACHMENTS"
if ( (rlv_handler_t::isEnabled()) && (!gRlvAttachmentLocks.canAttach(attachment)) )
// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
// Block if we can't "replace wear" what's currently there
if ( (rlv_handler_t::isEnabled()) && ((gRlvAttachmentLocks.canAttach(attachment) & RLV_WEAR_REPLACE) == 0) )
return;
// [/RLVa:KB]
LLNotificationsUtil::add("ReplaceAttachment", LLSD(), payload, confirm_replace_attachment_rez);

View File

@ -1605,8 +1605,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
// RELEASE-RLVa: [SL-2.0.0] This will need revisiting for "ENABLE_MULTIATTACHMENTS"
LLViewerJointAttachment* pAttachPt = NULL;
if ( (rlv_handler_t::isEnabled()) && (!gRlvAttachmentLocks.canAttach(item, &pAttachPt)) )
if ( (rlv_handler_t::isEnabled()) && (!gRlvAttachmentLocks.canAttach(item)) )
{
return ACCEPT_NO_LOCKED;
}
@ -1627,11 +1626,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
}
else
{
// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a) | Modified: RLVa-1.0.0c
// RELEASE-RLVa: [SL-2.0.0] This will need revisiting for "ENABLE_MULTIATTACHMENTS"
rez_attachment(item, pAttachPt);
// [/RLVa:KB]
// rez_attachment(item, 0);
rez_attachment(item, 0);
}
}
return ACCEPT_YES_SINGLE;

View File

@ -321,8 +321,7 @@ inline ERlvWearMask RlvAttachmentLocks::canAttach(const LLInventoryItem* pItem,
LLViewerJointAttachment* pAttachPt = RlvAttachPtLookup::getAttachPoint(pItem);
if (ppAttachPtOut)
*ppAttachPtOut = pAttachPt;
return (!pAttachPt) ? (ERlvWearMask)(RLV_WEAR_REPLACE | ((gSavedSettings.getBOOL("MultipleAttachments")) ? RLV_WEAR_ADD : 0))
: canAttach(pAttachPt);
return (!pAttachPt) ? (ERlvWearMask)(RLV_WEAR_REPLACE | RLV_WEAR_ADD) : canAttach(pAttachPt);
}
// Checked: 2010-08-07 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i
@ -335,7 +334,7 @@ inline ERlvWearMask RlvAttachmentLocks::canAttach(const LLViewerJointAttachment*
RLV_ASSERT(pAttachPt); // TODO-RLVa: [RLVa-1.2.1] Maybe it's better to just return something similar like above?
return
(ERlvWearMask)(((pAttachPt) && (!isLockedAttachmentPoint(pAttachPt, RLV_LOCK_ADD)))
? ((canDetach(pAttachPt, true)) ? RLV_WEAR_REPLACE : 0) | ((gSavedSettings.getBOOL("MultipleAttachments")) ? RLV_WEAR_ADD : 0)
? ((canDetach(pAttachPt, true)) ? RLV_WEAR_REPLACE : 0) | RLV_WEAR_ADD
: RLV_WEAR_LOCKED);
}