From 9c015df3fab0b5cc229ad1a0393e5da50ee29883 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 21 Feb 2017 15:50:09 +0200 Subject: MAINT-389 Fixed No way to wear an outfit from Library besides drag-n-drop --- indra/newview/llinventorybridge.cpp | 96 +++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 25 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 6cb7ce622f..555c19baac 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3941,6 +3941,37 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items mWearables=TRUE; } } + else + { + // Mark wearables and allow copy from library + LLInventoryModel* model = getInventoryModel(); + if(!model) return; + const LLInventoryCategory* category = model->getCategory(mUUID); + if (!category) return; + LLFolderType::EType type = category->getPreferredType(); + const bool is_system_folder = LLFolderType::lookupIsProtectedType(type); + + LLFindWearables is_wearable; + LLIsType is_object(LLAssetType::AT_OBJECT); + LLIsType is_gesture(LLAssetType::AT_GESTURE); + + if (checkFolderForContentsOfType(model, is_wearable) || + checkFolderForContentsOfType(model, is_object) || + checkFolderForContentsOfType(model, is_gesture)) + { + mWearables = TRUE; + } + + if (!is_system_folder) + { + items.push_back(std::string("Copy")); + if (!isItemCopyable()) + { + // For some reason there are items in library that can't be copied directly + disabled_items.push_back(std::string("Copy")); + } + } + } // Preemptively disable system folder removal if more than one item selected. if ((flags & FIRST_SELECTED_ITEM) == 0) @@ -3948,7 +3979,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items disabled_items.push_back(std::string("Delete System Folder")); } - if (!isMarketplaceListingsFolder()) + if (isAgentInventory() && !isMarketplaceListingsFolder()) { items.push_back(std::string("Share")); if (!canShare()) @@ -3956,6 +3987,9 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items disabled_items.push_back(std::string("Share")); } } + + + // Add menu items that are dependent on the contents of the folder. LLViewerInventoryCategory* category = (LLViewerInventoryCategory *) model->getCategory(mUUID); if (category && (marketplace_listings_id != mUUID)) @@ -3993,7 +4027,6 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); if (trash_id == mUUID) return; if (isItemInTrash()) return; - if (!isAgentInventory()) return; if (!isItemRemovable()) { @@ -4006,9 +4039,10 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& // BAP change once we're no longer treating regular categories as ensembles. const bool is_ensemble = (type == LLFolderType::FT_NONE || LLFolderType::lookupIsEnsembleType(type)); + const bool is_agent_inventory = isAgentInventory(); // Only enable calling-card related options for non-system folders. - if (!is_system_folder) + if (!is_system_folder && is_agent_inventory) { LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard)) @@ -4020,7 +4054,7 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& } #ifndef LL_RELEASE_FOR_DOWNLOAD - if (LLFolderType::lookupIsProtectedType(type)) + if (LLFolderType::lookupIsProtectedType(type) && is_agent_inventory) { items.push_back(std::string("Delete System Folder")); } @@ -4037,8 +4071,6 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& checkFolderForContentsOfType(model, is_object) || checkFolderForContentsOfType(model, is_gesture) ) { - items.push_back(std::string("Folder Wearables Separator")); - // Only enable add/replace outfit for non-system folders. if (!is_system_folder) { @@ -4049,25 +4081,30 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& } items.push_back(std::string("Replace Outfit")); + + if (is_agent_inventory) + { + items.push_back(std::string("Folder Wearables Separator")); + if (is_ensemble) + { + items.push_back(std::string("Wear As Ensemble")); + } + items.push_back(std::string("Remove From Outfit")); + if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID)) + { + disabled_items.push_back(std::string("Remove From Outfit")); + } + } + if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID)) + { + disabled_items.push_back(std::string("Replace Outfit")); + } + if (!LLAppearanceMgr::instance().getCanAddToCOF(mUUID)) + { + disabled_items.push_back(std::string("Add To Outfit")); + } + items.push_back(std::string("Outfit Separator")); } - if (is_ensemble) - { - items.push_back(std::string("Wear As Ensemble")); - } - items.push_back(std::string("Remove From Outfit")); - if (!LLAppearanceMgr::getCanRemoveFromCOF(mUUID)) - { - disabled_items.push_back(std::string("Remove From Outfit")); - } - if (!LLAppearanceMgr::instance().getCanReplaceCOF(mUUID)) - { - disabled_items.push_back(std::string("Replace Outfit")); - } - if (!LLAppearanceMgr::instance().getCanAddToCOF(mUUID)) - { - disabled_items.push_back(std::string("Add To Outfit")); - } - items.push_back(std::string("Outfit Separator")); } } @@ -4304,9 +4341,18 @@ void LLFolderBridge::modifyOutfit(BOOL append) return; } - LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append ); + if (isAgentInventory()) + { + LLAppearanceMgr::instance().wearInventoryCategory(cat, FALSE, append); + } + else + { + // Library, we need to copy content first + LLAppearanceMgr::instance().wearInventoryCategory(cat, TRUE, append); + } } + // +=================================================+ // | LLMarketplaceFolderBridge | // +=================================================+ -- cgit v1.2.3