diff options
Diffstat (limited to 'indra/newview/llsidepaneliteminfo.cpp')
-rw-r--r-- | indra/newview/llsidepaneliteminfo.cpp | 124 |
1 files changed, 51 insertions, 73 deletions
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 12cbff888d..3c58dd7194 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -46,6 +46,7 @@ #include "llviewerobjectlist.h" #include "llexperiencecache.h" #include "lltrans.h" +#include "llviewerregion.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -327,9 +328,13 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) LLTextBox* tb = getChild<LLTextBox>("LabelItemExperience"); tb->setText(getString("loading_experience")); tb->setVisible(TRUE); - - LLExperienceCache::instance().fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), - boost::bind(&LLSidepanelItemInfo::setAssociatedExperience, getDerivedHandle<LLSidepanelItemInfo>(), _1)); + std::string url = std::string(); + if(object && object->getRegion()) + { + url = object->getRegion()->getCapability("GetMetadata"); + } + LLExperienceCache::instance().fetchAssociatedExperience(item->getParentUUID(), item->getUUID(), url, + boost::bind(&LLSidepanelItemInfo::setAssociatedExperience, getDerivedHandle<LLSidepanelItemInfo>(), _1)); } ////////////////////// @@ -779,23 +784,7 @@ void LLSidepanelItemInfo::onCommitName() { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->rename(labelItemName->getText()); - if(mObjectID.isNull()) - { - new_item->updateServer(FALSE); - gInventory.updateItem(new_item); - gInventory.notifyObservers(); - } - else - { - LLViewerObject* object = gObjectList.findObject(mObjectID); - if(object) - { - object->updateInventory( - new_item, - TASK_INVENTORY_ITEM_KEY, - false); - } - } + onCommitChanges(new_item); } } @@ -816,23 +805,7 @@ void LLSidepanelItemInfo::onCommitDescription() LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setDescription(labelItemDesc->getText()); - if(mObjectID.isNull()) - { - new_item->updateServer(FALSE); - gInventory.updateItem(new_item); - gInventory.notifyObservers(); - } - else - { - LLViewerObject* object = gObjectList.findObject(mObjectID); - if(object) - { - object->updateInventory( - new_item, - TASK_INVENTORY_ITEM_KEY, - false); - } - } + onCommitChanges(new_item); } } @@ -908,23 +881,7 @@ void LLSidepanelItemInfo::onCommitPermissions() flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } new_item->setFlags(flags); - if(mObjectID.isNull()) - { - new_item->updateServer(FALSE); - gInventory.updateItem(new_item); - gInventory.notifyObservers(); - } - else - { - LLViewerObject* object = gObjectList.findObject(mObjectID); - if(object) - { - object->updateInventory( - new_item, - TASK_INVENTORY_ITEM_KEY, - false); - } - } + onCommitChanges(new_item); } else { @@ -1008,25 +965,7 @@ void LLSidepanelItemInfo::updateSaleInfo() } new_item->setSaleInfo(sale_info); - if(mObjectID.isNull()) - { - // This is in the agent's inventory. - new_item->updateServer(FALSE); - gInventory.updateItem(new_item); - gInventory.notifyObservers(); - } - else - { - // This is in an object's contents. - LLViewerObject* object = gObjectList.findObject(mObjectID); - if(object) - { - object->updateInventory( - new_item, - TASK_INVENTORY_ITEM_KEY, - false); - } - } + onCommitChanges(new_item); } else { @@ -1035,6 +974,45 @@ void LLSidepanelItemInfo::updateSaleInfo() } } +void LLSidepanelItemInfo::onCommitChanges(LLPointer<LLViewerInventoryItem> item) +{ + if (item.isNull()) + { + return; + } + + if (mObjectID.isNull()) + { + // This is in the agent's inventory. + item->updateServer(FALSE); + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + else + { + // This is in an object's contents. + LLViewerObject* object = gObjectList.findObject(mObjectID); + if (object) + { + object->updateInventory( + item, + TASK_INVENTORY_ITEM_KEY, + false); + + if (object->isSelected()) + { + // Since object is selected (build floater is open) object will + // receive properties update, detect serial mismatch, dirty and + // reload inventory, meanwhile some other updates will refresh it. + // So mark dirty early, this will prevent unnecessary changes + // and download will be triggered by LLPanelObjectInventory - it + // prevents flashing in content tab and some duplicated request. + object->dirtyInventory(); + } + } + } +} + LLViewerInventoryItem* LLSidepanelItemInfo::findItem() const { LLViewerInventoryItem* item = NULL; |