[FIXED] @unsharedwear=n doesn't block "Add to Outfit" (if no attachment/wearable locks exist)

-> wearables would be properly filtered if there was at least one wearable lock
  -> attachments would be properly filtered if there was at least one attachment lock
  => added explicit check for add-restricted folders
  => gray out the relevant context menu items (i.e. "Add to Outfit" and "Replace Current Outfit)

--HG--
branch : RLVa
master
Kitty Barnett 2016-07-10 16:40:20 +02:00
parent 5e4235be4e
commit 7bfd26e3df
2 changed files with 34 additions and 6 deletions

View File

@ -55,6 +55,7 @@
#include "llhttpretrypolicy.h"
#include "llaisapi.h"
// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1)
#include "rlvactions.h"
#include "rlvhandler.h"
#include "rlvhelper.h"
#include "rlvlocks.h"
@ -1874,6 +1875,13 @@ bool LLAppearanceMgr::getCanAddToCOF(const LLUUID& outfit_cat_id)
return false;
}
// [RLVa:KB] - Checked: RLVa-2.0.3
if ( (RlvActions::isRlvEnabled()) && (RlvFolderLocks::instance().isLockedFolder(outfit_cat_id, RLV_LOCK_ADD)) )
{
return false;
}
// [/RLVa:KB]
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLFindWearablesEx not_worn(/*is_worn=*/ false, /*include_body_parts=*/ false);
@ -1894,6 +1902,14 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id)
return false;
}
// [RLVa:KB] - Checked: RLVa-2.0.3
// Block "Replace Current Outfit" if the user can't wear the new folder
if ( (RlvActions::isRlvEnabled()) && (RlvFolderLocks::instance().isLockedFolder(outfit_cat_id, RLV_LOCK_ADD)) )
{
return false;
}
// [/RLVa:KB]
// Check whether it's the base outfit.
// if (outfit_cat_id.isNull() || outfit_cat_id == getBaseOutfitUUID())
// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-21 (Catznip-2.1)
@ -2087,9 +2103,9 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
LLInventoryModel::item_array_t body_items;
getDescendentsOfAssetType(cof, body_items, LLAssetType::AT_BODYPART);
// getDescendentsOfAssetType(category, body_items, LLAssetType::AT_BODYPART);
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0)
// [RLVa:KB] - Checked: RLVa-2.0.3
// Filter out any new body parts that can't be worn before adding them
if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) )
if ( (RlvActions::isRlvEnabled()) && ((gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
body_items_new.erase(std::remove_if(body_items_new.begin(), body_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR_REPLACE)), body_items_new.end());
body_items.insert(body_items.end(), body_items_new.begin(), body_items_new.end());
// [/RLVa:KB]
@ -2115,9 +2131,9 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
}
// [/RLVa:KB]
// getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING);
// [RLVa:KB] - Checked: 2010-03-19 (RLVa-1.2.0)
// [RLVa:KB] - Checked: RLVa-2.0.3
// Filter out any new wearables that can't be worn before adding them
if ( (rlv_handler_t::isEnabled()) && (gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) )
if ( (RlvActions::isRlvEnabled()) && ((gRlvWearableLocks.hasLockedWearableType(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
wear_items_new.erase(std::remove_if(wear_items_new.begin(), wear_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR)), wear_items_new.end());
wear_items.insert(wear_items.end(), wear_items_new.begin(), wear_items_new.end());
// [/RLVa:KB]
@ -2143,9 +2159,9 @@ void LLAppearanceMgr::updateCOF(LLInventoryModel::item_array_t& body_items_new,
}
// [/RLVa:KB]
// getDescendentsOfAssetType(category, obj_items, LLAssetType::AT_OBJECT);
// [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0)
// [RLVa:KB] - Checked: RLVa-2.0.3
// Filter out any new attachments that can't be worn before adding them
if ( (rlv_handler_t::isEnabled()) && (gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) )
if ( (RlvActions::isRlvEnabled()) && ((gRlvAttachmentLocks.hasLockedAttachmentPoint(RLV_LOCK_ANY)) || (RlvFolderLocks::instance().hasLockedFolder(RLV_LOCK_ADD))) )
obj_items_new.erase(std::remove_if(obj_items_new.begin(), obj_items_new.end(), RlvPredCanNotWearItem(RLV_WEAR)), obj_items_new.end());
obj_items.insert(obj_items.end(), obj_items_new.begin(), obj_items_new.end());
// [/RLVa:KB]

View File

@ -4118,6 +4118,13 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
{
disabled_items.push_back(std::string("Replace Outfit"));
}
// [RLVa:KB] - Checked: RLVa-2.0.3
// Block "Replace Current Outfit" if the user can't wear the new folder
if ( (RlvActions::isRlvEnabled()) && (RlvFolderLocks::instance().isLockedFolder(mUUID, RLV_LOCK_ADD)) )
{
disabled_items.push_back(std::string("Replace Outfit"));
}
// [/RLVa:KB]
if (!LLAppearanceMgr::instance().getCanAddToCOF(mUUID))
{
disabled_items.push_back(std::string("Add To Outfit"));
@ -6185,6 +6192,11 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
{
attachment = RlvAttachPtLookup::getAttachPoint(item);
}
if ( (RlvActions::isRlvEnabled()) && (!rlvPredCanWearItem(item, RLV_WEAR_REPLACE)) )
{
return;
}
// [/RLVa:KB]
const LLUUID& item_id = item->getLinkedUUID();