// Checked: 2010-03-22 (RLVa-1.2.0c) | Added: RLVa-1.2.0a bool rlvPredCanNotRemoveItem(const LLViewerInventoryItem* pItem) { return !rlvPredCanRemoveItem(pItem); }
void updateMenuItemsVisibility(LLContextMenu* menu) { 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) { LLViewerInventoryItem* item = gInventory.getItem(*it); if (!item) { llwarns << "Invalid item" << llendl; continue; } LLAssetType::EType type = item->getType(); if (type == LLAssetType::AT_CLOTHING) { clothes_selected = true; } else if (type == LLAssetType::AT_BODYPART) { bp_selected = true; } else if (type == LLAssetType::AT_OBJECT) { 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; // [SL:KB] - Patch: Inventory-AttachmentEdit - Checked: 2010-09-04 (Catznip-2.2.0a) | Added: Catznip-2.1.2a menu->setItemVisible("edit_item", bp_selected || clothes_selected || attachments_selected); menu->setItemEnabled("edit_item", 1 == mUUIDs.size()); // [/SL:KB] menu->setItemVisible("take_off", allow_take_off); menu->setItemVisible("detach", allow_detach); // [SL:KB] - Patch: Inventory-AttachmentEdit - Checked: 2010-09-04 (Catznip-2.2.0a) | Added: Catznip-2.1.2a menu->setItemVisible("take_off_or_detach", (!allow_detach) && (!allow_take_off) && (clothes_selected) && (attachments_selected)); // [/SL:KB] // [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); }