From a0c4d81080fbc4b5326e6b598e5df27e01631d48 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 27 Apr 2024 05:01:36 +0300 Subject: viewer#1300 'Star' favorites in inventory #2 --- indra/newview/llinventorypanel.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index ab04a8589a..4aace2f96e 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -620,6 +620,19 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve } } + if (mask & LLInventoryObserver::UPDATE_FAVORITE) + { + if (view_item) + { + // TODO:: move to idle + LLFolderViewFolder* parent = view_item->getParentFolder(); + if (parent) + { + parent->updateHasFavorites(view_item->isFavorite()); + } + } + } + // We don't typically care which of these masks the item is actually flagged with, since the masks // may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into // Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks @@ -648,6 +661,16 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve setSelection(item_id, FALSE); } updateFolderLabel(model_item->getParentUUID()); + if (model_item->getIsFavorite()) + { + // TODO:: move to idle + LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); + if (new_parent) + { + new_parent->updateHasFavorites(true); + } + } + } ////////////////////////////// @@ -694,6 +717,13 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve updateFolderLabel(viewmodel_folder->getUUID()); } old_parent->getViewModelItem()->dirtyDescendantsFilter(); + + if (view_item->isFavorite()) + { + // TODO:: move to idle + old_parent->updateHasFavorites(false); // favorite was removed + new_parent->updateHasFavorites(true); // favorite was added + } } } } @@ -715,6 +745,11 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { updateFolderLabel(viewmodel_folder->getUUID()); } + if (view_item->isFavorite()) + { + // TODO:: move to idle + parent->updateHasFavorites(false); // favorite was removed + } } } } -- cgit v1.2.3 From 2add3b49537fb041b880752dc5302ac6b317e601 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 29 Apr 2024 22:07:12 +0300 Subject: viewer#1300 'Star' favorites in inventory #3 --- indra/newview/llinventorypanel.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 4aace2f96e..6a5cd59acb 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -624,7 +624,6 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { if (view_item) { - // TODO:: move to idle LLFolderViewFolder* parent = view_item->getParentFolder(); if (parent) { @@ -663,7 +662,6 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve updateFolderLabel(model_item->getParentUUID()); if (model_item->getIsFavorite()) { - // TODO:: move to idle LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); if (new_parent) { @@ -720,7 +718,6 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve if (view_item->isFavorite()) { - // TODO:: move to idle old_parent->updateHasFavorites(false); // favorite was removed new_parent->updateHasFavorites(true); // favorite was added } @@ -747,7 +744,6 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve } if (view_item->isFavorite()) { - // TODO:: move to idle parent->updateHasFavorites(false); // favorite was removed } } -- cgit v1.2.3 From 645811c6ef3134a540fc1bc7d32d7bdb8fa35046 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 1 May 2024 03:16:47 +0300 Subject: Viewer#1301 Implement Inventory Favorites Tab WIP --- indra/newview/llinventorypanel.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 6a5cd59acb..bdf9e87e60 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -55,11 +55,13 @@ #include "llviewerfoldertype.h" #include "llvoavatarself.h" +class LLInventoryFavoritesItemsPanel; class LLInventoryRecentItemsPanel; class LLAssetFilteredInventoryPanel; static LLDefaultChildRegistry::Register r("inventory_panel"); static LLDefaultChildRegistry::Register t_recent_inventory_panel("recent_inventory_panel"); +static LLDefaultChildRegistry::Register t_favorites_inventory_panel("favorites_inventory_panel"); static LLDefaultChildRegistry::Register t_asset_filtered_inv_panel("asset_filtered_inv_panel"); const std::string LLInventoryPanel::DEFAULT_SORT_ORDER = std::string("InventorySortOrder"); @@ -2225,6 +2227,42 @@ LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params) mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER; } +/************************************************************************/ +/* Favorites Inventory Panel related class */ +/************************************************************************/ +static const LLFavoritesInventoryBridgeBuilder FAVORITES_BUILDER; +class LLInventoryFavoritesItemsPanel : public LLInventoryPanel +{ +public: + struct Params : public LLInitParam::Block + {}; + + void initFromParams(const Params& p) + { + LLInventoryPanel::initFromParams(p); + // turn off trash + getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() | (1ULL << LLFolderType::FT_TRASH)); + getFilter().setFilterNoTrashFolder(); + // turn off marketplace for favorites + getFilter().setFilterNoMarketplaceFolder(); + } + +protected: + LLInventoryFavoritesItemsPanel(const Params&); + friend class LLUICtrlFactory; +}; + +LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& params) + : LLInventoryPanel(params) +{ + // replace bridge builder to have necessary View bridges. + mInvFVBridgeBuilder = &FAVORITES_BUILDER; +} + +/************************************************************************/ +/* LLInventorySingleFolderPanel */ +/************************************************************************/ + static LLDefaultChildRegistry::Register t_single_folder_inventory_panel("single_folder_inventory_panel"); LLInventorySingleFolderPanel::LLInventorySingleFolderPanel(const Params& params) -- cgit v1.2.3 From fc5e5327bca83846bb97cb7ff578b0dcb3a8892e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 2 May 2024 03:05:41 +0300 Subject: Viewer#1301 Implement Inventory Favorites Tab WIP#2 --- indra/newview/llinventorypanel.cpp | 93 +++++++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 12 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index bdf9e87e60..f22ac6f775 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -947,18 +947,7 @@ void LLInventoryPanel::initializeViews(F64 max_time) mBuildViewsEndTime = curent_time + max_time; // init everything - LLUUID root_id = getRootFolderID(); - if (root_id.notNull()) - { - buildNewViews(getRootFolderID()); - } - else - { - // Default case: always add "My Inventory" root first, "Library" root second - // If we run out of time, this still should create root folders - buildNewViews(gInventory.getRootFolderID()); // My Inventory - buildNewViews(gInventory.getLibraryRootFolderID()); // Library - } + initRootContent(); if (mBuildViewsQueue.empty()) { @@ -991,6 +980,22 @@ void LLInventoryPanel::initializeViews(F64 max_time) } } +void LLInventoryPanel::initRootContent() +{ + LLUUID root_id = getRootFolderID(); + if (root_id.notNull()) + { + buildNewViews(getRootFolderID()); + } + else + { + // Default case: always add "My Inventory" root first, "Library" root second + // If we run out of time, this still should create root folders + buildNewViews(gInventory.getRootFolderID()); // My Inventory + buildNewViews(gInventory.getLibraryRootFolderID()); // Library + } +} + LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop) { @@ -1248,6 +1253,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, { LLViewerInventoryCategory::cat_array_t* categories; LLViewerInventoryItem::item_array_t* items; + //collectInventoryDescendants(id, categories, items); mInventory->lockDirectDescendentArrays(id, categories, items); // Make sure panel won't lock in a loop over existing items if @@ -1348,6 +1354,14 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, return folder_view_item; } + +/*void LLInventoryPanel::collectInventoryDescendants(const LLUUID& id, + LLViewerInventoryCategory::cat_array_t*& categories, + LLViewerInventoryItem::item_array_t*& items); +{ + mInventory->lockDirectDescendentArrays(id, categories, items); +}*/ + // bit of a hack to make sure the inventory is open. void LLInventoryPanel::openStartFolderOrMyInventory() { @@ -2250,6 +2264,9 @@ public: protected: LLInventoryFavoritesItemsPanel(const Params&); friend class LLUICtrlFactory; + + void initRootContent(const LLUUID& id); + void initRootContent() override; }; LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& params) @@ -2259,6 +2276,58 @@ LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& par mInvFVBridgeBuilder = &FAVORITES_BUILDER; } +void LLInventoryFavoritesItemsPanel::initRootContent(const LLUUID& id) +{ + LLViewerInventoryCategory::cat_array_t* categories; + LLViewerInventoryItem::item_array_t* items; + mInventory->lockDirectDescendentArrays(id, categories, items); + + if (categories) + { + S32 count = categories->size(); + for (S32 i = 0; i < count; ++i) + { + LLViewerInventoryCategory* cat = categories->at(i); + if (cat->getPreferredType() == LLFolderType::FT_TRASH) + { + continue; + } + else if (cat->getIsFavorite()) + { + const LLUUID& parent_id = cat->getParentUUID(); + LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); // Should be NULL + + buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + } + else // Todo: timelimits + { + initRootContent(cat->getUUID()); + } + } + } + + if (items) + { + S32 count = items->size(); + for (S32 i = 0; i < count; ++i) + { + LLViewerInventoryItem* item = items->at(i); + if (item->getIsFavorite() && typedViewsFilter(id, item)) + { + const LLUUID& parent_id = item->getParentUUID(); + LLFolderViewItem* folder_view_item = getItemByID(id); // Should be NULL + + buildViewsTree(item->getUUID(), parent_id, item, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + } + } + } +} + +void LLInventoryFavoritesItemsPanel::initRootContent() +{ + initRootContent(gInventory.getRootFolderID()); // My Inventory +} + /************************************************************************/ /* LLInventorySingleFolderPanel */ /************************************************************************/ -- cgit v1.2.3 From bbadb8b3904ba620dde598367493f34b6fcc3226 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 2 May 2024 21:08:41 +0300 Subject: Viewer#1301 Small cleanup notecards do not need to store 'favorite' flag --- indra/newview/llinventorypanel.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index f22ac6f775..3892bfee03 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1253,7 +1253,6 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, { LLViewerInventoryCategory::cat_array_t* categories; LLViewerInventoryItem::item_array_t* items; - //collectInventoryDescendants(id, categories, items); mInventory->lockDirectDescendentArrays(id, categories, items); // Make sure panel won't lock in a loop over existing items if @@ -1354,14 +1353,6 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, return folder_view_item; } - -/*void LLInventoryPanel::collectInventoryDescendants(const LLUUID& id, - LLViewerInventoryCategory::cat_array_t*& categories, - LLViewerInventoryItem::item_array_t*& items); -{ - mInventory->lockDirectDescendentArrays(id, categories, items); -}*/ - // bit of a hack to make sure the inventory is open. void LLInventoryPanel::openStartFolderOrMyInventory() { -- cgit v1.2.3 From db3e5afbfbbce73e8f8339e8b4f938f11023ca64 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 2 May 2024 23:10:51 +0300 Subject: Viewer#1301 Implement Inventory Favorites Tab --- indra/newview/llinventorypanel.cpp | 193 ++++++++++++++++++++++++++++++++++--- 1 file changed, 179 insertions(+), 14 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 3892bfee03..4682f2085b 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -865,7 +865,23 @@ void LLInventoryPanel::idle(void* user_data) bool in_visible_chain = panel->isInVisibleChain(); - if (!panel->mBuildViewsQueue.empty()) + if (!panel->mBuildRootQueue.empty()) + { + const F64 max_time = in_visible_chain ? 0.006f : 0.001f; // 6 ms + F64 curent_time = LLTimer::getTotalSeconds(); + panel->mBuildViewsEndTime = curent_time + max_time; + + while (curent_time < panel->mBuildViewsEndTime + && !panel->mBuildRootQueue.empty()) + { + LLUUID item_id = panel->mBuildRootQueue.back(); + panel->mBuildRootQueue.pop_back(); + panel->findAndInitRootContent(item_id); + + curent_time = LLTimer::getTotalSeconds(); + } + } + else if (!panel->mBuildViewsQueue.empty()) { const F64 max_time = in_visible_chain ? 0.006f : 0.001f; // 6 ms F64 curent_time = LLTimer::getTotalSeconds(); @@ -949,7 +965,7 @@ void LLInventoryPanel::initializeViews(F64 max_time) // init everything initRootContent(); - if (mBuildViewsQueue.empty()) + if (mBuildViewsQueue.empty() && mBuildRootQueue.empty()) { mViewsInitialized = VIEWS_INITIALIZED; } @@ -2252,12 +2268,19 @@ public: getFilter().setFilterNoMarketplaceFolder(); } + void removeItemID(const LLUUID& id) override; + protected: LLInventoryFavoritesItemsPanel(const Params&); friend class LLUICtrlFactory; - void initRootContent(const LLUUID& id); + void findAndInitRootContent(const LLUUID& folder_id) override; void initRootContent() override; + + bool removeFavorite(const LLUUID& id, const LLInventoryObject* model_item); + void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item) override; + + std::set mRootContentIDs; }; LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& params) @@ -2267,8 +2290,27 @@ LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& par mInvFVBridgeBuilder = &FAVORITES_BUILDER; } -void LLInventoryFavoritesItemsPanel::initRootContent(const LLUUID& id) +void LLInventoryFavoritesItemsPanel::removeItemID(const LLUUID& id) +{ + std::set::iterator found = mRootContentIDs.find(id); + if (found != mRootContentIDs.end()) + { + mRootContentIDs.erase(found); + // check content for favorites + mBuildRootQueue.emplace_back(id); + } + + LLInventoryPanel::removeItemID(id); +} + +void LLInventoryFavoritesItemsPanel::findAndInitRootContent(const LLUUID& id) { + F64 curent_time = LLTimer::getTotalSeconds(); + if (mBuildViewsEndTime < curent_time) + { + mBuildRootQueue.emplace_back(id); + return; + } LLViewerInventoryCategory::cat_array_t* categories; LLViewerInventoryItem::item_array_t* items; mInventory->lockDirectDescendentArrays(id, categories, items); @@ -2285,14 +2327,18 @@ void LLInventoryFavoritesItemsPanel::initRootContent(const LLUUID& id) } else if (cat->getIsFavorite()) { - const LLUUID& parent_id = cat->getParentUUID(); - LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); // Should be NULL + LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); + if (!folder_view_item) + { + const LLUUID& parent_id = cat->getParentUUID(); + mRootContentIDs.emplace(cat->getUUID()); - buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + } } - else // Todo: timelimits + else { - initRootContent(cat->getUUID()); + findAndInitRootContent(cat->getUUID()); } } } @@ -2303,12 +2349,17 @@ void LLInventoryFavoritesItemsPanel::initRootContent(const LLUUID& id) for (S32 i = 0; i < count; ++i) { LLViewerInventoryItem* item = items->at(i); - if (item->getIsFavorite() && typedViewsFilter(id, item)) + const LLUUID item_id = item->getUUID(); + if (item->getIsFavorite() && typedViewsFilter(item_id, item)) { - const LLUUID& parent_id = item->getParentUUID(); - LLFolderViewItem* folder_view_item = getItemByID(id); // Should be NULL + LLFolderViewItem* folder_view_item = getItemByID(id); + if (!folder_view_item) + { + const LLUUID& parent_id = item->getParentUUID(); + mRootContentIDs.emplace(item_id); - buildViewsTree(item->getUUID(), parent_id, item, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + buildViewsTree(item_id, parent_id, item, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + } } } } @@ -2316,9 +2367,123 @@ void LLInventoryFavoritesItemsPanel::initRootContent(const LLUUID& id) void LLInventoryFavoritesItemsPanel::initRootContent() { - initRootContent(gInventory.getRootFolderID()); // My Inventory + findAndInitRootContent(gInventory.getRootFolderID()); // My Inventory +} + +bool LLInventoryFavoritesItemsPanel::removeFavorite(const LLUUID& id, const LLInventoryObject* model_item) +{ + std::set::iterator found = mRootContentIDs.find(id); + if (found == mRootContentIDs.end()) + { + return false; + } + + mRootContentIDs.erase(found); + + // This item is in root's content, remove item's UI. + LLFolderViewItem* view_item = getItemByID(id); + if (view_item) + { + LLFolderViewFolder* parent = view_item->getParentFolder(); + LLFolderViewModelItemInventory* viewmodel_item = static_cast(view_item->getViewModelItem()); + if (viewmodel_item) + { + removeItemID(viewmodel_item->getUUID()); + } + view_item->destroyView(); + if (parent) + { + parent->getViewModelItem()->dirtyDescendantsFilter(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast(parent->getViewModelItem()); + if (viewmodel_folder) + { + updateFolderLabel(viewmodel_folder->getUUID()); + } + if (view_item->isFavorite()) + { + parent->updateHasFavorites(false); // favorite was removed + } + } + } + + return true; } +void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, const LLInventoryObject* model_item) +{ + if (!model_item && !getItemByID(id)) + { + // remove operation, but item is not in panel already + return; + } + + bool handled = false; + + if (mask & (LLInventoryObserver::UPDATE_FAVORITE | + LLInventoryObserver::STRUCTURE | + LLInventoryObserver::ADD | + LLInventoryObserver::REMOVE)) + { + if (model_item && model_item->getIsFavorite()) + { + LLFolderViewItem* view_item = getItemByID(id); + if (!view_item) + { + const LLViewerInventoryCategory* cat = dynamic_cast(model_item); + if (cat) + { + // New favorite folder + if (cat->getPreferredType() != LLFolderType::FT_TRASH) + { + // If any descendants were in the list, remove them + LLFavoritesCollector is_favorite; + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendentsIf(id, cat_array, item_array, FALSE, is_favorite); + for (LLInventoryModel::cat_array_t::const_iterator it = cat_array.begin(); it != cat_array.end(); ++it) + { + removeFavorite((*it)->getUUID(), *it); + } + for (LLInventoryModel::item_array_t::const_iterator it = item_array.begin(); it != item_array.end(); ++it) + { + removeFavorite((*it)->getUUID(), *it); + } + + LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); + if (!folder_view_item) + { + const LLUUID& parent_id = cat->getParentUUID(); + mRootContentIDs.emplace(cat->getUUID()); + + buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_ONE_FOLDER); + } + } + } + else + { + // New favorite item + if (model_item->getIsFavorite() && typedViewsFilter(id, model_item)) + { + const LLUUID& parent_id = model_item->getParentUUID(); + mRootContentIDs.emplace(id); + + buildViewsTree(id, parent_id, model_item, NULL, mFolderRoot.get(), BUILD_ONE_FOLDER); + } + } + handled = true; + } + } + else + { + handled = removeFavorite(id, model_item); + } + } + + if (!handled) + { + LLInventoryPanel::itemChanged(id, mask, model_item); + } +} /************************************************************************/ /* LLInventorySingleFolderPanel */ /************************************************************************/ -- cgit v1.2.3 From 25b19eb6b8b8482d5f6cff0cae8665a0f7518eb1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 17 May 2024 22:22:45 +0300 Subject: viewer#1424 Proper links support for favorites --- indra/newview/llinventorypanel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 4682f2085b..8450c344a7 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -626,10 +626,11 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { if (view_item) { + view_item->refresh(); LLFolderViewFolder* parent = view_item->getParentFolder(); if (parent) { - parent->updateHasFavorites(view_item->isFavorite()); + parent->updateHasFavorites(get_is_favorite(model_item)); } } } @@ -662,7 +663,8 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve setSelection(item_id, FALSE); } updateFolderLabel(model_item->getParentUUID()); - if (model_item->getIsFavorite()) + + if (get_is_favorite(model_item)) { LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); if (new_parent) @@ -2424,6 +2426,7 @@ void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, con LLInventoryObserver::ADD | LLInventoryObserver::REMOVE)) { + // specifically exlude links and not get_is_favorite(model_item) if (model_item && model_item->getIsFavorite()) { LLFolderViewItem* view_item = getItemByID(id); -- cgit v1.2.3 From db3f7eafa05636a3079037109d3d21514b25a8bb Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 4 Jun 2024 02:08:12 +0300 Subject: viewer#1588 Upload directly to Specified Inventory Folder --- indra/newview/llinventorypanel.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 4ac43ea6b2..f1471e81c7 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1727,26 +1727,8 @@ bool LLInventoryPanel::beginIMSession() void LLInventoryPanel::fileUploadLocation(const LLSD& userdata) { const std::string param = userdata.asString(); - if (param == "model") - { - gSavedPerAccountSettings.setString("ModelUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "texture") - { - gSavedPerAccountSettings.setString("TextureUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "sound") - { - gSavedPerAccountSettings.setString("SoundUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "animation") - { - gSavedPerAccountSettings.setString("AnimationUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "pbr_material") - { - gSavedPerAccountSettings.setString("PBRUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } + const LLUUID dest = LLFolderBridge::sSelf.get()->getUUID(); + LLInventoryAction::fileUploadLocation(dest, param); } void LLInventoryPanel::openSingleViewInventory(LLUUID folder_id) -- cgit v1.2.3 From d1cf13f31e75807500aff0cf49812a76aff2bd74 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 10 Jun 2024 16:03:00 +0300 Subject: viewer#1673 Crash calling dirtyDescendantsFilter --- indra/newview/llinventorypanel.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index ad9099cd6e..33d9f08e14 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -565,7 +565,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->refresh(); } LLFolderViewFolder* parent = view_item->getParentFolder(); - if(parent) + if(parent && parent->getViewModelItem()) { parent->getViewModelItem()->dirtyDescendantsFilter(); } @@ -616,7 +616,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Sort the folder. if (mask & LLInventoryObserver::SORT) { - if (view_folder) + if (view_folder && view_folder->getViewModelItem()) { view_folder->getViewModelItem()->requestSort(); } @@ -684,7 +684,8 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Don't process the item if it is the root if (old_parent) { - LLFolderViewModelItemInventory* viewmodel_folder = static_cast(old_parent->getViewModelItem()); + LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast(old_parent_vmi); LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); // Item has been moved. if (old_parent != new_parent) @@ -718,7 +719,10 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { updateFolderLabel(viewmodel_folder->getUUID()); } - old_parent->getViewModelItem()->dirtyDescendantsFilter(); + if (old_parent_vmi) + { + old_parent_vmi->dirtyDescendantsFilter(); + } if (view_item->isFavorite()) { @@ -740,11 +744,15 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->destroyView(); if(parent) { - parent->getViewModelItem()->dirtyDescendantsFilter(); - LLFolderViewModelItemInventory* viewmodel_folder = static_cast(parent->getViewModelItem()); - if(viewmodel_folder) + LLFolderViewModelItem* parent_wmi = parent->getViewModelItem(); + if (parent_wmi) { - updateFolderLabel(viewmodel_folder->getUUID()); + parent_wmi->dirtyDescendantsFilter(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast(parent_wmi); + if (viewmodel_folder) + { + updateFolderLabel(viewmodel_folder->getUUID()); + } } if (view_item->isFavorite()) { -- cgit v1.2.3 From e66637ff33d2b73b6fb024c00216947e4c99c409 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 15 Oct 2024 12:06:33 +0300 Subject: Fix missing inventory unlock --- indra/newview/llinventorypanel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index a62f762d80..303df07ecf 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -2359,6 +2359,8 @@ void LLInventoryFavoritesItemsPanel::findAndInitRootContent(const LLUUID& id) } } } + + mInventory->unlockDirectDescendentArrays(id); } void LLInventoryFavoritesItemsPanel::initRootContent() -- cgit v1.2.3 From a510a1da004a9299d5389e77bb9aa43ae1cc1c60 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 15 Oct 2024 22:46:23 +0200 Subject: Convert BOOL to bool # Conflicts: # indra/newview/llagent.cpp --- indra/newview/llinventorypanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 303df07ecf..aba17c99d0 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -2438,7 +2438,7 @@ void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, con LLFavoritesCollector is_favorite; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; - gInventory.collectDescendentsIf(id, cat_array, item_array, FALSE, is_favorite); + gInventory.collectDescendentsIf(id, cat_array, item_array, false, is_favorite); for (LLInventoryModel::cat_array_t::const_iterator it = cat_array.begin(); it != cat_array.end(); ++it) { removeFavorite((*it)->getUUID(), *it); -- cgit v1.2.3 From f9503bdf8c209858aa9fbf8db3b9f90465ad8ae3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 8 Jan 2025 20:56:01 +0200 Subject: #3353 Fix favorited items not being readded on parent removal --- indra/newview/llinventorypanel.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index aba17c99d0..bcdd548cb6 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -2273,6 +2273,7 @@ protected: void findAndInitRootContent(const LLUUID& folder_id) override; void initRootContent() override; + // removeFavorite removes item from root, does not readd favorited children if present bool removeFavorite(const LLUUID& id, const LLInventoryObject* model_item); void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item) override; @@ -2435,6 +2436,7 @@ void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, con if (cat->getPreferredType() != LLFolderType::FT_TRASH) { // If any descendants were in the list, remove them + // Todo: Consider implementing and checking hasFavorites to save on search LLFavoritesCollector is_favorite; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; @@ -2475,6 +2477,16 @@ void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, con else { handled = removeFavorite(id, model_item); + if (handled) + { + const LLViewerInventoryCategory* cat = dynamic_cast(model_item); + // Todo: Consider implementing and checking hasFavorites to save on search + if (cat) + { + // re-add any favorited children + mBuildRootQueue.emplace_back(id); + } + } } } -- cgit v1.2.3 From b1fa03e224f90a2369de27c89597ad0b2a63eb6f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 Jan 2025 21:26:01 +0200 Subject: #3374 LLFolderViewFolder::updateHasFavorites --- indra/newview/llinventorypanel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index bcdd548cb6..5528bfa66b 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -668,7 +668,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve if (get_is_favorite(model_item)) { - LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); + LLFolderViewFolder* new_parent = getFolderByID(model_item->getParentUUID()); if (new_parent) { new_parent->updateHasFavorites(true); @@ -728,12 +728,18 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve if (view_item->isFavorite()) { + if (old_parent) + { old_parent->updateHasFavorites(false); // favorite was removed + } + if (new_parent) + { new_parent->updateHasFavorites(true); // favorite was added } } } } + } ////////////////////////////// // REMOVE Operation -- cgit v1.2.3 From 3daf08696ec08ec9cf6344211a23bcc205112e2e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 Jan 2025 22:41:07 +0200 Subject: #3374 Fix item reparenting moving containing folder --- indra/newview/llinventorypanel.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'indra/newview/llinventorypanel.cpp') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 5528bfa66b..25d1175ac2 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -688,9 +688,11 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem(); LLFolderViewModelItemInventory* viewmodel_folder = static_cast(old_parent_vmi); - LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); - // Item has been moved. - if (old_parent != new_parent) + LLFolderViewFolder* new_parent = getFolderByID(model_item->getParentUUID()); + + if (old_parent != new_parent // Item has been moved. + && (new_parent != NULL || !isInRootContent(item_id, view_item)) // item is not or shouldn't be in root content + ) { if (new_parent != NULL) { @@ -2271,6 +2273,7 @@ public: } void removeItemID(const LLUUID& id) override; + bool isInRootContent(const LLUUID& id, LLFolderViewItem* view_item) override; protected: LLInventoryFavoritesItemsPanel(const Params&); @@ -2306,6 +2309,17 @@ void LLInventoryFavoritesItemsPanel::removeItemID(const LLUUID& id) LLInventoryPanel::removeItemID(id); } +bool LLInventoryFavoritesItemsPanel::isInRootContent(const LLUUID& id, LLFolderViewItem* view_item) +{ + if (!view_item->isFavorite()) + { + return false; + } + + std::set::iterator found = mRootContentIDs.find(id); + return found != mRootContentIDs.end(); +} + void LLInventoryFavoritesItemsPanel::findAndInitRootContent(const LLUUID& id) { F64 curent_time = LLTimer::getTotalSeconds(); -- cgit v1.2.3