From b95b20a1be56ff7baa3ad20e8d0571ec9f07ab12 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 8 Apr 2025 20:28:50 +0300 Subject: #3757 Allow subfolders in "My Outfits" --- indra/newview/llinventorybridge.cpp | 45 ++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ce91f9a1f3..8d31c4dde7 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2916,6 +2916,10 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // create a new folder and populate it with links to original objects dropToMyOutfits(inv_cat, cb); } + else if (getCategory() && getCategory()->getParentUUID() == my_outifts_id) + { + dropToMyOutfitsSubfolder(inv_cat, mUUID, cb); + } // if target is current outfit folder we use link else if (move_is_into_current_outfit && (inv_cat->getPreferredType() == LLFolderType::FT_NONE || @@ -4016,7 +4020,14 @@ void LLFolderBridge::perform_pasteFromClipboard() U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit"); if (cat && can_move_to_my_outfits(model, cat, max_items_to_wear)) { - dropToMyOutfits(cat, cb); + if (mUUID == my_outifts_id) + { + dropToMyOutfits(cat, cb); + } + else if (getCategory() && getCategory()->getParentUUID() == mUUID) + { + dropToMyOutfitsSubfolder(cat, mUUID, cb); + } } else { @@ -4256,6 +4267,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items if (outfits_id == mUUID) { + items.push_back(std::string("New Outfit Folder")); items.push_back(std::string("New Outfit")); } @@ -5331,13 +5343,36 @@ void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointergetUUID(), _1, cb, mInventoryPanel); - gInventory.createNewCategory(dest_id, + getInventoryModel()->createNewCategory(dest_id, LLFolderType::FT_OUTFIT, inv_cat->getName(), func, inv_cat->getThumbnailUUID()); } +void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLPointer cb) +{ + LLViewerInventoryCategory* cat = getInventoryModel()->getCategory(dest_id); + const LLUUID outfits_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + inventory_func_type func = boost::bind(outfitFolderCreatedCallback, inv_cat->getUUID(), _1, cb, mInventoryPanel); + if (cat && cat->getParentUUID() == outfits_id) + { + getInventoryModel()->createNewCategory(dest_id, + LLFolderType::FT_OUTFIT, + inv_cat->getName(), + func, + inv_cat->getThumbnailUUID()); + } + else + { + getInventoryModel()->createNewCategory(outfits_id, + LLFolderType::FT_OUTFIT, + inv_cat->getName(), + func, + inv_cat->getThumbnailUUID()); + } +} + void LLFolderBridge::outfitFolderCreatedCallback(LLUUID cat_source_id, LLUUID cat_dest_id, LLPointer cb, @@ -5441,6 +5476,10 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const bool move_is_into_favorites = (mUUID == favorites_id); const bool move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); const bool move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); + const bool move_is_into_my_outfits_subfolder = move_is_into_my_outfits + && getCategory() + && getCategory()->getParentUUID() == my_outifts_id + && getCategory()->getPreferredType() != LLFolderType::FT_OUTFIT; const bool move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); @@ -5511,7 +5550,7 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit)) { - accept = can_move_to_outfit(inv_item, move_is_into_current_outfit); + accept = !move_is_into_my_outfits_subfolder && can_move_to_outfit(inv_item, move_is_into_current_outfit); } else if (user_confirm && (move_is_into_favorites || move_is_into_landmarks)) { -- cgit v1.2.3 From 1bb8fb2795920b57a5934ffa394d78a6c5733ce8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 8 Apr 2025 22:39:41 +0300 Subject: #3757 Menu for subfodlers in outfits --- indra/newview/llinventorybridge.cpp | 199 +++++++++++++++++++++++++----------- 1 file changed, 140 insertions(+), 59 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 8d31c4dde7..fd9d08a26d 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -105,6 +105,44 @@ static bool check_item(const LLUUID& item_id, // Helper functions + +namespace { + enum EMyOutfitsSubfolderType + { + MY_OUTFITS_NO, + MY_OUTFITS_SUBFOLDER, + MY_OUTFITS_OUTFIT, + }; + + EMyOutfitsSubfolderType myoutfit_object_subfolder_type(LLInventoryModel* model, const LLUUID& obj_id, + const LLUUID& cat_id) + { + if (obj_id == cat_id) return MY_OUTFITS_NO; + + const LLViewerInventoryCategory* test_cat = model->getCategory(obj_id); + while (test_cat) + { + if (test_cat->getPreferredType() == LLFolderType::FT_OUTFIT) + { + return MY_OUTFITS_OUTFIT; + } + + const LLUUID& parent_id = test_cat->getParentUUID(); + if (parent_id.isNull()) + { + return MY_OUTFITS_NO; + } + if (parent_id == cat_id) + { + return MY_OUTFITS_SUBFOLDER; + } + test_cat = model->getCategory(parent_id); + } + + return MY_OUTFITS_NO; + } +} + bool isAddAction(const std::string& action) { return ("wear" == action || "attach" == action || "activate" == action); @@ -2912,13 +2950,22 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (mUUID == my_outifts_id) { - // Category can contains objects, + // Category can't contains objects, // create a new folder and populate it with links to original objects dropToMyOutfits(inv_cat, cb); } - else if (getCategory() && getCategory()->getParentUUID() == my_outifts_id) + else if (move_is_into_my_outfits) { - dropToMyOutfitsSubfolder(inv_cat, mUUID, cb); + EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); + if (res == MY_OUTFITS_SUBFOLDER) + { + // turn it into outfit + dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_OUTFIT, cb); + } + else + { + dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_NONE, cb); + } } // if target is current outfit folder we use link else if (move_is_into_current_outfit && @@ -4012,6 +4059,7 @@ void LLFolderBridge::perform_pasteFromClipboard() { if (!move_is_into_my_outfits && item && can_move_to_outfit(item, move_is_into_current_outfit)) { + // todo: this is going to create dupplicate folders? dropToOutfit(item, move_is_into_current_outfit, cb); } else if (move_is_into_my_outfits && LLAssetType::AT_CATEGORY == obj->getType()) @@ -4024,9 +4072,18 @@ void LLFolderBridge::perform_pasteFromClipboard() { dropToMyOutfits(cat, cb); } - else if (getCategory() && getCategory()->getParentUUID() == mUUID) + else if (move_is_into_my_outfits) { - dropToMyOutfitsSubfolder(cat, mUUID, cb); + EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); + if (res == MY_OUTFITS_SUBFOLDER) + { + // turn it into outfit + dropToMyOutfitsSubfolder(cat, mUUID, LLFolderType::FT_OUTFIT, cb); + } + else + { + dropToMyOutfitsSubfolder(cat, mUUID, LLFolderType::FT_NONE, cb); + } } } else @@ -4361,63 +4418,85 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items else if(isAgentInventory()) // do not allow creating in library { LLViewerInventoryCategory *cat = getCategory(); - // BAP removed protected check to re-enable standard ops in untyped folders. - // Not sure what the right thing is to do here. - if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT)) - { - if (!isInboxFolder() // don't allow creation in inbox - && outfits_id != mUUID) - { - bool menu_items_added = false; - // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694. - if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat)) - { - items.push_back(std::string("New Folder")); - menu_items_added = true; - } - if (!isMarketplaceListingsFolder()) - { - items.push_back(std::string("upload_def")); - items.push_back(std::string("create_new")); - items.push_back(std::string("New Script")); - items.push_back(std::string("New Note")); - items.push_back(std::string("New Gesture")); - items.push_back(std::string("New Material")); - items.push_back(std::string("New Clothes")); - items.push_back(std::string("New Body Parts")); - items.push_back(std::string("New Settings")); - if (!LLEnvironment::instance().isInventoryEnabled()) - { - disabled_items.push_back("New Settings"); - } - } - else - { - items.push_back(std::string("New Listing Folder")); - } - if (menu_items_added) - { - items.push_back(std::string("Create Separator")); - } - } - getClipboardEntries(false, items, disabled_items, flags); - } - else + + if (cat) { - // Want some but not all of the items from getClipboardEntries for outfits. - if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT)) + if (cat->getPreferredType() == LLFolderType::FT_OUTFIT) { + // Want some but not all of the items from getClipboardEntries for outfits. + items.push_back(std::string("New Outfit Folder")); items.push_back(std::string("Rename")); items.push_back(std::string("thumbnail")); addDeleteContextMenuOptions(items, disabled_items); // EXT-4030: disallow deletion of currently worn outfit - const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); + const LLViewerInventoryItem* base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory())) { disabled_items.push_back(std::string("Delete")); } } + else if (outfits_id == mUUID) + { + getClipboardEntries(false, items, disabled_items, flags); + } + else if (!isCOFFolder()) + { + EMyOutfitsSubfolderType in_my_outfits = myoutfit_object_subfolder_type(model, mUUID, outfits_id); + if (in_my_outfits != MY_OUTFITS_NO) + { + if (in_my_outfits == MY_OUTFITS_SUBFOLDER) + { + // Not inside an outfit, but inside 'my outfits' + items.push_back(std::string("New Outfit")); + } + + items.push_back(std::string("New Outfit Folder")); + items.push_back(std::string("Rename")); + items.push_back(std::string("thumbnail")); + + addDeleteContextMenuOptions(items, disabled_items); + } + else + { + if (!isInboxFolder() // don't allow creation in inbox + && outfits_id != mUUID) + { + bool menu_items_added = false; + // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694. + if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat)) + { + items.push_back(std::string("New Folder")); + menu_items_added = true; + } + if (!isMarketplaceListingsFolder()) + { + items.push_back(std::string("upload_def")); + items.push_back(std::string("create_new")); + items.push_back(std::string("New Script")); + items.push_back(std::string("New Note")); + items.push_back(std::string("New Gesture")); + items.push_back(std::string("New Material")); + items.push_back(std::string("New Clothes")); + items.push_back(std::string("New Body Parts")); + items.push_back(std::string("New Settings")); + if (!LLEnvironment::instance().isInventoryEnabled()) + { + disabled_items.push_back("New Settings"); + } + } + else + { + items.push_back(std::string("New Listing Folder")); + } + if (menu_items_added) + { + items.push_back(std::string("Create Separator")); + } + } + getClipboardEntries(false, items, disabled_items, flags); + } + } } if (model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT) == mUUID) @@ -4570,7 +4649,11 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t& if (((flags & ITEM_IN_MULTI_SELECTION) == 0) && hasChildren() && (type != LLFolderType::FT_OUTFIT)) { - items.push_back(std::string("Ungroup folder items")); + const LLUUID my_outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); + if (!gInventory.isObjectDescendentOf(mUUID, my_outfits)) + { + items.push_back(std::string("Ungroup folder items")); + } } } else @@ -5350,7 +5433,7 @@ void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointergetThumbnailUUID()); } -void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLPointer cb) +void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLFolderType::EType preferred_type, LLPointer cb) { LLViewerInventoryCategory* cat = getInventoryModel()->getCategory(dest_id); const LLUUID outfits_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); @@ -5358,7 +5441,7 @@ void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, cons if (cat && cat->getParentUUID() == outfits_id) { getInventoryModel()->createNewCategory(dest_id, - LLFolderType::FT_OUTFIT, + preferred_type, inv_cat->getName(), func, inv_cat->getThumbnailUUID()); @@ -5366,7 +5449,7 @@ void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, cons else { getInventoryModel()->createNewCategory(outfits_id, - LLFolderType::FT_OUTFIT, + preferred_type, inv_cat->getName(), func, inv_cat->getThumbnailUUID()); @@ -5476,10 +5559,6 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, const bool move_is_into_favorites = (mUUID == favorites_id); const bool move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf(mUUID, my_outifts_id); const bool move_is_into_outfit = move_is_into_my_outfits || (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - const bool move_is_into_my_outfits_subfolder = move_is_into_my_outfits - && getCategory() - && getCategory()->getParentUUID() == my_outifts_id - && getCategory()->getPreferredType() != LLFolderType::FT_OUTFIT; const bool move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id); const bool move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id); const bool move_is_from_marketplacelistings = model->isObjectDescendentOf(inv_item->getUUID(), marketplacelistings_id); @@ -5550,7 +5629,9 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit)) { - accept = !move_is_into_my_outfits_subfolder && can_move_to_outfit(inv_item, move_is_into_current_outfit); + EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); + // don't allow items in my outfits' subfodlers, only in outfits and outfit's subfolders + accept = res != MY_OUTFITS_SUBFOLDER && can_move_to_outfit(inv_item, move_is_into_current_outfit); } else if (user_confirm && (move_is_into_favorites || move_is_into_landmarks)) { -- cgit v1.2.3 From 2371994a88ffeefd07891d00aed18ac226b954a7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 9 Apr 2025 21:35:40 +0300 Subject: #3757 Menu for subfodlers in outfits p2 --- indra/newview/llinventorybridge.cpp | 90 +++++++++++++------------------------ 1 file changed, 30 insertions(+), 60 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index fd9d08a26d..2c1c6d22a6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -104,45 +104,6 @@ static bool check_item(const LLUUID& item_id, LLInventoryFilter* filter); // Helper functions - - -namespace { - enum EMyOutfitsSubfolderType - { - MY_OUTFITS_NO, - MY_OUTFITS_SUBFOLDER, - MY_OUTFITS_OUTFIT, - }; - - EMyOutfitsSubfolderType myoutfit_object_subfolder_type(LLInventoryModel* model, const LLUUID& obj_id, - const LLUUID& cat_id) - { - if (obj_id == cat_id) return MY_OUTFITS_NO; - - const LLViewerInventoryCategory* test_cat = model->getCategory(obj_id); - while (test_cat) - { - if (test_cat->getPreferredType() == LLFolderType::FT_OUTFIT) - { - return MY_OUTFITS_OUTFIT; - } - - const LLUUID& parent_id = test_cat->getParentUUID(); - if (parent_id.isNull()) - { - return MY_OUTFITS_NO; - } - if (parent_id == cat_id) - { - return MY_OUTFITS_SUBFOLDER; - } - test_cat = model->getCategory(parent_id); - } - - return MY_OUTFITS_NO; - } -} - bool isAddAction(const std::string& action) { return ("wear" == action || "attach" == action || "activate" == action); @@ -2735,7 +2696,12 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit"); if (is_movable && move_is_into_outfit) { - if (mUUID == my_outifts_id) + if ((inv_cat->getPreferredType() != LLFolderType::FT_NONE) && (inv_cat->getPreferredType() != LLFolderType::FT_OUTFIT)) + { + tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit"); + is_movable = false; + } + else if (mUUID == my_outifts_id) { if (source != LLToolDragAndDrop::SOURCE_AGENT || move_is_from_marketplacelistings) { @@ -2752,13 +2718,28 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, is_movable = false; } } - else if(getCategory() && getCategory()->getPreferredType() == LLFolderType::FT_NONE) + else if (!getCategory()) { - is_movable = ((inv_cat->getPreferredType() == LLFolderType::FT_NONE) || (inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT)); + is_movable = false; + tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit"); } else { - is_movable = false; + LLFolderType::EType type = getCategory()->getPreferredType(); + if (type == LLFolderType::FT_OUTFIT && inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT) + { + is_movable = false; + tooltip_msg = LLTrans::getString("TooltipCantMoveOutfitIntoOutfit"); + } + else if (can_move_to_my_outfits(model, inv_cat, max_items_to_wear)) + { + is_movable = true; + } + else + { + is_movable = false; + tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit"); + } } } if (is_movable && move_is_into_current_outfit && is_link) @@ -2964,6 +2945,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else { + // or link it? dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_NONE, cb); } } @@ -5435,25 +5417,13 @@ void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer cb) { - LLViewerInventoryCategory* cat = getInventoryModel()->getCategory(dest_id); const LLUUID outfits_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); inventory_func_type func = boost::bind(outfitFolderCreatedCallback, inv_cat->getUUID(), _1, cb, mInventoryPanel); - if (cat && cat->getParentUUID() == outfits_id) - { - getInventoryModel()->createNewCategory(dest_id, - preferred_type, - inv_cat->getName(), - func, - inv_cat->getThumbnailUUID()); - } - else - { - getInventoryModel()->createNewCategory(outfits_id, - preferred_type, - inv_cat->getName(), - func, - inv_cat->getThumbnailUUID()); - } + getInventoryModel()->createNewCategory(dest_id, + preferred_type, + inv_cat->getName(), + func, + inv_cat->getThumbnailUUID()); } void LLFolderBridge::outfitFolderCreatedCallback(LLUUID cat_source_id, -- cgit v1.2.3 From 7dce74fcfb9ca9e6c152eaf33392ff79412ff555 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 10 Apr 2025 22:39:04 +0300 Subject: #3757 Move for subfodlers --- indra/newview/llinventorybridge.cpp | 93 +++++++++++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 14 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2c1c6d22a6..5bd17d4d5b 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2725,12 +2725,23 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else { - LLFolderType::EType type = getCategory()->getPreferredType(); - if (type == LLFolderType::FT_OUTFIT && inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT) + EMyOutfitsSubfolderType dest_res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); + EMyOutfitsSubfolderType inv_res = myoutfit_object_subfolder_type(model, cat_id, my_outifts_id); + if ((dest_res == MY_OUTFITS_OUTFIT || dest_res == MY_OUTFITS_SUBOUTFIT) && inv_res == MY_OUTFITS_OUTFIT) { is_movable = false; tooltip_msg = LLTrans::getString("TooltipCantMoveOutfitIntoOutfit"); } + else if ((dest_res == MY_OUTFITS_OUTFIT || dest_res == MY_OUTFITS_SUBOUTFIT) && inv_res == MY_OUTFITS_SUBFOLDER) + { + is_movable = false; + tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit"); + } + else if (dest_res == MY_OUTFITS_SUBFOLDER && inv_res == MY_OUTFITS_SUBOUTFIT) + { + is_movable = false; + tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit"); + } else if (can_move_to_my_outfits(model, inv_cat, max_items_to_wear)) { is_movable = true; @@ -2931,22 +2942,76 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (mUUID == my_outifts_id) { - // Category can't contains objects, - // create a new folder and populate it with links to original objects - dropToMyOutfits(inv_cat, cb); - } - else if (move_is_into_my_outfits) - { - EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); - if (res == MY_OUTFITS_SUBFOLDER) + EMyOutfitsSubfolderType inv_res = myoutfit_object_subfolder_type(model, cat_id, my_outifts_id); + if (inv_res == MY_OUTFITS_SUBFOLDER || inv_res == MY_OUTFITS_OUTFIT) { - // turn it into outfit - dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_OUTFIT, cb); + LLInvFVBridge::changeCategoryParent( + model, + (LLViewerInventoryCategory*)inv_cat, + mUUID, + false); + if (cb) cb->fire(inv_cat->getUUID()); } else { - // or link it? - dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_NONE, cb); + // Moving from inventory + // create a new folder and populate it with links to original objects + dropToMyOutfits(inv_cat, cb); + } + } + else if (move_is_into_my_outfits) + { + EMyOutfitsSubfolderType dest_res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); + EMyOutfitsSubfolderType inv_res = myoutfit_object_subfolder_type(model, cat_id, my_outifts_id); + switch (inv_res) + { + case MY_OUTFITS_NO: + // Moning from outside outfits into outfits + if (dest_res == MY_OUTFITS_SUBFOLDER) + { + // turn it into outfit + dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_OUTFIT, cb); + } + else + { + // or link it? + dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_NONE, cb); + } + break; + case MY_OUTFITS_SUBFOLDER: + case MY_OUTFITS_OUTFIT: + // only permit moving subfodlers and outfits into other subfolders + if (dest_res == MY_OUTFITS_SUBFOLDER) + { + LLInvFVBridge::changeCategoryParent( + model, + (LLViewerInventoryCategory*)inv_cat, + mUUID, + false); + if (cb) cb->fire(inv_cat->getUUID()); + } + else + { + assert(false); // mot permitted, shouldn't have accepted + } + break; + case MY_OUTFITS_SUBOUTFIT: + if (dest_res == MY_OUTFITS_SUBOUTFIT || dest_res == MY_OUTFITS_OUTFIT) + { + LLInvFVBridge::changeCategoryParent( + model, + (LLViewerInventoryCategory*)inv_cat, + mUUID, + false); + if (cb) cb->fire(inv_cat->getUUID()); + } + else + { + assert(false); // mot permitted, shouldn't have accepted + } + break; + default: + break; } } // if target is current outfit folder we use link -- cgit v1.2.3 From 7d36e7103e4260c8d79d2022bfaacdcebafb75d3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 14 Apr 2025 22:07:11 +0300 Subject: #3757 Disable ability to create folders in individual outfits This part needs a recheck --- indra/newview/llinventorybridge.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 5bd17d4d5b..4018a89c5a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2732,7 +2732,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, is_movable = false; tooltip_msg = LLTrans::getString("TooltipCantMoveOutfitIntoOutfit"); } - else if ((dest_res == MY_OUTFITS_OUTFIT || dest_res == MY_OUTFITS_SUBOUTFIT) && inv_res == MY_OUTFITS_SUBFOLDER) + else if (dest_res == MY_OUTFITS_OUTFIT || dest_res == MY_OUTFITS_SUBOUTFIT) { is_movable = false; tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit"); @@ -4471,7 +4471,6 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items if (cat->getPreferredType() == LLFolderType::FT_OUTFIT) { // Want some but not all of the items from getClipboardEntries for outfits. - items.push_back(std::string("New Outfit Folder")); items.push_back(std::string("Rename")); items.push_back(std::string("thumbnail")); @@ -4496,9 +4495,8 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { // Not inside an outfit, but inside 'my outfits' items.push_back(std::string("New Outfit")); + items.push_back(std::string("New Outfit Folder")); } - - items.push_back(std::string("New Outfit Folder")); items.push_back(std::string("Rename")); items.push_back(std::string("thumbnail")); -- cgit v1.2.3 From 37134720bce619a754ff097aff764d9a44bb0893 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 7 May 2025 22:29:08 +0300 Subject: #3757 Smarter subfolders dragndrop --- indra/newview/llinventorybridge.cpp | 38 +++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4018a89c5a..bff7138282 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2664,6 +2664,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // bool is_movable = true; + bool create_outfit = false; if (is_movable && (marketplacelistings_id == cat_id)) { @@ -2708,7 +2709,12 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, tooltip_msg = LLTrans::getString("TooltipOutfitNotInInventory"); is_movable = false; } - else if (can_move_to_my_outfits(model, inv_cat, max_items_to_wear)) + else if (can_move_to_my_outfits_as_outfit(model, inv_cat, max_items_to_wear)) + { + is_movable = true; + create_outfit = true; + } + else if (can_move_to_my_outfits_as_subfolder(model, inv_cat)) { is_movable = true; } @@ -2742,7 +2748,12 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, is_movable = false; tooltip_msg = LLTrans::getString("TooltipCantCreateOutfit"); } - else if (can_move_to_my_outfits(model, inv_cat, max_items_to_wear)) + else if (can_move_to_my_outfits_as_outfit(model, inv_cat, max_items_to_wear)) + { + is_movable = true; + create_outfit = true; + } + else if (can_move_to_my_outfits_as_subfolder(model, inv_cat)) { is_movable = true; } @@ -2943,7 +2954,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (mUUID == my_outifts_id) { EMyOutfitsSubfolderType inv_res = myoutfit_object_subfolder_type(model, cat_id, my_outifts_id); - if (inv_res == MY_OUTFITS_SUBFOLDER || inv_res == MY_OUTFITS_OUTFIT) + if (inv_res == MY_OUTFITS_SUBFOLDER || inv_res == MY_OUTFITS_OUTFIT || !create_outfit) { LLInvFVBridge::changeCategoryParent( model, @@ -2967,7 +2978,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { case MY_OUTFITS_NO: // Moning from outside outfits into outfits - if (dest_res == MY_OUTFITS_SUBFOLDER) + if (dest_res == MY_OUTFITS_SUBFOLDER && create_outfit) { // turn it into outfit dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_OUTFIT, cb); @@ -4094,7 +4105,6 @@ void LLFolderBridge::perform_pasteFromClipboard() LLInventoryObject *obj = model->getObject(item_id); if (obj) { - if (move_is_into_lost_and_found) { if (LLAssetType::AT_CATEGORY == obj->getType()) @@ -4111,9 +4121,9 @@ void LLFolderBridge::perform_pasteFromClipboard() } else if (move_is_into_my_outfits && LLAssetType::AT_CATEGORY == obj->getType()) { - LLInventoryCategory* cat = model->getCategory(item_id); + LLViewerInventoryCategory* cat = model->getCategory(item_id); U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit"); - if (cat && can_move_to_my_outfits(model, cat, max_items_to_wear)) + if (cat && can_move_to_my_outfits_as_outfit(model, cat, max_items_to_wear)) { if (mUUID == my_outifts_id) { @@ -4133,6 +4143,18 @@ void LLFolderBridge::perform_pasteFromClipboard() } } } + else if (cat && can_move_to_my_outfits_as_subfolder(model, cat)) + { + if (LLClipboard::instance().isCutMode()) + { + changeCategoryParent(model, cat, parent_id, false); + if (cb) cb->fire(item_id); + } + else + { + copy_inventory_category(model, cat, parent_id); + } + } else { LLNotificationsUtil::add("MyOutfitsPasteFailed"); @@ -4181,7 +4203,7 @@ void LLFolderBridge::perform_pasteFromClipboard() // move_inventory_item() is not enough, as we have to update inventory locally too if (LLAssetType::AT_CATEGORY == obj->getType()) { - LLViewerInventoryCategory* vicat = (LLViewerInventoryCategory *) model->getCategory(item_id); + LLViewerInventoryCategory* vicat = model->getCategory(item_id); llassert(vicat); if (vicat) { -- cgit v1.2.3 From e466414be4621906cb4c9cfc5f4a7216ba3670aa Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 12 May 2025 22:07:49 +0300 Subject: #4055 Fix subfolder dragging --- indra/newview/llinventorybridge.cpp | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index bff7138282..e48fe69853 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2981,12 +2981,16 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (dest_res == MY_OUTFITS_SUBFOLDER && create_outfit) { // turn it into outfit - dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_OUTFIT, cb); + dropToMyOutfitsSubfolder(inv_cat, mUUID, cb); } else { - // or link it? - dropToMyOutfitsSubfolder(inv_cat, mUUID, LLFolderType::FT_NONE, cb); + LLInvFVBridge::changeCategoryParent( + model, + (LLViewerInventoryCategory*)inv_cat, + mUUID, + move_is_into_trash); + if (cb) cb->fire(inv_cat->getUUID()); } break; case MY_OUTFITS_SUBFOLDER: @@ -4123,11 +4127,13 @@ void LLFolderBridge::perform_pasteFromClipboard() { LLViewerInventoryCategory* cat = model->getCategory(item_id); U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit"); + bool handled = false; if (cat && can_move_to_my_outfits_as_outfit(model, cat, max_items_to_wear)) { if (mUUID == my_outifts_id) { dropToMyOutfits(cat, cb); + handled = true; } else if (move_is_into_my_outfits) { @@ -4135,27 +4141,26 @@ void LLFolderBridge::perform_pasteFromClipboard() if (res == MY_OUTFITS_SUBFOLDER) { // turn it into outfit - dropToMyOutfitsSubfolder(cat, mUUID, LLFolderType::FT_OUTFIT, cb); - } - else - { - dropToMyOutfitsSubfolder(cat, mUUID, LLFolderType::FT_NONE, cb); + dropToMyOutfitsSubfolder(cat, mUUID, cb); + handled = true; } } } - else if (cat && can_move_to_my_outfits_as_subfolder(model, cat)) + if (!handled && cat && can_move_to_my_outfits_as_subfolder(model, cat)) { if (LLClipboard::instance().isCutMode()) { changeCategoryParent(model, cat, parent_id, false); - if (cb) cb->fire(item_id); } else { copy_inventory_category(model, cat, parent_id); } + if (cb) cb->fire(item_id); + handled = true; } - else + + if (!handled) { LLNotificationsUtil::add("MyOutfitsPasteFailed"); } @@ -5500,12 +5505,11 @@ void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointergetThumbnailUUID()); } -void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLFolderType::EType preferred_type, LLPointer cb) +void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLPointer cb) { - const LLUUID outfits_id = getInventoryModel()->findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); inventory_func_type func = boost::bind(outfitFolderCreatedCallback, inv_cat->getUUID(), _1, cb, mInventoryPanel); getInventoryModel()->createNewCategory(dest_id, - preferred_type, + LLFolderType::FT_OUTFIT, inv_cat->getName(), func, inv_cat->getThumbnailUUID()); -- cgit v1.2.3 From 6225eb8c86049a7ce52dbe092bb31afcbc679609 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 12 May 2025 23:14:22 +0300 Subject: #4060 Fix subfolders use through ctrl-v --- indra/newview/llinventorybridge.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index e48fe69853..279fb3ddf4 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4118,16 +4118,17 @@ void LLFolderBridge::perform_pasteFromClipboard() } if (move_is_into_outfit) { + bool handled = false; if (!move_is_into_my_outfits && item && can_move_to_outfit(item, move_is_into_current_outfit)) { // todo: this is going to create dupplicate folders? dropToOutfit(item, move_is_into_current_outfit, cb); + handled = true; } else if (move_is_into_my_outfits && LLAssetType::AT_CATEGORY == obj->getType()) { LLViewerInventoryCategory* cat = model->getCategory(item_id); U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit"); - bool handled = false; if (cat && can_move_to_my_outfits_as_outfit(model, cat, max_items_to_wear)) { if (mUUID == my_outifts_id) @@ -4135,10 +4136,10 @@ void LLFolderBridge::perform_pasteFromClipboard() dropToMyOutfits(cat, cb); handled = true; } - else if (move_is_into_my_outfits) + else { - EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); - if (res == MY_OUTFITS_SUBFOLDER) + EMyOutfitsSubfolderType dest_res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); + if (dest_res == MY_OUTFITS_SUBFOLDER) { // turn it into outfit dropToMyOutfitsSubfolder(cat, mUUID, cb); @@ -4148,24 +4149,24 @@ void LLFolderBridge::perform_pasteFromClipboard() } if (!handled && cat && can_move_to_my_outfits_as_subfolder(model, cat)) { - if (LLClipboard::instance().isCutMode()) - { - changeCategoryParent(model, cat, parent_id, false); - } - else + EMyOutfitsSubfolderType dest_res = myoutfit_object_subfolder_type(model, mUUID, my_outifts_id); + if (dest_res == MY_OUTFITS_SUBFOLDER || mUUID == my_outifts_id) { - copy_inventory_category(model, cat, parent_id); + if (LLClipboard::instance().isCutMode()) + { + changeCategoryParent(model, cat, parent_id, false); + } + else + { + copy_inventory_category(model, cat, parent_id); + } + if (cb) cb->fire(item_id); + handled = true; } - if (cb) cb->fire(item_id); - handled = true; - } - - if (!handled) - { - LLNotificationsUtil::add("MyOutfitsPasteFailed"); } } - else + + if (!handled) { LLNotificationsUtil::add("MyOutfitsPasteFailed"); } -- cgit v1.2.3 From 32cd3a608805264730933442b1fb8fabfb1603ea Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 May 2025 19:44:47 +0300 Subject: #4071 Permit pasting links into outfits Like it's permitted to drop them --- indra/newview/llinventorybridge.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorybridge.cpp') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 279fb3ddf4..f9e9049119 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4119,9 +4119,11 @@ void LLFolderBridge::perform_pasteFromClipboard() if (move_is_into_outfit) { bool handled = false; - if (!move_is_into_my_outfits && item && can_move_to_outfit(item, move_is_into_current_outfit)) + if (mUUID != my_outifts_id + && dest_folder->getPreferredType() == LLFolderType::FT_OUTFIT + && item + && can_move_to_outfit(item, move_is_into_current_outfit)) { - // todo: this is going to create dupplicate folders? dropToOutfit(item, move_is_into_current_outfit, cb); handled = true; } -- cgit v1.2.3