diff options
author | Oz Linden <oz@lindenlab.com> | 2012-07-09 11:41:47 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2012-07-09 11:41:47 -0400 |
commit | 690f985a9c3dba6f08bf955bf0c11c256a2b42bf (patch) | |
tree | 13a44cc63d1ffc19e5bedd62632c1559b21b0bb8 | |
parent | 13f7afbd7d91db0ab5b2f1e3bf7b894bbdd48e7a (diff) | |
parent | 1b109f80b92a6b113d4874527d49d51cc451b302 (diff) |
merge changes for DRTVWR-177
-rw-r--r-- | .hgtags | 1 | ||||
-rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 3 |
4 files changed, 45 insertions, 15 deletions
@@ -336,3 +336,4 @@ cbea6356ce9cb0c313b6777f10c5c14783264fcc DRTVWR-174 bce218b2b45b730b22cc51e4807aa8b571cadef3 DRTVWR-173 f91d003091a61937a044652c4c674447f7dcbb7a 3.3.4-beta1 82b5330bc8b17d0d4b598832e9c5a92e90075682 3.3.4-beta2 +eb539c65e6ee26eea2bf373af2d0f4b52dc91289 DRTVWR-177 diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 4f4eef0f3d..c69999981c 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1007,7 +1007,14 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, } } // Add the texture item to the target object's inventory. - hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); + if (LLAssetType::AT_TEXTURE == new_item->getType()) + { + hit_obj->updateTextureInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); + } + else + { + hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); + } // TODO: Check to see if adding the item was successful; if not, then // we should return false here. } @@ -1022,7 +1029,14 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, // *FIX: may want to make sure agent can paint hit_obj. // Add the texture item to the target object's inventory. - hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); + if (LLAssetType::AT_TEXTURE == new_item->getType()) + { + hit_obj->updateTextureInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); + } + else + { + hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true); + } // Force the object to update its refetch its inventory so it has this texture. hit_obj->fetchInventoryFromServer(); // TODO: Check to see if adding the item was successful; if not, then diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 72fd3c1a4a..67c87a6c63 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2924,27 +2924,39 @@ void LLViewerObject::removeInventory(const LLUUID& item_id) ++mInventorySerialNum; } -void LLViewerObject::updateInventory( - LLViewerInventoryItem* item, - U8 key, - bool is_new) +bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item) { - LLMemType mt(LLMemType::MTYPE_OBJECT); + bool result = false; - std::list<LLUUID>::iterator begin = mPendingInventoryItemsIDs.begin(); - std::list<LLUUID>::iterator end = mPendingInventoryItemsIDs.end(); + if (item && LLAssetType::AT_TEXTURE == item->getType()) + { + std::list<LLUUID>::iterator begin = mPendingInventoryItemsIDs.begin(); + std::list<LLUUID>::iterator end = mPendingInventoryItemsIDs.end(); - bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end; - bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL; + bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end; + bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL; - if (is_fetched || is_fetching) - { - return; + result = is_fetched || is_fetching; } - else + + return result; +} + +void LLViewerObject::updateTextureInventory(LLViewerInventoryItem* item, U8 key, bool is_new) +{ + if (item && !isTextureInInventory(item)) { mPendingInventoryItemsIDs.push_back(item->getAssetUUID()); + updateInventory(item, key, is_new); } +} + +void LLViewerObject::updateInventory( + LLViewerInventoryItem* item, + U8 key, + bool is_new) +{ + LLMemType mt(LLMemType::MTYPE_OBJECT); // This slices the object into what we're concerned about on the // viewer. The simulator will take the permissions and transfer diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index dc102b666f..409108266e 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -432,12 +432,15 @@ public: // manager until we have better iterators. void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new); void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging. + void updateTextureInventory(LLViewerInventoryItem* item, U8 key, bool is_new); LLInventoryObject* getInventoryObject(const LLUUID& item_id); void getInventoryContents(LLInventoryObject::object_list_t& objects); LLInventoryObject* getInventoryRoot(); LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id); S16 getInventorySerial() const { return mInventorySerialNum; } + bool isTextureInInventory(LLViewerInventoryItem* item); + // These functions does viewer-side only object inventory modifications void updateViewerInventoryAsset( const LLViewerInventoryItem* item, |