From 2af2e37dcd127311f79bbd2fdb413b83ed6bec9f Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 27 Mar 2014 20:02:12 -0400 Subject: [PATCH] Right clicking folder with only gestures (no worn items) should still offer remove from outfit if any gesture in that folder is active. Also follow linked folders when wearing folders, this will make linked folders a lot more useful! Also fixes a warning and some spacing issues --- indra/newview/llappearancemgr.cpp | 44 ++++++++++++++++++----------- indra/newview/llinventorybridge.cpp | 15 ++++++---- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8ab198d3b..5c6712711 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1526,7 +1526,7 @@ void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id) LLInventoryModel::item_array_t items; LLFindWearablesEx collector(/*is_worn=*/ true, /*include_body_parts=*/ false); - gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector); + gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector, true); LLInventoryModel::item_array_t::const_iterator it = items.begin(); const LLInventoryModel::item_array_t::const_iterator it_end = items.end(); @@ -1539,16 +1539,16 @@ void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id) removeItemsFromAvatar(uuids_to_remove); // deactivate all gestures in the outfit folder - LLInventoryModel::item_array_t gest_items; - getDescendentsOfAssetType(cat_id, gest_items, LLAssetType::AT_GESTURE, false); - for(U32 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()); - } - } + LLInventoryModel::item_array_t gest_items; + getDescendentsOfAssetType(cat_id, gest_items, LLAssetType::AT_GESTURE, true); + 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. @@ -1724,8 +1724,18 @@ bool LLAppearanceMgr::getCanRemoveFromCOF(const LLUUID& outfit_cat_id) cats, items, LLInventoryModel::EXCLUDE_TRASH, - is_worn); - return items.size() > 0; + is_worn, + /*follow_folder_links=*/ true); + + if (items.size()) return true; + + // Is there an active gesture in outfit_cat_id? + items.reset(); + gInventory.collectDescendentsIf(outfit_cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, LLIsType(LLAssetType::AT_GESTURE), /*follow_folder_links=*/ true); + for(S32 i = 0; i < items.count(); ++i) + if (LLGestureMgr::instance().isGestureActive(items.get(i)->getLinkedUUID())) + return true; + return false; } // static @@ -1956,10 +1966,10 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid, void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) { LLInventoryModel::item_array_t body_items_new, wear_items_new, obj_items_new, gest_items_new; - getDescendentsOfAssetType(category, body_items_new, LLAssetType::AT_BODYPART, false); - getDescendentsOfAssetType(category, wear_items_new, LLAssetType::AT_CLOTHING, false); - getDescendentsOfAssetType(category, obj_items_new, LLAssetType::AT_OBJECT, false); - getDescendentsOfAssetType(category, gest_items_new, LLAssetType::AT_GESTURE, false); + getDescendentsOfAssetType(category, body_items_new, LLAssetType::AT_BODYPART, true); + getDescendentsOfAssetType(category, wear_items_new, LLAssetType::AT_CLOTHING, true); + getDescendentsOfAssetType(category, obj_items_new, LLAssetType::AT_OBJECT, true); + getDescendentsOfAssetType(category, gest_items_new, LLAssetType::AT_GESTURE, true); updateCOF(body_items_new, wear_items_new, obj_items_new, gest_items_new, append, category); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 1cf94d15e..323263d76 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1766,7 +1766,8 @@ BOOL LLItemBridge::removeItem() cat_array, item_array, LLInventoryModel::INCLUDE_TRASH, - is_linked_item_match); + is_linked_item_match, + true); const U32 num_links = cat_array.size() + item_array.size(); if (num_links > 0) @@ -3254,7 +3255,8 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, - is_type); + is_type, + true); return ((item_array.count() > 0) ? TRUE : FALSE ); } @@ -5597,7 +5599,8 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH, - is_wearable); + is_wearable, + true); S32 i; S32 wearable_count = item_array.count(); @@ -5608,7 +5611,8 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ obj_cat_array, obj_item_array, LLInventoryModel::EXCLUDE_TRASH, - is_object); + is_object, + true); S32 obj_count = obj_item_array.count(); // Find all gestures in this folder @@ -5619,7 +5623,8 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ gest_cat_array, gest_item_array, LLInventoryModel::EXCLUDE_TRASH, - is_gesture); + is_gesture, + true); S32 gest_count = gest_item_array.count(); if (wearable_count > 0) //Loop through wearables. If worn, remove.