From 4fdf1c34b43f73c576576a6487c16e99e2ed75fc Mon Sep 17 00:00:00 2001
From: andreylproductengine <andreylproductengine@lindenlab.com>
Date: Thu, 13 Mar 2014 01:44:41 +0200
Subject: [PATCH] MAINT-3812 FIXED "Remove from outfit" is unavailable for
 folders containing only gestures

---
 indra/newview/llappearancemgr.cpp      | 12 ++++++++++++
 indra/newview/llinventoryfunctions.cpp |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index da1609297e4..415cefb5a90 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1431,6 +1431,18 @@ void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id)
 		uuids_to_remove.push_back(item->getUUID());
 	}
 	removeItemsFromAvatar(uuids_to_remove);
+
+	// now deactivating all gestures in that folder
+	LLInventoryModel::item_array_t gest_items;
+	getDescendentsOfAssetType(cat_id, gest_items, LLAssetType::AT_GESTURE, false);
+	for (S32 i = 0; i < gest_items.count(); ++i)
+	{
+		LLViewerInventoryItem *gest_item = gest_items.get(i);
+		if (LLGestureMgr::instance().isGestureActive(gest_item->getLinkedUUID()))
+		{
+			LLGestureMgr::instance().deactivateGesture(gest_item->getLinkedUUID());
+		}
+	}
 }
 
 // Create a copy of src_id + contents as a subfolder of dst_id.
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index f1a4889f5ac..aa50795eb54 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -877,7 +877,7 @@ bool LLFindWearablesEx::operator()(LLInventoryCategory* cat, LLInventoryItem* it
 	if (!vitem) return false;
 
 	// Skip non-wearables.
-	if (!vitem->isWearableType() && vitem->getType() != LLAssetType::AT_OBJECT)
+	if (!vitem->isWearableType() && vitem->getType() != LLAssetType::AT_OBJECT && vitem->getType() != LLAssetType::AT_GESTURE)
 	{
 		return false;
 	}
-- 
GitLab