diff options
author | Brad Linden <46733234+brad-linden@users.noreply.github.com> | 2024-06-12 17:04:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-12 17:04:34 -0700 |
commit | 100ebbab2437de7f5d124a0d7b8279a7a7b57656 (patch) | |
tree | e8b4200dae16e89698c2f3eadae05634041681a1 /indra/newview/llinventoryfunctions.cpp | |
parent | f5e2708a0fc4e08d3d0a5dc393bbd4bac09e1c55 (diff) | |
parent | ae74ca80692c8bcf157e903033fcfa1778706d64 (diff) |
Merge pull request #1745 from secondlife/project/gltf_development
move project/gltf development to develop
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 207 |
1 files changed, 112 insertions, 95 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 016b0880eb..8471b2cea1 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -91,7 +91,7 @@ #include "llvoavatarself.h" #include "llwearablelist.h" -BOOL LLInventoryState::sWearNewClothing = FALSE; +bool LLInventoryState::sWearNewClothing = false; LLUUID LLInventoryState::sWearNewClothingTransactionID; std::list<LLUUID> LLInventoryAction::sMarketplaceFolders; bool LLInventoryAction::sDeleteConfirmationDisplayed = false; @@ -156,7 +156,7 @@ S32 count_descendants_items(const LLUUID& cat_id) LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_id,cat_array,item_array); - S32 count = item_array->size(); + S32 count = static_cast<S32>(item_array->size()); LLInventoryModel::cat_array_t cat_array_copy = *cat_array; for (LLInventoryModel::cat_array_t::iterator iter = cat_array_copy.begin(); iter != cat_array_copy.end(); iter++) @@ -553,12 +553,12 @@ public: } }; -BOOL get_is_parent_to_worn_item(const LLUUID& id) +bool get_is_parent_to_worn_item(const LLUUID& id) { const LLViewerInventoryCategory* cat = gInventory.getCategory(id); if (!cat) { - return FALSE; + return false; } LLInventoryModel::cat_array_t cats; @@ -585,7 +585,7 @@ BOOL get_is_parent_to_worn_item(const LLUUID& id) if (cat == parent_cat) { - return TRUE; + return true; } parent_id = parent_cat->getParentUUID(); @@ -593,23 +593,23 @@ BOOL get_is_parent_to_worn_item(const LLUUID& id) } } - return FALSE; + return false; } -BOOL get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item) +bool get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item) { if (!item) - return FALSE; + return false; if (item->getIsLinkType() && !gInventory.getItem(item->getLinkedUUID())) { - return FALSE; + return false; } // Consider the item as worn if it has links in COF. if (LLAppearanceMgr::instance().isLinkedInCOF(id)) { - return TRUE; + return true; } switch(item->getType()) @@ -617,55 +617,55 @@ BOOL get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item) case LLAssetType::AT_OBJECT: { if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) - return TRUE; + return true; break; } case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: if(gAgentWearables.isWearingItem(item->getLinkedUUID())) - return TRUE; + return true; break; case LLAssetType::AT_GESTURE: if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID())) - return TRUE; + return true; break; default: break; } - return FALSE; + return false; } -BOOL get_is_item_worn(const LLUUID& id) +bool get_is_item_worn(const LLUUID& id) { const LLViewerInventoryItem* item = gInventory.getItem(id); return get_is_item_worn(id, item); } -BOOL get_is_item_worn(const LLViewerInventoryItem* item) +bool get_is_item_worn(const LLViewerInventoryItem* item) { if (!item) { - return FALSE; + return false; } return get_is_item_worn(item->getUUID(), item); } -BOOL get_can_item_be_worn(const LLUUID& id) +bool get_can_item_be_worn(const LLUUID& id) { const LLViewerInventoryItem* item = gInventory.getItem(id); if (!item) - return FALSE; + return false; if (LLAppearanceMgr::instance().isLinkedInCOF(item->getLinkedUUID())) { // an item having links in COF (i.e. a worn item) - return FALSE; + return false; } if (gInventory.isObjectDescendentOf(id, LLAppearanceMgr::instance().getCOF())) { // a non-link object in COF (should not normally happen) - return FALSE; + return false; } const LLUUID trash_id = gInventory.findCategoryUUIDForType( @@ -685,12 +685,12 @@ BOOL get_can_item_be_worn(const LLUUID& id) if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID())) { // Already being worn - return FALSE; + return false; } else { // Not being worn yet. - return TRUE; + return true; } break; } @@ -699,18 +699,18 @@ BOOL get_can_item_be_worn(const LLUUID& id) if(gAgentWearables.isWearingItem(item->getLinkedUUID())) { // Already being worn - return FALSE; + return false; } else { // Not being worn yet. - return TRUE; + return true; } break; default: break; } - return FALSE; + return false; } bool get_is_item_removable(const LLInventoryModel* model, const LLUUID& id, bool check_worn) @@ -792,7 +792,7 @@ void handle_item_edit(const LLUUID& inv_item_id) } } -BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) +bool get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) { // NOTE: This function doesn't check the folder's children. // See LLFolderBridge::isItemRemovable for a function that does @@ -800,27 +800,27 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) if (!model) { - return FALSE; + return false; } if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID())) { - return FALSE; + return false; } - if (!isAgentAvatarValid()) return FALSE; + if (!isAgentAvatarValid()) return false; const LLInventoryCategory* category = model->getCategory(id); if (!category) { - return FALSE; + return false; } const LLFolderType::EType folder_type = category->getPreferredType(); if (LLFolderType::lookupIsProtectedType(folder_type)) { - return FALSE; + return false; } // Can't delete the outfit that is currently being worn. @@ -829,11 +829,11 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id) const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); if (base_outfit_link && (category == base_outfit_link->getLinkedCategory())) { - return FALSE; + return false; } } - return TRUE; + return true; } bool get_is_category_and_children_removable(LLInventoryModel* model, const LLUUID& folder_id, bool check_worn) @@ -898,11 +898,11 @@ bool get_is_category_and_children_removable(LLInventoryModel* model, const LLUUI return true; } -BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) +bool get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) { if (!model) { - return FALSE; + return false; } LLViewerInventoryCategory* cat = model->getCategory(id); @@ -910,9 +910,9 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) && cat->getOwnerID() == gAgent.getID()) { - return TRUE; + return true; } - return FALSE; + return false; } void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id) @@ -1098,7 +1098,7 @@ S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */) LLInventoryModel::cat_array_t* cat_array; LLInventoryModel::item_array_t* item_array; gInventory.getDirectDescendentsOf(cat_uuid,cat_array,item_array); - return item_array->size(); + return static_cast<S32>(item_array->size()); } // When force_count is true, we do not do any verification of the marketplace status and simply compute @@ -1327,12 +1327,12 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve if (accept) { // If the dest folder is a stock folder, we do not count the incoming items toward the total (stock items are seen as one) - int existing_item_count = (move_in_stock ? 0 : bundle_size); + unsigned int existing_item_count = (move_in_stock ? 0 : bundle_size); // If the dest folder is a stock folder, we do assume that the incoming items are also stock items (they should anyway) - int existing_stock_count = (move_in_stock ? bundle_size : 0); + unsigned int existing_stock_count = (move_in_stock ? bundle_size : 0); - int existing_folder_count = 0; + unsigned int existing_folder_count = 0; // Get the version folder: that's where the counts start from const LLViewerInventoryCategory * version_folder = ((root_folder && (root_folder != dest_folder)) ? gInventory.getFirstDescendantOf(root_folder->getUUID(), dest_folder->getUUID()) : NULL); @@ -1348,11 +1348,11 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve LLInventoryModel::cat_array_t existing_categories; LLInventoryModel::item_array_t existing_items; - gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE); + gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false); existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<S32>(existing_categories.size()); // If the incoming item is a nocopy (stock) item, we need to consider that it will create a stock folder if (!inv_item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && !move_in_stock) @@ -1422,9 +1422,9 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn { LLInventoryModel::cat_array_t descendent_categories; LLInventoryModel::item_array_t descendent_items; - gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, FALSE); + gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, false); - int dragged_folder_count = descendent_categories.size() + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... + int dragged_folder_count = static_cast<int>(descendent_categories.size()) + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong... int dragged_item_count = count_copyable_items(descendent_items) + count_stock_folders(descendent_categories); int dragged_stock_count = count_stock_items(descendent_items); int existing_item_count = 0; @@ -1444,16 +1444,16 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn // Tally the total number of categories and items inside the root folder LLInventoryModel::cat_array_t existing_categories; LLInventoryModel::item_array_t existing_items; - gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE); + gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false); - existing_folder_count += existing_categories.size(); + existing_folder_count += static_cast<int>(existing_categories.size()); existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories); existing_stock_count += count_stock_items(existing_items); } - const int total_folder_count = existing_folder_count + dragged_folder_count; - const int total_item_count = existing_item_count + dragged_item_count; - const int total_stock_count = existing_stock_count + dragged_stock_count; + const unsigned int total_folder_count = existing_folder_count + dragged_folder_count; + const unsigned int total_item_count = existing_item_count + dragged_item_count; + const unsigned int total_stock_count = existing_stock_count + dragged_stock_count; if (total_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount")) { @@ -1876,7 +1876,7 @@ void validate_marketplacelistings( } // How many types of items? Which type is it if only one? - S32 count = items_vector.size(); + auto count = items_vector.size(); U32 default_key = (U32)(LLInventoryType::IT_COUNT) << 24; // This is the key for any normal copyable item U32 unique_key = (count == 1 ? items_vector.begin()->first : default_key); // The key in the case of one item type only @@ -2159,7 +2159,7 @@ void change_item_parent(const LLUUID& item_id, const LLUUID& new_parent_id) LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); new_item->setParent(new_parent_id); - new_item->updateParentOnServer(FALSE); + new_item->updateParentOnServer(false); gInventory.updateItem(new_item); gInventory.notifyObservers(); } @@ -2199,7 +2199,7 @@ void move_items_to_folder(const LLUUID& new_cat_uuid, const uuid_vec_t& selected LLFolderViewItem* fv_folder = sidepanel_inventory->getActivePanel()->getItemByID(new_cat_uuid); if (fv_folder) { - fv_folder->setOpen(TRUE); + fv_folder->setOpen(true); } } } @@ -2263,7 +2263,7 @@ std::string get_category_path(LLUUID cat_id) } } // Returns true if the item can be moved to Current Outfit or any outfit folder. -bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit) +bool can_move_to_outfit(LLInventoryItem* inv_item, bool move_is_into_current_outfit) { LLInventoryType::EType inv_type = inv_item->getInventoryType(); if ((inv_type != LLInventoryType::IT_WEARABLE) && @@ -2295,7 +2295,7 @@ bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_out return true; } -// Returns TRUE if item is a landmark or a link to a landmark +// Returns true if item is a landmark or a link to a landmark // and can be moved to Favorites or Landmarks folder. bool can_move_to_landmarks(LLInventoryItem* inv_item) { @@ -2629,40 +2629,40 @@ bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { if(mType == LLAssetType::AT_CATEGORY) { - if(cat) return TRUE; + if(cat) return true; } if(item) { - if(item->getType() == mType) return TRUE; + if(item->getType() == mType) return true; } - return FALSE; + return false; } bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { if(mType == LLAssetType::AT_CATEGORY) { - if(cat) return FALSE; + if(cat) return false; } if(item) { - if(item->getType() == mType) return FALSE; - else return TRUE; + if(item->getType() == mType) return false; + else return true; } - return TRUE; + return true; } bool LLIsOfAssetType::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { if(mType == LLAssetType::AT_CATEGORY) { - if(cat) return TRUE; + if(cat) return true; } if(item) { - if(item->getActualType() == mType) return TRUE; + if(item->getActualType() == mType) return true; } - return FALSE; + return false; } bool LLAssetIDAndTypeMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item) @@ -2684,7 +2684,7 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt { if(cat) { - return TRUE; + return true; } } if(item) @@ -2694,11 +2694,11 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt LLPermissions perm = item->getPermissions(); if ((perm.getMaskBase() & mPerm) == mPerm) { - return TRUE; + return true; } } } - return FALSE; + return false; } bool LLBuddyCollector::operator()(LLInventoryCategory* cat, @@ -2742,10 +2742,10 @@ bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat, if((LLAssetType::AT_CALLINGCARD == item->getType()) && (item->getCreatorUUID() == mBuddyID)) { - return TRUE; + return true; } } - return FALSE; + return false; } @@ -2797,9 +2797,9 @@ bool LLFindBrokenLinks::operator()(LLInventoryCategory* cat, // it is linked too if (item && LLAssetType::lookupIsLinkType(item->getType())) { - return TRUE; + return true; } - return FALSE; + return false; } bool LLFindWearables::operator()(LLInventoryCategory* cat, @@ -2810,10 +2810,10 @@ bool LLFindWearables::operator()(LLInventoryCategory* cat, if((item->getType() == LLAssetType::AT_CLOTHING) || (item->getType() == LLAssetType::AT_BODYPART)) { - return TRUE; + return true; } } - return FALSE; + return false; } LLFindWearablesEx::LLFindWearablesEx(bool is_worn, bool include_body_parts) @@ -2905,7 +2905,7 @@ bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem (item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID. } -void LLSaveFolderState::setApply(BOOL apply) +void LLSaveFolderState::setApply(bool apply) { mApply = apply; // before generating new list of open folders, clear the old one @@ -2928,7 +2928,7 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder) { if (!folder->isOpen()) { - folder->setOpen(TRUE); + folder->setOpen(true); } } else @@ -2936,7 +2936,7 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder) // keep selected filter in its current state, this is less jarring to user if (!folder->isSelected() && folder->isOpen()) { - folder->setOpen(FALSE); + folder->setOpen(false); } } } @@ -2954,7 +2954,7 @@ void LLOpenFilteredFolders::doItem(LLFolderViewItem *item) { if (item->passedFilter()) { - item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } } @@ -2962,12 +2962,12 @@ void LLOpenFilteredFolders::doFolder(LLFolderViewFolder* folder) { if (folder->LLFolderViewItem::passedFilter() && folder->getParentFolder()) { - folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } // if this folder didn't pass the filter, and none of its descendants did else if (!folder->getViewModelItem()->passedFilter() && !folder->getViewModelItem()->descendantsPassedFilter()) { - folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_NO); + folder->setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_NO); } } @@ -2975,12 +2975,12 @@ void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item) { if (item->passedFilter() && !mItemSelected) { - item->getRoot()->setSelection(item, FALSE, FALSE); + item->getRoot()->setSelection(item, false, false); if (item->getParentFolder()) { - item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } - mItemSelected = TRUE; + mItemSelected = true; } } @@ -2989,9 +2989,9 @@ void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder) // Skip if folder or item already found, if not filtered or if no parent (root folder is not selectable) if (!mFolderSelected && !mItemSelected && folder->LLFolderViewItem::passedFilter() && folder->getParentFolder()) { - folder->getRoot()->setSelection(folder, FALSE, FALSE); - folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); - mFolderSelected = TRUE; + folder->getRoot()->setSelection(folder, false, false); + folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); + mFolderSelected = true; } } @@ -2999,7 +2999,7 @@ void LLOpenFoldersWithSelection::doItem(LLFolderViewItem *item) { if (item->getParentFolder() && item->isSelected()) { - item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } } @@ -3007,7 +3007,7 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder) { if (folder->getParentFolder() && folder->isSelected()) { - folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP); + folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP); } } @@ -3017,7 +3017,7 @@ void LLInventoryAction::callback_doToSelected(const LLSD& notification, const LL S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) // YES { - doToSelected(model, root, action, FALSE); + doToSelected(model, root, action, false); } } @@ -3026,11 +3026,11 @@ void LLInventoryAction::callback_copySelected(const LLSD& notification, const LL S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) // YES, Move no copy item(s) { - doToSelected(model, root, "copy_or_move_to_marketplace_listings", FALSE); + doToSelected(model, root, "copy_or_move_to_marketplace_listings", false); } else if (option == 1) // NO, Don't move no copy item(s) (leave them behind) { - doToSelected(model, root, "copy_to_marketplace_listings", FALSE); + doToSelected(model, root, "copy_to_marketplace_listings", false); } } @@ -3063,7 +3063,7 @@ bool get_selection_object_uuids(LLFolderView *root, uuid_vec_t& ids) } -void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm) +void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, bool user_confirm) { std::set<LLFolderViewItem*> selected_items = root->getSelectionList(); if (selected_items.empty() @@ -3181,7 +3181,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(obj_id, categories, items, FALSE); + gInventory.collectDescendents(obj_id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { @@ -3455,6 +3455,23 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root ungroup_folder_items(*ids.begin()); } } + else if ("thumbnail" == action) + { + if (selected_items.size() > 0) + { + LLSD data; + std::set<LLFolderViewItem*>::iterator set_iter; + for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter) + { + LLFolderViewItem* folder_item = *set_iter; + if (!folder_item) continue; + LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); + if (!bridge) continue; + data.append(bridge->getUUID()); + } + LLFloaterReg::showInstance("change_item_thumbnail", data); + } + } else { std::set<LLFolderViewItem*>::iterator set_iter; @@ -3582,7 +3599,7 @@ void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, con LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(obj_id, categories, items, FALSE); + gInventory.collectDescendents(obj_id, categories, items, false); for (LLInventoryModel::item_array_t::value_type& item : items) { |