aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltooldraganddrop.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lltooldraganddrop.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/linden/indra/newview/lltooldraganddrop.cpp b/linden/indra/newview/lltooldraganddrop.cpp
index 6f53f79..fb430d7 100644
--- a/linden/indra/newview/lltooldraganddrop.cpp
+++ b/linden/indra/newview/lltooldraganddrop.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -1199,11 +1199,22 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
1199 return TRUE; 1199 return TRUE;
1200 } 1200 }
1201 1201
1202 // In case the inventory has not been updated (e.g. due to some recent operation
1203 // causing a dirty inventory), stall the user while fetching the inventory.
1204 if (hit_obj->isInventoryDirty())
1205 {
1206 hit_obj->fetchInventoryFromServer();
1207 LLString::format_map_t args;
1208 args["[ERROR_MESSAGE]"] = "Unable to add texture.\nPlease wait a few seconds and try again.";
1209 gViewerWindow->alertXml("ErrorMessage", args);
1210 return FALSE;
1211 }
1202 if (hit_obj->getInventoryItemByAsset(item->getAssetUUID())) 1212 if (hit_obj->getInventoryItemByAsset(item->getAssetUUID()))
1203 { 1213 {
1204 // if the asset is already in the object's inventory 1214 // if the asset is already in the object's inventory
1205 // then it can always be added to a side. 1215 // then it can always be added to a side.
1206 // This saves some work if the task's inventory is already loaded 1216 // This saves some work if the task's inventory is already loaded
1217 // and ensures that the texture item is only added once.
1207 return TRUE; 1218 return TRUE;
1208 } 1219 }
1209 1220
@@ -1241,7 +1252,10 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
1241 return FALSE; 1252 return FALSE;
1242 } 1253 }
1243 } 1254 }
1244 hit_obj->updateInventory(new_item, TASK_INVENTORY_ASSET_KEY, true); 1255 // Add the texture item to the target object's inventory.
1256 hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
1257 // TODO: Check to see if adding the item was successful; if not, then
1258 // we should return false here.
1245 } 1259 }
1246 else if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, 1260 else if(!item->getPermissions().allowOperationBy(PERM_TRANSFER,
1247 gAgent.getID())) 1261 gAgent.getID()))
@@ -1253,8 +1267,12 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
1253 } 1267 }
1254 // *FIX: may want to make sure agent can paint hit_obj. 1268 // *FIX: may want to make sure agent can paint hit_obj.
1255 1269
1256 // make sure the object has the texture in it's inventory. 1270 // Add the texture item to the target object's inventory.
1257 hit_obj->updateInventory(new_item, TASK_INVENTORY_ASSET_KEY, true); 1271 hit_obj->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, true);
1272 // Force the object to update its refetch its inventory so it has this texture.
1273 hit_obj->fetchInventoryFromServer();
1274 // TODO: Check to see if adding the item was successful; if not, then
1275 // we should return false here.
1258 } 1276 }
1259 return TRUE; 1277 return TRUE;
1260} 1278}