summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-15 13:56:46 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-15 13:56:46 -0400
commitd5655c9bbfc2b498334e055da882055a8d99fff0 (patch)
tree00871889eac2ba87db28261bbf5288e190475c76 /indra
parentc80da2248d17bf9355fccd203b51548f983bd8ab (diff)
EXT-8283 FIX - allow saveWearable to change name of wearable, split off logic for saveAs case. Some remaining UI issues will be filed separately. Reviewed by Nyx
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llagentwearables.cpp17
-rw-r--r--indra/newview/llagentwearables.h3
-rw-r--r--indra/newview/llpaneleditwearable.cpp14
-rw-r--r--indra/newview/llpaneleditwearable.h2
-rw-r--r--indra/newview/lltexturecache.cpp1
5 files changed, 27 insertions, 10 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index efa5eca217..6ee5a8b279 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 8122971db6..f3457363a0 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -206,7 +206,8 @@ private:
//--------------------------------------------------------------------
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 14f05bdb17..f7e8a7b1a7 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 bfce2ae56e..dbda90fe9f 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -63,7 +63,7 @@ public:
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 9ad2322765..403692951f 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;
}