Scott Lawrence avatar Scott Lawrence committed a8057e1 Merge

merge changes for DRTVWR-177

Comments (0)

Files changed (4)

 bce218b2b45b730b22cc51e4807aa8b571cadef3 DRTVWR-173
 f91d003091a61937a044652c4c674447f7dcbb7a 3.3.4-beta1
 82b5330bc8b17d0d4b598832e9c5a92e90075682 3.3.4-beta2
+eb539c65e6ee26eea2bf373af2d0f4b52dc91289 DRTVWR-177

indra/newview/lltooldraganddrop.cpp

 			}
 		}
 		// 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.
 	}
 		// *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

indra/newview/llviewerobject.cpp

 	++mInventorySerialNum;
 }
 
+bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item)
+{
+	bool result = false;
+
+	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;
+
+		result = is_fetched || is_fetching;
+	}
+
+	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,
 {
 	LLMemType mt(LLMemType::MTYPE_OBJECT);
 
-	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;
-
-	if (is_fetched || is_fetching)
-	{
-		return;
-	}
-	else
-	{
-		mPendingInventoryItemsIDs.push_back(item->getAssetUUID());
-	}
-
 	// This slices the object into what we're concerned about on the
 	// viewer. The simulator will take the permissions and transfer
 	// ownership.

indra/newview/llviewerobject.h

 	// 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,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.