diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index efa5eca217fc88606c6331d796121c84703c98fb..6ee5a8b279e6f56e40ab65e6eea9a6d2d5f12a33 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -384,7 +384,8 @@ void LLAgentWearables::sendAgentWearablesUpdate() gAgent.sendReliableMessage(); } -void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update) +void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update, + const std::string new_name) { LLWearable* old_wearable = getWearable(type, index); if (old_wearable && (old_wearable->isDirty() || old_wearable->isOldVersion())) @@ -402,6 +403,14 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 LLInventoryItem* item = gInventory.getItem(old_item_id); if (item) { + std::string item_name = item->getName(); + bool name_changed = false; + if (!new_name.empty() && (new_name != item->getName())) + { + llinfos << "saveWearable changing name from " << item->getName() << " to " << new_name << llendl; + item_name = new_name; + name_changed = true; + } // Update existing inventory item LLPointer<LLViewerInventoryItem> template_item = new LLViewerInventoryItem(item->getUUID(), @@ -410,7 +419,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 new_wearable->getAssetID(), new_wearable->getAssetType(), item->getInventoryType(), - item->getName(), + item_name, item->getDescription(), item->getSaleInfo(), item->getFlags(), @@ -418,6 +427,10 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 template_item->setTransactionID(new_wearable->getTransactionID()); template_item->updateServer(FALSE); gInventory.updateItem(template_item); + if (name_changed) + { + gInventory.notifyObservers(); + } } else { diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 8122971db6c76f8d8d8f3888e2cd574464e65dae..f3457363a060eb247b16e97c83777c63ee0eb37d 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -206,7 +206,8 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables> //-------------------------------------------------------------------- public: void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found); - void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE); + void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE, + const std::string new_name = ""); void saveAllWearables(); void revertWearable(const LLWearableType::EType type, const U32 index); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 14f05bdb1730640889e6d9b2de0e056947db0ce3..f7e8a7b1a74c6f0d0de7dde8a8cda8eb5466b9f5 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -839,7 +839,7 @@ void LLPanelEditWearable::saveAsCallback(const LLSD& notification, const LLSD& r if( !wearable_name.empty() ) { mNameEditor->setText(wearable_name); - saveChanges(); + saveChanges(true); } } } @@ -971,7 +971,7 @@ void LLPanelEditWearable::updatePanelPickerControls(LLWearableType::EType type) } } -void LLPanelEditWearable::saveChanges() +void LLPanelEditWearable::saveChanges(bool force_save_as) { if (!mWearablePtr || !isDirty()) { @@ -980,16 +980,18 @@ void LLPanelEditWearable::saveChanges() } U32 index = gAgentWearables.getWearableIndex(mWearablePtr); - - if (mWearablePtr->getName().compare(mNameEditor->getText()) != 0) + + std::string new_name = mNameEditor->getText(); + if (force_save_as) { // the name of the wearable has changed, re-save wearable with new name LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID(),false); - gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, mNameEditor->getText(), FALSE); + gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE); + mNameEditor->setText(mWearablePtr->getName()); } else { - gAgentWearables.saveWearable(mWearablePtr->getType(), index); + gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); } } diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index bfce2ae56ed45ce2c54c6580ae2f171c4769ba40..dbda90fe9facba101c9a64ff79837dff0e66c162 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -63,7 +63,7 @@ class LLPanelEditWearable : public LLPanel LLWearable* getWearable() { return mWearablePtr; } void setWearable(LLWearable *wearable); - void saveChanges(); + void saveChanges(bool force_save_as = false); void revertChanges(); void showDefaultSubpart(); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 9ad2322765546b9dca141e0891b5c6c746b7e876..403692951f225526cbe2afa5f68df624c0c35537 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -391,6 +391,7 @@ bool LLTextureCacheRemoteWorker::doRead() } else { + //llinfos << "texture " << mID.asString() << " found in local_assets" << llendl; mImageSize = local_size; mImageLocal = TRUE; }