From 655c3dbe1b711389c1f581f4ccae07dafb5cdefd Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 2 Jul 2010 11:42:31 -0400
Subject: [PATCH] EXT-8204 FIXED Can't "Copy and Wear" items when object with
 contents is first opened EXT-3278 REVERT "Copy and wear" exists for landmarks
 in object inventory

Fixed issue that was causing copy and wear to always be greyed out on first opening of object.
---
 indra/newview/llfloateropenobject.cpp | 46 ++++++---------------------
 1 file changed, 10 insertions(+), 36 deletions(-)

diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index 71bfae316a5..d39ed774914 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -105,49 +105,23 @@ void LLFloaterOpenObject::refresh()
 	mPanelInventoryObject->refresh();
 
 	std::string name = "";
-	
-	// Enable the copy || copy & wear buttons only if we have something we can copy or copy & wear (respectively).
-	bool copy_enabled = false;
-	bool wear_enabled = false;
+	BOOL enabled = FALSE;
 
 	LLSelectNode* node = mObjectSelection->getFirstRootNode();
 	if (node) 
 	{
 		name = node->mName;
-		copy_enabled = true;
-		
-		LLViewerObject* object = node->getObject();
-		if (object)
-		{
-			// this folder is coming from an object, as there is only one folder in an object, the root,
-			// we need to collect the entire contents and handle them as a group
-			LLInventoryObject::object_list_t inventory_objects;
-			object->getInventoryContents(inventory_objects);
-			
-			if (!inventory_objects.empty())
-			{
-				for (LLInventoryObject::object_list_t::iterator it = inventory_objects.begin(); 
-					 it != inventory_objects.end(); 
-					 ++it)
-				{
-					LLInventoryItem* item = static_cast<LLInventoryItem*> ((LLInventoryObject*)(*it));
-					LLInventoryType::EType type = item->getInventoryType();
-					if (type == LLInventoryType::IT_OBJECT 
-						|| type == LLInventoryType::IT_ATTACHMENT 
-						|| type == LLInventoryType::IT_WEARABLE
-						|| type == LLInventoryType::IT_GESTURE)
-					{
-						wear_enabled = true;
-						break;
-					}
-				}
-			}
-		}
+		enabled = TRUE;
 	}
-
+	else
+	{
+		name = "";
+		enabled = FALSE;
+	}
+	
 	childSetTextArg("object_name", "[DESC]", name);
-	childSetEnabled("copy_to_inventory_button", copy_enabled);
-	childSetEnabled("copy_and_wear_button", wear_enabled);
+	childSetEnabled("copy_to_inventory_button", enabled);
+	childSetEnabled("copy_and_wear_button", enabled);
 
 }
 
-- 
GitLab