MAINT-5547 FIXED errors when texturing a linkset "Unable to add texture. Please wait a few seconds and try again."

meow-7.2.2
andreykproductengine 2015-08-25 17:34:56 +03:00
parent 5b4f47bc65
commit 8a39351ca9
3 changed files with 25 additions and 15 deletions

View File

@ -1027,13 +1027,10 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
// causing a dirty inventory) and we can do an update, stall the user
// while fetching the inventory.
//
// Note: fetch only if inventory is both dirty and not present since previously checked faces
// could have requested new fetch for same item (removed inventory and marked as dirty=false).
// Objects without listeners (dirty==true and inventory!=NULL. In this specific case - before
// first fetch) shouldn't be updated either since we won't receive any changes.
if (hit_obj->isInventoryDirty() && hit_obj->getInventoryRoot() == NULL)
// Fetch if inventory is dirty and listener is present (otherwise we will not receive update)
if (hit_obj->isInventoryDirty() && hit_obj->hasInventoryListeners())
{
hit_obj->fetchInventoryFromServer();
hit_obj->requestInventory();
LLSD args;
args["ERROR_MESSAGE"] = "Unable to add texture.\nPlease wait a few seconds and try again.";
LLNotificationsUtil::add("ErrorMessage", args);
@ -1113,10 +1110,12 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
{
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
// we should return false here.
// Force the object to update and refetch its inventory so it has this texture.
hit_obj->dirtyInventory();
hit_obj->requestInventory();
// TODO: Check to see if adding the item was successful; if not, then
// we should return false here. This will requre a separate listener
// since without listener, we have no way to receive update
}
return TRUE;
}

View File

@ -2912,6 +2912,11 @@ void LLViewerObject::clearInventoryListeners()
mInventoryCallbacks.clear();
}
bool LLViewerObject::hasInventoryListeners()
{
return !mInventoryCallbacks.empty();
}
void LLViewerObject::requestInventory()
{
if(mInventoryDirty && mInventory && !mInventoryCallbacks.empty())
@ -2919,15 +2924,20 @@ void LLViewerObject::requestInventory()
mInventory->clear(); // will deref and delete entries
delete mInventory;
mInventory = NULL;
mInventoryDirty = FALSE; //since we are going to request it now
}
if(mInventory)
{
// inventory is either up to date or doesn't has a listener
// if it is dirty, leave it this way in case we gain a listener
doInventoryCallback();
}
// throw away duplicate requests
else
{
// since we are going to request it now
mInventoryDirty = FALSE;
// Note: throws away duplicate requests
fetchInventoryFromServer();
}
}
@ -2937,8 +2947,6 @@ void LLViewerObject::fetchInventoryFromServer()
if (!mInventoryPending)
{
delete mInventory;
mInventory = NULL;
mInventoryDirty = FALSE;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RequestTaskInventory);
msg->nextBlockFast(_PREHASH_AgentData);

View File

@ -449,8 +449,8 @@ public:
void removeInventoryListener(LLVOInventoryListener* listener);
BOOL isInventoryPending() { return mInventoryPending; }
void clearInventoryListeners();
bool hasInventoryListeners();
void requestInventory();
void fetchInventoryFromServer();
static void processTaskInv(LLMessageSystem* msg, void** user_data);
void removeInventory(const LLUUID& item_id);
@ -610,6 +610,9 @@ private:
static void initObjectDataMap();
// forms task inventory request if none are pending
void fetchInventoryFromServer();
public:
//
// Viewer-side only types - use the LL_PCODE_APP mask.