SH-4595 WIP - use new LLInventoryObserver::CREATE flag to distinguish newly created items from existing ones being added to inventory.

master
Brad Payne (Vir Linden) 2013-11-04 15:55:04 -05:00
parent 72097affb5
commit 6ea320198a
4 changed files with 7 additions and 6 deletions

View File

@ -774,9 +774,8 @@ bool LLInventoryModel::isInventoryUsable() const
// Calling this method with an inventory item will either change an
// existing item with a matching item_id, or will add the item to the
// current inventory.
U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item)
U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
{
U32 mask = LLInventoryObserver::NONE;
if(item->getUUID().isNull())
{
return mask;
@ -2652,10 +2651,11 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account)
}
U32 changes = 0x0;
U32 mask = account ? LLInventoryObserver::CREATE : 0x0;
//as above, this loop never seems to loop more than once per call
for (item_array_t::iterator it = items.begin(); it != items.end(); ++it)
{
changes |= gInventory.updateItem(*it);
changes |= gInventory.updateItem(*it, mask);
}
gInventory.notifyObservers();
gViewerWindow->getWindow()->decBusyCount();

View File

@ -298,7 +298,7 @@ public:
// NOTE: In usage, you will want to perform cache accounting
// operations in LLInventoryModel::accountForUpdate() or
// LLViewerInventoryItem::updateServer() before calling this method.
U32 updateItem(const LLViewerInventoryItem* item);
U32 updateItem(const LLViewerInventoryItem* item, U32 mask = 0);
// Change an existing item with the matching id or add
// the category. No notifcation will be sent to observers. This

View File

@ -467,7 +467,7 @@ void LLInventoryFetchComboObserver::startFetch()
void LLInventoryAddItemByAssetObserver::changed(U32 mask)
{
if(!(mask & LLInventoryObserver::ADD))
if(!(mask & LLInventoryObserver::ADD) || !(mask & LLInventoryObserver::CREATE))
{
return;
}
@ -528,7 +528,7 @@ bool LLInventoryAddItemByAssetObserver::isAssetWatched( const LLUUID& asset_id )
void LLInventoryAddedObserver::changed(U32 mask)
{
if (!(mask & LLInventoryObserver::ADD))
if (!(mask & LLInventoryObserver::ADD) || !(mask & LLInventoryObserver::CREATE))
{
return;
}

View File

@ -58,6 +58,7 @@ public:
GESTURE = 64,
REBUILD = 128, // Item UI changed (e.g. item type different)
SORT = 256, // Folder needs to be resorted.
CREATE = 512, // With ADD, item has just been created.
ALL = 0xffffffff
};
LLInventoryObserver();