- changed : visually disable "Take Off" and "Detach" on the wearing panel context menu

--HG--
branch : RLVa
meow-7.2.2
Kitty Barnett 2012-07-28 17:50:59 +02:00
parent 0a4364c103
commit 843d218675
2 changed files with 29 additions and 0 deletions

View File

@ -32,6 +32,10 @@
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
#include "llviewerinventory.h"
// [RLVa:KB] - Checked: 2012-07-08 (RLVa-1.4.7)
#include "rlvcommon.h"
#include "rlvhandler.h"
// [/RLVa:KB]
//virtual
bool LLPanelAppearanceTab::canTakeOffSelected()
@ -46,6 +50,11 @@ bool LLPanelAppearanceTab::canTakeOffSelected()
LLViewerInventoryItem* item = gInventory.getItem(*it);
if (!item) continue;
// [RLVa:KB] - Checked: 2012-07-08 (RLVa-1.4.7)
if ( (rlv_handler_t::isEnabled()) && (rlvPredCanNotRemoveItem(item)) )
return false;
// [/RLVa:KB]
if (is_worn(NULL, item)) return true;
}
return false;

View File

@ -40,6 +40,10 @@
#include "llwearableitemslist.h"
#include "llsdserialize.h"
#include "llclipboard.h"
// [RLVa:KB] - Checked: 2012-07-28 (RLVa-1.4.7)
#include "rlvcommon.h"
#include "rlvhandler.h"
// [/RLVa:KB]
// Context menu and Gear menu helper.
static void edit_outfit()
@ -115,6 +119,9 @@ protected:
bool bp_selected = false; // true if body parts selected
bool clothes_selected = false;
bool attachments_selected = false;
// [RLVa:KB] - Checked: 2012-07-28 (RLVa-1.4.7)
S32 rlv_locked_count = 0;
// [/RLVa:KB]
// See what types of wearables are selected.
for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it)
@ -140,14 +147,27 @@ protected:
{
attachments_selected = true;
}
// [RLVa:KB] - Checked: 2012-07-28 (RLVa-1.4.7)
if ( (rlv_handler_t::isEnabled()) && (!rlvPredCanRemoveItem(item)) )
{
rlv_locked_count++;
}
// [/RLVa:KB]
}
// Enable/disable some menu items depending on the selection.
// [RLVa:KB] - Checked: 2012-07-28 (RLVa-1.4.7)
bool rlv_blocked = (mUUIDs.size() == rlv_locked_count);
// [/RLVa:KB]
bool allow_detach = !bp_selected && !clothes_selected && attachments_selected;
bool allow_take_off = !bp_selected && clothes_selected && !attachments_selected;
menu->setItemVisible("take_off", allow_take_off);
menu->setItemVisible("detach", allow_detach);
// [RLVa:KB] - Checked: 2012-07-28 (RLVa-1.4.7)
menu->setItemEnabled("take_off", !rlv_blocked);
menu->setItemEnabled("detach", !rlv_blocked);
// [/RLVa:KB]
menu->setItemVisible("edit_outfit_separator", allow_take_off || allow_detach);
}
};