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