summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2022-10-28 19:55:40 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2022-10-28 19:55:40 +0300
commit27f7edeedbbf65086e4a6ba28724f8a80c48bcd0 (patch)
tree935682ef21a7e4d10e4959cfd621190ee2deb198
parent449fa46b157c9cd30fd17f63a12a295da18c7b4f (diff)
SL-16534 The link item is not updating after rezzing the linked object in-world
-rw-r--r--indra/newview/llinventoryfunctions.cpp6
-rw-r--r--indra/newview/llinventorymodel.cpp41
-rw-r--r--indra/newview/llinventorymodel.h2
3 files changed, 27 insertions, 22 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 27edc8148e..dab1e5c38d 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -529,7 +529,11 @@ BOOL get_is_item_worn(const LLUUID& id)
const LLViewerInventoryItem* item = gInventory.getItem(id);
if (!item)
return FALSE;
-
+
+ if (item->getIsLinkType() && !gInventory.getItem(item->getLinkedUUID()))
+ {
+ return FALSE;
+ }
// Consider the item as worn if it has links in COF.
if (LLAppearanceMgr::instance().isLinkedInCOF(id))
{
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index fab7ae8f1a..cf0219e76e 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1636,6 +1636,8 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo
LL_WARNS(LOG_INV) << "Deleting non-existent object [ id: " << id << " ] " << LL_ENDL;
return;
}
+
+ LLInventoryModel::item_array_t links = collectLinksTo(id);
LL_DEBUGS(LOG_INV) << "Deleting inventory object " << id << LL_ENDL;
mLastItem = NULL;
@@ -1694,7 +1696,7 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo
obj = NULL; // delete obj
if (fix_broken_links && !is_link_type)
{
- updateLinkedObjectsFromPurge(id);
+ rebuildLinkItems(links);
}
if (do_notify_observers)
{
@@ -1702,26 +1704,25 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo
}
}
-void LLInventoryModel::updateLinkedObjectsFromPurge(const LLUUID &baseobj_id)
+void LLInventoryModel::rebuildLinkItems(LLInventoryModel::item_array_t& items)
{
- LLInventoryModel::item_array_t item_array = collectLinksTo(baseobj_id);
-
- // REBUILD is expensive, so clear the current change list first else
- // everything else on the changelist will also get rebuilt.
- if (item_array.size() > 0)
- {
- notifyObservers();
- for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
- iter != item_array.end();
- iter++)
- {
- const LLViewerInventoryItem *linked_item = (*iter);
- const LLUUID &item_id = linked_item->getUUID();
- if (item_id == baseobj_id) continue;
- addChangedMask(LLInventoryObserver::REBUILD, item_id);
- }
- notifyObservers();
- }
+ // REBUILD is expensive, so clear the current change list first else
+ // everything else on the changelist will also get rebuilt.
+ if (items.size() > 0)
+ {
+ notifyObservers();
+ for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
+ iter != items.end();
+ iter++)
+ {
+ const LLViewerInventoryItem *linked_item = (*iter);
+ if (linked_item)
+ {
+ addChangedMask(LLInventoryObserver::REBUILD, linked_item->getUUID());
+ }
+ }
+ notifyObservers();
+ }
}
// Add/remove an observer. If the observer is destroyed, be sure to
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index c4133ff9bb..685c2c0fe5 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -445,7 +445,7 @@ public:
void checkTrashOverflow();
protected:
- void updateLinkedObjectsFromPurge(const LLUUID& baseobj_id);
+ void rebuildLinkItems(LLInventoryModel::item_array_t& items);
//--------------------------------------------------------------------
// Reorder