diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-04-09 21:35:40 +0300 | 
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-04-11 12:36:48 +0300 | 
| commit | 2371994a88ffeefd07891d00aed18ac226b954a7 (patch) | |
| tree | da5baccbb9cd5ec47cacc4a8ce88477db849d2d3 /indra | |
| parent | 1c90421b8873a2228a845ea2f7f4a80758500aa6 (diff) | |
#3757 Menu for subfodlers in outfits p2
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llinventorybridge.cpp | 90 | ||||
| -rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 30 | ||||
| -rw-r--r-- | indra/newview/llinventoryfunctions.h | 11 | ||||
| -rw-r--r-- | indra/newview/llinventorygallery.cpp | 65 | ||||
| -rw-r--r-- | indra/newview/llinventorygallerymenu.cpp | 16 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 1 | 
6 files changed, 109 insertions, 104 deletions
| diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index fd9d08a26d..2c1c6d22a6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -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, diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index b4299972d9..dc69e0c92e 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -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  ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index b379d625a9..eb3503c5b0 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -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   **                                                                            **   *******************************************************************************/ diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 15bc578c64..d640e04915 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -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) diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 3ef5071c97..68af0cb581 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -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)                  { diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index d909a95b83..7361ad5245 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -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> | 
