From b6b0a45b1919abdfa0616f95b54c49cefde0eee2 Mon Sep 17 00:00:00 2001
From: Kitty Barnett <none@none>
Date: Sat, 4 Sep 2010 00:45:34 +0200
Subject: [PATCH] - fixed  : "Wear" on the inventory item context menu isn't
 visually disabled for wearables or attachments - fixed  : "Add" on the
 inventory item context menu isn't visually disabled for attachments - review
 : canAttach/canWear/canDetach/canRemove

--HG--
branch : RLVa
---
 indra/newview/llinventorybridge.cpp | 15 ++++++++-------
 indra/newview/rlvlocks.h            |  8 ++++----
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index aa6974fef6..dcd1e9576a 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4169,7 +4169,6 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 			{
 				items.push_back(std::string("Wearable And Object Separator"));
 				items.push_back(std::string("Detach From Yourself"));
-
 // [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
 				if ( (rlv_handler_t::isEnabled()) && (!gRlvAttachmentLocks.canDetach(item)) )
 					disabled_items.push_back(std::string("Detach From Yourself"));
@@ -4192,10 +4191,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 					disabled_items.push_back(std::string("Attach To"));
 					disabled_items.push_back(std::string("Attach To HUD"));
 				}
-// [RLVa:KB] - Checked: 2010-02-27 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
-				else if ( (rlv_handler_t::isEnabled()) && (!gRlvAttachmentLocks.canAttach(item)) )
+// [RLVa:KB] - Checked: 2010-09-03 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
+				else if (rlv_handler_t::isEnabled())
 				{
-					disabled_items.push_back(std::string("Object Wear"));
+					ERlvWearMask eWearMask = gRlvAttachmentLocks.canAttach(item);
+					if ((eWearMask & RLV_WEAR_REPLACE) == 0)
+						disabled_items.push_back(std::string("Wearable And Object Wear"));
+					if ((eWearMask & RLV_WEAR_ADD) == 0)
+						disabled_items.push_back(std::string("Wearable Add"));
 				}
 // [/RLVa:KB]
 
@@ -4565,9 +4568,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 						disabled_items.push_back(std::string("Wearable Add"));
 // [RLVa:KB] - Checked: 2010-04-04 (RLVa-1.2.0c) | Added: RLVa-1.2.0c
 						if ( (rlv_handler_t::isEnabled()) && (!gRlvWearableLocks.canRemove(item)) )
-						{
 							disabled_items.push_back(std::string("Take Off"));
-						}
 // [/RLVa:KB]
 					}
 					else
@@ -4582,7 +4583,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 						{
 							ERlvWearMask eWearMask = gRlvWearableLocks.canWear(item);
 							if ((eWearMask & RLV_WEAR_REPLACE) == 0)
-								disabled_items.push_back(std::string("Wearable Wear"));
+								disabled_items.push_back(std::string("Wearable And Object Wear"));
 							if ((eWearMask & RLV_WEAR_ADD) == 0)
 								disabled_items.push_back(std::string("Wearable Add"));
 						}
diff --git a/indra/newview/rlvlocks.h b/indra/newview/rlvlocks.h
index 262570a7ad..76bef63339 100644
--- a/indra/newview/rlvlocks.h
+++ b/indra/newview/rlvlocks.h
@@ -321,16 +321,16 @@ inline ERlvWearMask RlvAttachmentLocks::canAttach(const LLInventoryItem* pItem,
 	LLViewerJointAttachment* pAttachPt = RlvAttachPtLookup::getAttachPoint(pItem);
 	if (ppAttachPtOut)
 		*ppAttachPtOut = pAttachPt;
-	return (!pAttachPt) ? (ERlvWearMask)(RLV_WEAR_REPLACE | RLV_WEAR_ADD) : canAttach(pAttachPt);
+	return (!pAttachPt) ? RLV_WEAR : canAttach(pAttachPt);
 }
 
 // Checked: 2010-08-07 (RLVa-1.2.0i) | Modified: RLVa-1.2.0i
 inline ERlvWearMask RlvAttachmentLocks::canAttach(const LLViewerJointAttachment* pAttachPt) const
 {
 	// Non-attachable attachment point  => RLV_WEAR_LOCKED
-	// One or more locked attachment(s) => RLV_WEAR_LOCKED  (or RLV_WEAR_ADD)
-	// Unlocked attachment(s)           => RLV_WEAR_REPLACE (or RLV_WEAR_ADD | RLV_WEAR_REPLACE)
-	// Empty attachment point           => RLV_WEAR_REPLACE (or RLV_WEAR_ADD | RLV_WEAR_REPLACE)
+	// One or more locked attachment(s) => RLV_WEAR_ADD
+	// Unlocked attachment(s)           => RLV_WEAR_ADD | RLV_WEAR_REPLACE
+	// Empty attachment point           => RLV_WEAR_ADD | RLV_WEAR_REPLACE
 	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))) 
-- 
GitLab