@@ -105,6 +105,44 @@ static bool check_item(const LLUUID& item_id,
105
105
106
106
// Helper functions
107
107
108
+
109
+ namespace {
110
+ enum EMyOutfitsSubfolderType
111
+ {
112
+ MY_OUTFITS_NO,
113
+ MY_OUTFITS_SUBFOLDER,
114
+ MY_OUTFITS_OUTFIT,
115
+ };
116
+
117
+ EMyOutfitsSubfolderType myoutfit_object_subfolder_type (LLInventoryModel* model, const LLUUID& obj_id,
118
+ const LLUUID& cat_id)
119
+ {
120
+ if (obj_id == cat_id) return MY_OUTFITS_NO;
121
+
122
+ const LLViewerInventoryCategory* test_cat = model->getCategory (obj_id);
123
+ while (test_cat)
124
+ {
125
+ if (test_cat->getPreferredType () == LLFolderType::FT_OUTFIT)
126
+ {
127
+ return MY_OUTFITS_OUTFIT;
128
+ }
129
+
130
+ const LLUUID& parent_id = test_cat->getParentUUID ();
131
+ if (parent_id.isNull ())
132
+ {
133
+ return MY_OUTFITS_NO;
134
+ }
135
+ if (parent_id == cat_id)
136
+ {
137
+ return MY_OUTFITS_SUBFOLDER;
138
+ }
139
+ test_cat = model->getCategory (parent_id);
140
+ }
141
+
142
+ return MY_OUTFITS_NO;
143
+ }
144
+ }
145
+
108
146
bool isAddAction (const std::string& action)
109
147
{
110
148
return (" wear" == action || " attach" == action || " activate" == action);
@@ -2912,13 +2950,22 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
2912
2950
2913
2951
if (mUUID == my_outifts_id)
2914
2952
{
2915
- // Category can contains objects,
2953
+ // Category can't contains objects,
2916
2954
// create a new folder and populate it with links to original objects
2917
2955
dropToMyOutfits (inv_cat, cb);
2918
2956
}
2919
- else if (getCategory () && getCategory ()-> getParentUUID () == my_outifts_id )
2957
+ else if (move_is_into_my_outfits )
2920
2958
{
2921
- dropToMyOutfitsSubfolder (inv_cat, mUUID , cb);
2959
+ EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type (model, mUUID , my_outifts_id);
2960
+ if (res == MY_OUTFITS_SUBFOLDER)
2961
+ {
2962
+ // turn it into outfit
2963
+ dropToMyOutfitsSubfolder (inv_cat, mUUID , LLFolderType::FT_OUTFIT, cb);
2964
+ }
2965
+ else
2966
+ {
2967
+ dropToMyOutfitsSubfolder (inv_cat, mUUID , LLFolderType::FT_NONE, cb);
2968
+ }
2922
2969
}
2923
2970
// if target is current outfit folder we use link
2924
2971
else if (move_is_into_current_outfit &&
@@ -4012,6 +4059,7 @@ void LLFolderBridge::perform_pasteFromClipboard()
4012
4059
{
4013
4060
if (!move_is_into_my_outfits && item && can_move_to_outfit (item, move_is_into_current_outfit))
4014
4061
{
4062
+ // todo: this is going to create dupplicate folders?
4015
4063
dropToOutfit (item, move_is_into_current_outfit, cb);
4016
4064
}
4017
4065
else if (move_is_into_my_outfits && LLAssetType::AT_CATEGORY == obj->getType ())
@@ -4024,9 +4072,18 @@ void LLFolderBridge::perform_pasteFromClipboard()
4024
4072
{
4025
4073
dropToMyOutfits (cat, cb);
4026
4074
}
4027
- else if (getCategory () && getCategory ()-> getParentUUID () == mUUID )
4075
+ else if (move_is_into_my_outfits )
4028
4076
{
4029
- dropToMyOutfitsSubfolder (cat, mUUID , cb);
4077
+ EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type (model, mUUID , my_outifts_id);
4078
+ if (res == MY_OUTFITS_SUBFOLDER)
4079
+ {
4080
+ // turn it into outfit
4081
+ dropToMyOutfitsSubfolder (cat, mUUID , LLFolderType::FT_OUTFIT, cb);
4082
+ }
4083
+ else
4084
+ {
4085
+ dropToMyOutfitsSubfolder (cat, mUUID , LLFolderType::FT_NONE, cb);
4086
+ }
4030
4087
}
4031
4088
}
4032
4089
else
@@ -4361,63 +4418,85 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
4361
4418
else if (isAgentInventory ()) // do not allow creating in library
4362
4419
{
4363
4420
LLViewerInventoryCategory *cat = getCategory ();
4364
- // BAP removed protected check to re-enable standard ops in untyped folders.
4365
- // Not sure what the right thing is to do here.
4366
- if (!isCOFFolder () && cat && (cat->getPreferredType () != LLFolderType::FT_OUTFIT))
4367
- {
4368
- if (!isInboxFolder () // don't allow creation in inbox
4369
- && outfits_id != mUUID )
4370
- {
4371
- bool menu_items_added = false ;
4372
- // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.
4373
- if (!LLFriendCardsManager::instance ().isCategoryInFriendFolder (cat))
4374
- {
4375
- items.push_back (std::string (" New Folder" ));
4376
- menu_items_added = true ;
4377
- }
4378
- if (!isMarketplaceListingsFolder ())
4379
- {
4380
- items.push_back (std::string (" upload_def" ));
4381
- items.push_back (std::string (" create_new" ));
4382
- items.push_back (std::string (" New Script" ));
4383
- items.push_back (std::string (" New Note" ));
4384
- items.push_back (std::string (" New Gesture" ));
4385
- items.push_back (std::string (" New Material" ));
4386
- items.push_back (std::string (" New Clothes" ));
4387
- items.push_back (std::string (" New Body Parts" ));
4388
- items.push_back (std::string (" New Settings" ));
4389
- if (!LLEnvironment::instance ().isInventoryEnabled ())
4390
- {
4391
- disabled_items.push_back (" New Settings" );
4392
- }
4393
- }
4394
- else
4395
- {
4396
- items.push_back (std::string (" New Listing Folder" ));
4397
- }
4398
- if (menu_items_added)
4399
- {
4400
- items.push_back (std::string (" Create Separator" ));
4401
- }
4402
- }
4403
- getClipboardEntries (false , items, disabled_items, flags);
4404
- }
4405
- else
4421
+
4422
+ if (cat)
4406
4423
{
4407
- // Want some but not all of the items from getClipboardEntries for outfits.
4408
- if (cat && (cat->getPreferredType () == LLFolderType::FT_OUTFIT))
4424
+ if (cat->getPreferredType () == LLFolderType::FT_OUTFIT)
4409
4425
{
4426
+ // Want some but not all of the items from getClipboardEntries for outfits.
4427
+ items.push_back (std::string (" New Outfit Folder" ));
4410
4428
items.push_back (std::string (" Rename" ));
4411
4429
items.push_back (std::string (" thumbnail" ));
4412
4430
4413
4431
addDeleteContextMenuOptions (items, disabled_items);
4414
4432
// EXT-4030: disallow deletion of currently worn outfit
4415
- const LLViewerInventoryItem * base_outfit_link = LLAppearanceMgr::instance ().getBaseOutfitLink ();
4433
+ const LLViewerInventoryItem* base_outfit_link = LLAppearanceMgr::instance ().getBaseOutfitLink ();
4416
4434
if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory ()))
4417
4435
{
4418
4436
disabled_items.push_back (std::string (" Delete" ));
4419
4437
}
4420
4438
}
4439
+ else if (outfits_id == mUUID )
4440
+ {
4441
+ getClipboardEntries (false , items, disabled_items, flags);
4442
+ }
4443
+ else if (!isCOFFolder ())
4444
+ {
4445
+ EMyOutfitsSubfolderType in_my_outfits = myoutfit_object_subfolder_type (model, mUUID , outfits_id);
4446
+ if (in_my_outfits != MY_OUTFITS_NO)
4447
+ {
4448
+ if (in_my_outfits == MY_OUTFITS_SUBFOLDER)
4449
+ {
4450
+ // Not inside an outfit, but inside 'my outfits'
4451
+ items.push_back (std::string (" New Outfit" ));
4452
+ }
4453
+
4454
+ items.push_back (std::string (" New Outfit Folder" ));
4455
+ items.push_back (std::string (" Rename" ));
4456
+ items.push_back (std::string (" thumbnail" ));
4457
+
4458
+ addDeleteContextMenuOptions (items, disabled_items);
4459
+ }
4460
+ else
4461
+ {
4462
+ if (!isInboxFolder () // don't allow creation in inbox
4463
+ && outfits_id != mUUID )
4464
+ {
4465
+ bool menu_items_added = false ;
4466
+ // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.
4467
+ if (!LLFriendCardsManager::instance ().isCategoryInFriendFolder (cat))
4468
+ {
4469
+ items.push_back (std::string (" New Folder" ));
4470
+ menu_items_added = true ;
4471
+ }
4472
+ if (!isMarketplaceListingsFolder ())
4473
+ {
4474
+ items.push_back (std::string (" upload_def" ));
4475
+ items.push_back (std::string (" create_new" ));
4476
+ items.push_back (std::string (" New Script" ));
4477
+ items.push_back (std::string (" New Note" ));
4478
+ items.push_back (std::string (" New Gesture" ));
4479
+ items.push_back (std::string (" New Material" ));
4480
+ items.push_back (std::string (" New Clothes" ));
4481
+ items.push_back (std::string (" New Body Parts" ));
4482
+ items.push_back (std::string (" New Settings" ));
4483
+ if (!LLEnvironment::instance ().isInventoryEnabled ())
4484
+ {
4485
+ disabled_items.push_back (" New Settings" );
4486
+ }
4487
+ }
4488
+ else
4489
+ {
4490
+ items.push_back (std::string (" New Listing Folder" ));
4491
+ }
4492
+ if (menu_items_added)
4493
+ {
4494
+ items.push_back (std::string (" Create Separator" ));
4495
+ }
4496
+ }
4497
+ getClipboardEntries (false , items, disabled_items, flags);
4498
+ }
4499
+ }
4421
4500
}
4422
4501
4423
4502
if (model->findCategoryUUIDForType (LLFolderType::FT_CURRENT_OUTFIT) == mUUID )
@@ -4570,7 +4649,11 @@ void LLFolderBridge::buildContextMenuFolderOptions(U32 flags, menuentry_vec_t&
4570
4649
4571
4650
if (((flags & ITEM_IN_MULTI_SELECTION) == 0 ) && hasChildren () && (type != LLFolderType::FT_OUTFIT))
4572
4651
{
4573
- items.push_back (std::string (" Ungroup folder items" ));
4652
+ const LLUUID my_outfits = gInventory .findCategoryUUIDForType (LLFolderType::FT_MY_OUTFITS);
4653
+ if (!gInventory .isObjectDescendentOf (mUUID , my_outfits))
4654
+ {
4655
+ items.push_back (std::string (" Ungroup folder items" ));
4656
+ }
4574
4657
}
4575
4658
}
4576
4659
else
@@ -5350,23 +5433,23 @@ void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer<LLI
5350
5433
inv_cat->getThumbnailUUID ());
5351
5434
}
5352
5435
5353
- void LLFolderBridge::dropToMyOutfitsSubfolder (LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLPointer<LLInventoryCallback> cb)
5436
+ void LLFolderBridge::dropToMyOutfitsSubfolder (LLInventoryCategory* inv_cat, const LLUUID& dest_id, LLFolderType::EType preferred_type, LLPointer<LLInventoryCallback> cb)
5354
5437
{
5355
5438
LLViewerInventoryCategory* cat = getInventoryModel ()->getCategory (dest_id);
5356
5439
const LLUUID outfits_id = getInventoryModel ()->findCategoryUUIDForType (LLFolderType::FT_MY_OUTFITS);
5357
5440
inventory_func_type func = boost::bind (outfitFolderCreatedCallback, inv_cat->getUUID (), _1, cb, mInventoryPanel );
5358
5441
if (cat && cat->getParentUUID () == outfits_id)
5359
5442
{
5360
5443
getInventoryModel ()->createNewCategory (dest_id,
5361
- LLFolderType::FT_OUTFIT ,
5444
+ preferred_type ,
5362
5445
inv_cat->getName (),
5363
5446
func,
5364
5447
inv_cat->getThumbnailUUID ());
5365
5448
}
5366
5449
else
5367
5450
{
5368
5451
getInventoryModel ()->createNewCategory (outfits_id,
5369
- LLFolderType::FT_OUTFIT ,
5452
+ preferred_type ,
5370
5453
inv_cat->getName (),
5371
5454
func,
5372
5455
inv_cat->getThumbnailUUID ());
@@ -5476,10 +5559,6 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
5476
5559
const bool move_is_into_favorites = (mUUID == favorites_id);
5477
5560
const bool move_is_into_my_outfits = (mUUID == my_outifts_id) || model->isObjectDescendentOf (mUUID , my_outifts_id);
5478
5561
const bool move_is_into_outfit = move_is_into_my_outfits || (getCategory () && getCategory ()->getPreferredType ()==LLFolderType::FT_OUTFIT);
5479
- const bool move_is_into_my_outfits_subfolder = move_is_into_my_outfits
5480
- && getCategory ()
5481
- && getCategory ()->getParentUUID () == my_outifts_id
5482
- && getCategory ()->getPreferredType () != LLFolderType::FT_OUTFIT;
5483
5562
const bool move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf (mUUID , landmarks_id);
5484
5563
const bool move_is_into_marketplacelistings = model->isObjectDescendentOf (mUUID , marketplacelistings_id);
5485
5564
const bool move_is_from_marketplacelistings = model->isObjectDescendentOf (inv_item->getUUID (), marketplacelistings_id);
@@ -5550,7 +5629,9 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
5550
5629
}
5551
5630
else if (user_confirm && (move_is_into_current_outfit || move_is_into_outfit))
5552
5631
{
5553
- accept = !move_is_into_my_outfits_subfolder && can_move_to_outfit (inv_item, move_is_into_current_outfit);
5632
+ EMyOutfitsSubfolderType res = myoutfit_object_subfolder_type (model, mUUID , my_outifts_id);
5633
+ // don't allow items in my outfits' subfodlers, only in outfits and outfit's subfolders
5634
+ accept = res != MY_OUTFITS_SUBFOLDER && can_move_to_outfit (inv_item, move_is_into_current_outfit);
5554
5635
}
5555
5636
else if (user_confirm && (move_is_into_favorites || move_is_into_landmarks))
5556
5637
{
0 commit comments