summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryfunctions.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2025-05-07 22:29:08 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-05-08 18:46:33 +0300
commit37134720bce619a754ff097aff764d9a44bb0893 (patch)
treefdde1922360f0d42ab1c660eaecfc04e56c1a66f /indra/newview/llinventoryfunctions.cpp
parent50108bf0b7953e1f44a13b0790fe8dd8e9f7d2ca (diff)
#3757 Smarter subfolders dragndrop
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r--indra/newview/llinventoryfunctions.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 7fff88fba7..9967318e92 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -2314,7 +2314,7 @@ bool can_move_to_landmarks(LLInventoryItem* inv_item)
}
// Returns true if folder's content can be moved to Current Outfit or any outfit folder.
-bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_cat, U32 wear_limit)
+bool can_move_to_my_outfits_as_outfit(LLInventoryModel* model, LLInventoryCategory* inv_cat, U32 wear_limit)
{
LLInventoryModel::cat_array_t *cats;
LLInventoryModel::item_array_t *items;
@@ -2353,6 +2353,45 @@ bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_ca
return true;
}
+bool can_move_to_my_outfits_as_subfolder(LLInventoryModel* model, LLInventoryCategory* inv_cat, S32 depth)
+{
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
+ model->getDirectDescendentsOf(inv_cat->getUUID(), cats, items);
+
+ if (items->size() > 0)
+ {
+ // subfolders don't allow items
+ return false;
+ }
+
+ constexpr size_t MAX_CONTENT = 255;
+ if (cats->size() > MAX_CONTENT)
+ {
+ // don't allow massive folders
+ return false;
+ }
+
+ for (LLPointer<LLViewerInventoryCategory>& cat : *cats)
+ {
+ // outfits are valid to move, check non-outfit folders
+ if (cat->getPreferredType() != LLFolderType::FT_OUTFIT)
+ {
+ if (depth == 3)
+ {
+ // don't allow massive folders
+ return false;
+ }
+ if (!can_move_to_my_outfits_as_subfolder(model, cat, depth + 1))
+ {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
std::string get_localized_folder_name(LLUUID cat_uuid)
{
std::string localized_root_name;