summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryobserver.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-13 10:19:05 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-13 10:19:05 +0100
commitd071cff43fa9529ded274b2aa0c929efbb6f6c91 (patch)
treebf46a0be9f5f1a92ce26a5aa50e6e867cd0e656f /indra/newview/llinventoryobserver.cpp
parent95343d8085d98cf0927747298cd4af7a9ea90766 (diff)
parent4f20b91acdddc06b7e033afa42e19f993f7efb30 (diff)
PE merge from PE's viewer-trunk
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
-rw-r--r--indra/newview/llinventoryobserver.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 83e1bbd5a0..922fcc16c0 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -495,6 +495,69 @@ void LLInventoryExistenceObserver::changed(U32 mask)
}
}
+void LLInventoryMoveFromWorldObserver::changed(U32 mask)
+{
+ if(!(mask & LLInventoryObserver::ADD))
+ {
+ return;
+ }
+
+ // nothing is watched
+ if (mWatchedAssets.size() == 0)
+ {
+ return;
+ }
+
+ LLPointer<LLViewerInventoryItem> item = new LLViewerInventoryItem;
+ LLMessageSystem* msg = gMessageSystem;
+ S32 num_blocks = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
+ for(S32 i = 0; i < num_blocks; ++i)
+ {
+ item->unpackMessage(msg, _PREHASH_InventoryData, i);
+ const LLUUID& asset_uuid = item->getAssetUUID();
+ if (item->getUUID().notNull() && asset_uuid.notNull())
+ {
+ if (isAssetWatched(asset_uuid))
+ {
+ LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
+ mAddedItems.push_back(item->getUUID());
+ }
+ }
+ }
+
+ if (mAddedItems.size() == mWatchedAssets.size())
+ {
+ done();
+ LL_DEBUGS("Inventory_Move") << "All watched items are added & processed." << LL_ENDL;
+ mAddedItems.clear();
+
+ // Unable to clean watched items here due to somebody can require to check them in current frame.
+ // set dirty state to clean them while next watch cycle.
+ mIsDirty = true;
+ }
+}
+
+void LLInventoryMoveFromWorldObserver::watchAsset(const LLUUID& asset_id)
+{
+ if(asset_id.notNull())
+ {
+ if (mIsDirty)
+ {
+ LL_DEBUGS("Inventory_Move") << "Watched items are dirty. Clean them." << LL_ENDL;
+ mWatchedAssets.clear();
+ mIsDirty = false;
+ }
+
+ mWatchedAssets.push_back(asset_id);
+ onAssetAdded(asset_id);
+ }
+}
+
+bool LLInventoryMoveFromWorldObserver::isAssetWatched( const LLUUID& asset_id )
+{
+ return std::find(mWatchedAssets.begin(), mWatchedAssets.end(), asset_id) != mWatchedAssets.end();
+}
+
void LLInventoryAddedObserver::changed(U32 mask)
{
if(!(mask & LLInventoryObserver::ADD))