#3757 Menu for subfodlers in outfits p2

master
Andrey Kleshchev 2025-04-09 21:35:40 +03:00 committed by Andrey Kleshchev
parent 1c90421b88
commit 2371994a88
6 changed files with 109 additions and 104 deletions

View File

@ -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<LLI
void LLFolderBridge::dropToMyOutfitsSubfolder(LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLFolderType::EType preferred_type, LLPointer<LLInventoryCallback> 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,

View File

@ -2493,6 +2493,36 @@ bool can_share_item(const LLUUID& item_id)
return can_share;
}
EMyOutfitsSubfolderType myoutfit_object_subfolder_type(
LLInventoryModel* model,
const LLUUID& obj_id,
const LLUUID& my_outfits_id)
{
if (obj_id == my_outfits_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 == my_outfits_id)
{
return MY_OUTFITS_SUBFOLDER;
}
test_cat = model->getCategory(parent_id);
}
return MY_OUTFITS_NO;
}
///----------------------------------------------------------------------------
/// LLMarketplaceValidator implementations
///----------------------------------------------------------------------------

View File

@ -121,6 +121,17 @@ std::string get_searchable_creator_name(LLInventoryModel* model, const LLUUID& i
std::string get_searchable_UUID(LLInventoryModel* model, const LLUUID& item_id);
bool can_share_item(const LLUUID& item_id);
enum EMyOutfitsSubfolderType
{
MY_OUTFITS_NO,
MY_OUTFITS_SUBFOLDER,
MY_OUTFITS_OUTFIT,
};
EMyOutfitsSubfolderType myoutfit_object_subfolder_type(
LLInventoryModel* model,
const LLUUID& obj_id,
const LLUUID& my_outfits_id);
/** Miscellaneous global functions
** **
*******************************************************************************/

View File

@ -61,43 +61,6 @@ const S32 GALLERY_ITEMS_PER_ROW_MIN = 2;
const S32 FAST_LOAD_THUMBNAIL_TRSHOLD = 50; // load folders below this value immediately
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;
}
}
// Helper dnd functions
bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, bool drop, std::string& tooltip_msg, bool is_link);
bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, std::string& tooltip_msg, bool user_confirm);
@ -3784,7 +3747,12 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
U32 max_items_to_wear = gSavedSettings.getU32("WearFolderLimit");
if (is_movable && move_is_into_outfit)
{
if (dest_id == 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 (dest_id == my_outifts_id)
{
if (source != LLToolDragAndDrop::SOURCE_AGENT || move_is_from_marketplacelistings)
{
@ -3801,13 +3769,28 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat,
is_movable = false;
}
}
else if (dest_cat && dest_cat->getPreferredType() == LLFolderType::FT_NONE)
else if (!dest_cat)
{
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 = dest_cat->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)

View File

@ -771,14 +771,24 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
items.push_back(std::string("upload_def"));
}
if(is_outfits && !isRootFolder())
if(is_outfits)
{
EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type(&gInventory, selected_id, my_outfits);
if (res == MY_OUTFITS_OUTFIT)
{
items.push_back(std::string("New Outfit"));
}
items.push_back(std::string("New Outfit Folder"));
items.push_back(std::string("New Outfit"));
items.push_back(std::string("Delete"));
items.push_back(std::string("Rename"));
if (!get_is_category_and_children_removable(&gInventory, selected_id, false))
{
disabled_items.push_back(std::string("Delete"));
}
}
items.push_back(std::string("Subfolder Separator"));
if (!is_system_folder && !isRootFolder())
if (!is_system_folder && !isRootFolder() && !is_outfits)
{
if(has_children && (folder_type != LLFolderType::FT_OUTFIT) && !is_in_outfits)
{

View File

@ -258,6 +258,7 @@ If you feel this is an error, please contact support@secondlife.com</string>
<string name="TooltipOutboxMixedStock">All items in a stock folder must have the same type and permission</string>
<string name="TooltipOutfitNotInInventory">You can only put items or outfits from your personal inventory into "My outfits"</string>
<string name="TooltipCantCreateOutfit">One or more items can't be used inside "My outfits"</string>
<string name="TooltipCantMoveOutfitIntoOutfit">Can not move an outfit into another outfit</string>
<string name="TooltipDragOntoOwnChild">You can't move a folder into its child</string>
<string name="TooltipDragOntoSelf">You can't move a folder into itself</string>