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 +++++++++++++++++--- indra/newview/llinventorypanel.h | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'indra') 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(); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 45373bd47a..473283352f 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -252,6 +252,7 @@ public: static void setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id); void addItemID(const LLUUID& id, LLFolderViewItem* itemp); virtual void removeItemID(const LLUUID& id); + virtual bool isInRootContent(const LLUUID& id, LLFolderViewItem* view_item) { return false; } LLFolderViewItem* getItemByID(const LLUUID& id); LLFolderViewFolder* getFolderByID(const LLUUID& id); void setSelectionByID(const LLUUID& obj_id, bool take_keyboard_focus); -- cgit v1.2.3