#3757 Move for subfodlers

master
Andrey Kleshchev 2025-04-10 22:39:04 +03:00 committed by Andrey Kleshchev
parent 2371994a88
commit 7dce74fcfb
5 changed files with 158 additions and 29 deletions

View File

@ -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

View File

@ -2502,11 +2502,15 @@ EMyOutfitsSubfolderType myoutfit_object_subfolder_type(
if (obj_id == my_outfits_id) return MY_OUTFITS_NO;
const LLViewerInventoryCategory* test_cat = model->getCategory(obj_id);
if (test_cat->getPreferredType() == LLFolderType::FT_OUTFIT)
{
return MY_OUTFITS_OUTFIT;
}
while (test_cat)
{
if (test_cat->getPreferredType() == LLFolderType::FT_OUTFIT)
{
return MY_OUTFITS_OUTFIT;
return MY_OUTFITS_SUBOUTFIT;
}
const LLUUID& parent_id = test_cat->getParentUUID();

View File

@ -126,6 +126,7 @@ enum EMyOutfitsSubfolderType
MY_OUTFITS_NO,
MY_OUTFITS_SUBFOLDER,
MY_OUTFITS_OUTFIT,
MY_OUTFITS_SUBOUTFIT,
};
EMyOutfitsSubfolderType myoutfit_object_subfolder_type(
LLInventoryModel* model,

View File

@ -3776,12 +3776,23 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
}
else
{
LLFolderType::EType type = dest_cat->getPreferredType();
if (type == LLFolderType::FT_OUTFIT && inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT)
EMyOutfitsSubfolderType dest_res = myoutfit_object_subfolder_type(model, dest_id, 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;
@ -3916,21 +3927,69 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
if (dest_id == my_outifts_id)
{
// Category can contains objects,
// create a new folder and populate it with links to original objects
dropToMyOutfits(inv_cat);
}
else if (move_is_into_my_outfits)
{
EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(model, dest_id, 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, dest_id, LLFolderType::FT_OUTFIT);
gInventory.changeCategoryParent(
(LLViewerInventoryCategory*)inv_cat,
dest_id,
move_is_into_trash);
}
else
{
dropToMyOutfitsSubfolder(inv_cat, dest_id, LLFolderType::FT_NONE);
// Category can contains objects,
// create a new folder and populate it with links to original objects
dropToMyOutfits(inv_cat);
}
}
else if (move_is_into_my_outfits)
{
EMyOutfitsSubfolderType dest_res = myoutfit_object_subfolder_type(model, dest_id, 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, dest_id, LLFolderType::FT_OUTFIT);
}
else
{
dropToMyOutfitsSubfolder(inv_cat, dest_id, LLFolderType::FT_NONE);
}
break;
case MY_OUTFITS_SUBFOLDER:
case MY_OUTFITS_OUTFIT:
// only permit moving subfodlers and outfits into other subfolders
if (dest_res == MY_OUTFITS_SUBFOLDER)
{
gInventory.changeCategoryParent(
(LLViewerInventoryCategory*)inv_cat,
dest_id,
move_is_into_trash);
}
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)
{
gInventory.changeCategoryParent(
(LLViewerInventoryCategory*)inv_cat,
dest_id,
move_is_into_trash);
}
else
{
assert(false); // mot permitted, shouldn't have accepted
}
break;
default:
break;
}
}
// if target is current outfit folder we use link

View File

@ -774,7 +774,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
if(is_outfits)
{
EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(&gInventory, selected_id, my_outfits);
if (res == MY_OUTFITS_OUTFIT)
if (res != MY_OUTFITS_OUTFIT && res != MY_OUTFITS_SUBOUTFIT)
{
items.push_back(std::string("New Outfit"));
}