diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-12-08 23:19:37 +0200 | 
|---|---|---|
| committer | akleshchev <117672381+akleshchev@users.noreply.github.com> | 2023-12-11 23:06:45 +0200 | 
| commit | 3b99af03ca5774bd817c803842eecfc205f77afd (patch) | |
| tree | 6ee67e020487cdef603b0dd4cdb33f1e11abf29f | |
| parent | 01a083ea647c2defcf7eace823f74f85321c97c5 (diff) | |
SL-20672 Item and folder creation support
Moving everything manually doesn't seem like a right way, probably need
to make LLFolderView draw grids and then relace with LLInventoryPanel
| -rw-r--r-- | indra/newview/llinventorybridge.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llinventorygallery.cpp | 33 | ||||
| -rw-r--r-- | indra/newview/llinventorygallery.h | 1 | ||||
| -rw-r--r-- | indra/newview/llinventorygallerymenu.cpp | 73 | ||||
| -rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_gallery_inventory.xml | 228 | 
6 files changed, 325 insertions, 17 deletions
| diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index cb5316ddf4..40e0c66c23 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4359,12 +4359,10 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items  			if (!isInboxFolder() // don't allow creation in inbox  				&& outfits_id != mUUID)  			{ -				bool menu_items_added = false;  				// Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.  				if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat))  				{  					items.push_back(std::string("New Folder")); -					menu_items_added = true;  				}                  if (!isMarketplaceListingsFolder())                  { @@ -4382,10 +4380,6 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t&   items                          disabled_items.push_back("New Settings");                      }                  } -                if (menu_items_added) -                { -                    items.push_back(std::string("Create Separator")); -                }  			}  			getClipboardEntries(false, items, disabled_items, flags);  		} diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 62180bb066..97b82a581c 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -2010,6 +2010,39 @@ void LLInventoryGallery::pasteAsLink(const LLUUID& dest,      }  } +void LLInventoryGallery::doCreate(const LLUUID& dest, const LLSD& userdata) +{ + +    LLViewerInventoryCategory* cat = gInventory.getCategory(dest); +    if (cat && mFolderID != dest) +    { +        menu_create_inventory_item(NULL, dest, userdata, LLUUID::null); +    } +    else +    { +        // todo: needs to reset current floater's filter, +        // like reset_inventory_filter() + +        LLHandle<LLPanel> handle = getHandle(); +        std::function<void(const LLUUID&)> callback_cat_created = +            [handle](const LLUUID& new_id) +            { +                gInventory.notifyObservers(); +                LLInventoryGallery* panel = static_cast<LLInventoryGallery*>(handle.get()); +                if (panel && new_id.notNull()) +                { +                    panel->clearSelection(); +                    if (panel->mItemMap.count(new_id) != 0) +                    { +                        panel->addItemSelection(new_id, true); +                    } +                } +            }; + +        menu_create_inventory_item(NULL, mFolderID, userdata, LLUUID::null, callback_cat_created); +    } +} +  void LLInventoryGallery::claimEditHandler()  {      gEditMenuHandler = this; diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 9b3f12701f..95df9eeb69 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -165,6 +165,7 @@ public:      void deleteSelection();      bool canDeleteSelection();      void pasteAsLink(); +    void doCreate(const LLUUID& dest, const LLSD& userdata);      void setSortOrder(U32 order, bool update = false);      U32 getSortOrder() { return mSortOrder; }; diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 647f3c9ec4..def66c8968 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -32,9 +32,11 @@  #include "llappearancemgr.h"  #include "llavataractions.h"  #include "llclipboard.h" +#include "llenvironment.h"  #include "llfloaterreg.h"  #include "llfloatersidepanelcontainer.h"  #include "llfloaterworldmap.h" +#include "llfriendcard.h"  #include "llinventorybridge.h"  #include "llinventoryfunctions.h"  #include "llinventorymodel.h" @@ -57,11 +59,33 @@ LLContextMenu* LLInventoryGalleryContextMenu::createMenu()      registrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::fileUploadLocation, this, _2));      registrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH));      registrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLFolderType::FT_LOST_AND_FOUND)); +    registrar.add("Inventory.DoCreate", [this](LLUICtrl*, const LLSD& data) +                          { +                              if (mRootFolder) +                              { +                                  mGallery->doCreate(mGallery->getRootFolder(), data); +                              } +                              else +                              { +                                  mGallery->doCreate(mUUIDs.front(), data); +                              } +                          });      std::set<LLUUID> uuids(mUUIDs.begin(), mUUIDs.end());      registrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, uuids, gFloaterView->getParentFloater(mGallery)));      enable_registrar.add("Inventory.CanSetUploadLocation", boost::bind(&LLInventoryGalleryContextMenu::canSetUploadLocation, this, _2)); +    enable_registrar.add("Inventory.EnvironmentEnabled", [](LLUICtrl*, const LLSD&) +                         { +                             return LLEnvironment::instance().isInventoryEnabled(); +                         }); +    enable_registrar.add("Inventory.MaterialsEnabled", [](LLUICtrl*, const LLSD&) +                         { +                             std::string agent_url = gAgent.getRegionCapability("UpdateMaterialAgentInventory"); +                             std::string task_url = gAgent.getRegionCapability("UpdateMaterialTaskInventory"); + +                             return (!agent_url.empty() && !task_url.empty()); +                         });      LLContextMenu* menu = createFromFile("menu_gallery_inventory.xml"); @@ -495,6 +519,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men      bool is_in_trash = gInventory.isObjectDescendentOf(selected_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH));      bool is_lost_and_found = (selected_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND));      bool is_outfits= (selected_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS)); +    bool is_in_favorites = gInventory.isObjectDescendentOf(selected_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE));      //bool is_favorites= (selected_id == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE));      bool is_system_folder = false; @@ -589,11 +614,30 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men      }      else      { +        if (is_agent_inventory && !is_inbox && !is_cof && !is_in_favorites && !is_outfits) +        { +            LLViewerInventoryCategory* category = gInventory.getCategory(selected_id); +            if (!category || !LLFriendCardsManager::instance().isCategoryInFriendFolder(category)) +            { +                items.push_back(std::string("New Folder")); +            } + +            items.push_back(std::string("create_new")); +            items.push_back(std::string("New Script")); +            items.push_back(std::string("New Note")); +            items.push_back(std::string("New Gesture")); +            items.push_back(std::string("New Material")); +            items.push_back(std::string("New Clothes")); +            items.push_back(std::string("New Body Parts")); +            items.push_back(std::string("New Settings")); +        } +          if(can_share_item(selected_id))          {              items.push_back(std::string("Share"));          } -        if (LLClipboard::instance().hasContents() && is_agent_inventory && !is_cof && !is_inbox_folder(selected_id)) + +        if (LLClipboard::instance().hasContents() && is_agent_inventory && !is_cof && !is_inbox)          {              items.push_back(std::string("Paste")); @@ -605,7 +649,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men          }          if (is_folder && is_agent_inventory)          { -            if (!is_cof && (folder_type != LLFolderType::FT_OUTFIT) && !is_outfits && !is_inbox_folder(selected_id)) +            if (!is_cof && (folder_type != LLFolderType::FT_OUTFIT) && !is_outfits && !is_inbox)              {                  if (!gInventory.isObjectDescendentOf(selected_id, gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD)) && !isRootFolder())                  { @@ -792,6 +836,17 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men              disabled_items.push_back(std::string("New Folder"));              disabled_items.push_back(std::string("upload_def")); +            disabled_items.push_back(std::string("create_new")); +        } + +        if (is_agent_inventory && !mRootFolder) +        { +            items.push_back(std::string("New folder from selected")); +            items.push_back(std::string("Subfolder Separator")); +            if (!is_only_items_selected(mUUIDs) && !is_only_cats_selected(mUUIDs)) +            { +                disabled_items.push_back(std::string("New folder from selected")); +            }          }          // Marketplace @@ -809,16 +864,12 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men                      can_list = true;                  }              } -            else +            else if (selected_item +                     && selected_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()) +                     && selected_item->getPermissions().getOwner() != ALEXANDRIA_LINDEN_ID +                     && LLAssetType::AT_CALLINGCARD != selected_item->getType())              { -                LLViewerInventoryItem* item = gInventory.getItem(selected_id); -                if (item -                    && item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()) -                    && item->getPermissions().getOwner() != ALEXANDRIA_LINDEN_ID -                    && LLAssetType::AT_CALLINGCARD != item->getType()) -                { -                    can_list = true; -                } +                can_list = true;              }          } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 20241aac24..a5a768776a 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -56,6 +56,7 @@  #include "lltrans.h"  #include "llviewermenu.h"  #include "llviewertexturelist.h" +#include "llviewerinventory.h"  #include "llsidepanelinventory.h"  #include "llfolderview.h"  #include "llradiogroup.h" diff --git a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml index d82c453e5f..feaba45cf8 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -426,6 +426,234 @@    <menu_item_separator     layout="topleft"     name="Subfolder Separator" /> +  <menu +   label="Create new" +   layout="topleft" +   name="create_new"> +      <menu_item_call +       label="New Folder" +       layout="topleft" +       name="New Folder"> +          <menu_item_call.on_click +           function="Inventory.DoCreate" +           parameter="category" /> +      </menu_item_call> +      <menu_item_call +       label="New Script" +       layout="topleft" +       name="New Script"> +          <menu_item_call.on_click +           function="Inventory.DoCreate" +           parameter="lsl" /> +      </menu_item_call> +      <menu_item_call +       label="New Notecard" +       layout="topleft" +       name="New Note"> +          <menu_item_call.on_click +           function="Inventory.DoCreate" +           parameter="notecard" /> +      </menu_item_call> +      <menu_item_call +       label="New Gesture" +       layout="topleft" +       name="New Gesture"> +          <menu_item_call.on_click +           function="Inventory.DoCreate" +           parameter="gesture" /> +      </menu_item_call> +      <menu_item_call +       label="New Material" +       layout="topleft" +       name="New Material"> +          <menu_item_call.on_click +           function="Inventory.DoCreate" +           parameter="material" /> +          <menu_item_call.on_enable +           function="Inventory.MaterialsEnabled" /> +      </menu_item_call> +      <menu +       label="New Clothes" +       layout="topleft" +       name="New Clothes"> +          <menu_item_call +           label="New Shirt" +           layout="topleft" +           name="New Shirt"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="shirt" /> +          </menu_item_call> +          <menu_item_call +           label="New Pants" +           layout="topleft" +           name="New Pants"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="pants" /> +          </menu_item_call> +          <menu_item_call +           label="New Shoes" +           layout="topleft" +           name="New Shoes"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="shoes" /> +          </menu_item_call> +          <menu_item_call +           label="New Socks" +           layout="topleft" +           name="New Socks"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="socks" /> +          </menu_item_call> +          <menu_item_call +           label="New Jacket" +           layout="topleft" +           name="New Jacket"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="jacket" /> +          </menu_item_call> +          <menu_item_call +           label="New Skirt" +           layout="topleft" +           name="New Skirt"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="skirt" /> +          </menu_item_call> +          <menu_item_call +           label="New Gloves" +           layout="topleft" +           name="New Gloves"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="gloves" /> +          </menu_item_call> +          <menu_item_call +           label="New Undershirt" +           layout="topleft" +           name="New Undershirt"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="undershirt" /> +          </menu_item_call> +          <menu_item_call +           label="New Underpants" +           layout="topleft" +           name="New Underpants"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="underpants" /> +          </menu_item_call> +          <menu_item_call +           label="New Alpha Mask" +           layout="topleft" +           name="New Alpha Mask"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="alpha" /> +            </menu_item_call> +          <menu_item_call +           label="New Tattoo" +           layout="topleft" +           name="New Tattoo"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="tattoo" /> +          </menu_item_call> +          <menu_item_call +           label="New Universal" +           layout="topleft" +           name="New Universal"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="universal" /> +          </menu_item_call> +          <menu_item_call +           label="New Physics" +           layout="topleft" +           name="New Physics"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="physics" /> +          </menu_item_call> +      </menu> +      <menu +       label="New Body Parts" +       layout="topleft" +       name="New Body Parts"> +          <menu_item_call +           label="New Shape" +           layout="topleft" +           name="New Shape"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="shape" /> +          </menu_item_call> +          <menu_item_call +           label="New Skin" +           layout="topleft" +           name="New Skin"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="skin" /> +          </menu_item_call> +          <menu_item_call +           label="New Hair" +           layout="topleft" +           name="New Hair"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="hair" /> +          </menu_item_call> +          <menu_item_call +           label="New Eyes" +           layout="topleft" +           name="New Eyes"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="eyes" /> +          </menu_item_call> +      </menu> +      <menu +       label="New Settings" +       layout="topleft" +       name="New Settings"> +          <menu_item_call +           label="New Sky" +           layout="topleft" +           name="New Sky"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="sky"/> +              <menu_item_call.on_enable +               function="Inventory.EnvironmentEnabled" /> +          </menu_item_call> +          <menu_item_call +           label="New Water" +           layout="topleft" +           name="New Water"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="water"/> +              <menu_item_call.on_enable +               function="Inventory.EnvironmentEnabled" /> +          </menu_item_call> +          <menu_item_call +           label="New Day Cycle" +           layout="topleft" +           name="New Day Cycle"> +              <menu_item_call.on_click +               function="Inventory.DoCreate" +               parameter="daycycle"/> +              <menu_item_call.on_enable +               function="Inventory.EnvironmentEnabled" /> +          </menu_item_call> +      </menu> +  </menu>    <menu_item_call     label="Create folder from selected"     layout="topleft" | 
