summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--].hgignore0
-rwxr-xr-x[-rw-r--r--]indra/llinventory/llinventory.cpp5
-rwxr-xr-x[-rw-r--r--]indra/llinventory/llinventory.h1
-rwxr-xr-xindra/newview/llagentwearables.cpp12
-rwxr-xr-xindra/newview/llagentwearables.h6
-rwxr-xr-xindra/newview/llappearancemgr.cpp75
-rwxr-xr-xindra/newview/llappearancemgr.h7
-rw-r--r--indra/newview/llinventorylistitem.cpp2
-rwxr-xr-x[-rw-r--r--]indra/newview/llpaneleditwearable.cpp41
9 files changed, 114 insertions, 35 deletions
diff --git a/.hgignore b/.hgignore
index c845758e7c..c845758e7c 100644..100755
--- a/.hgignore
+++ b/.hgignore
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index 2dbc331036..3150a99a21 100644..100755
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -379,6 +379,11 @@ const std::string& LLInventoryItem::getDescription() const
return mDescription;
}
+const std::string& LLInventoryItem::getActualDescription() const
+{
+ return mDescription;
+}
+
time_t LLInventoryItem::getCreationDate() const
{
return mCreationDate;
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index a5cfe59bda..44e7c0c34d 100644..100755
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -160,6 +160,7 @@ public:
virtual const LLUUID& getCreatorUUID() const;
virtual const LLUUID& getAssetUUID() const;
virtual const std::string& getDescription() const;
+ virtual const std::string& getActualDescription() const; // Does not follow links
virtual const LLSaleInfo& getSaleInfo() const;
virtual LLInventoryType::EType getInventoryType() const;
virtual U32 getFlags() const;
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index e79fda2459..70f4de8db2 100755
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -210,12 +210,13 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal
* @param todo Bitmask of actions to take on completion.
*/
LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback(
- LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo) :
+ LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo, const std::string description) :
mType(type),
mIndex(index),
mWearable(wearable),
mTodo(todo),
- mCB(cb)
+ mCB(cb),
+ mDescription(description)
{
llinfos << "constructor" << llendl;
}
@@ -255,7 +256,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
}
if (mTodo & CALL_WEARITEM)
{
- LLAppearanceMgr::instance().addCOFItemLink(inv_item, true);
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item, true, NULL, mDescription);
}
}
@@ -455,6 +456,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
const U32 index,
const std::string& new_name,
+ const std::string& description,
BOOL save_in_lost_and_found)
{
if (!isWearableCopyable(type, index))
@@ -486,7 +488,9 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
type,
index,
new_wearable,
- addWearableToAgentInventoryCallback::CALL_WEARITEM);
+ addWearableToAgentInventoryCallback::CALL_WEARITEM,
+ description
+ );
LLUUID category_id;
if (save_in_lost_and_found)
{
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index a60fbc969b..5be4648636 100755
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -183,7 +183,7 @@ private:
// Save Wearables
//--------------------------------------------------------------------
public:
- void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found);
+ void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, BOOL save_in_lost_and_found);
void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE,
const std::string new_name = "");
void saveAllWearables();
@@ -270,7 +270,8 @@ private:
LLWearableType::EType type,
U32 index,
LLViewerWearable* wearable,
- U32 todo = CALL_NONE);
+ U32 todo = CALL_NONE,
+ const std::string description = "");
virtual void fire(const LLUUID& inv_item);
private:
LLWearableType::EType mType;
@@ -278,6 +279,7 @@ private:
LLViewerWearable* mWearable;
U32 mTodo;
LLPointer<LLRefCount> mCB;
+ std::string mDescription;
};
}; // LLAgentWearables
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 7edba842b8..2b1e78c899 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -451,7 +451,7 @@ public:
item->getLinkedUUID(),
mDstCatID,
item->getName(),
- item->LLInventoryItem::getDescription(),
+ item->getActualDescription(),
LLAssetType::AT_LINK,
new LLBoostFuncInventoryCallback(
boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer())));
@@ -1467,13 +1467,13 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL
{
case LLAssetType::AT_LINK:
{
- //LLInventoryItem::getDescription() is used for a new description
+ //getActualDescription() is used for a new description
//to propagate ordering information saved in descriptions of links
link_inventory_item(gAgent.getID(),
item->getLinkedUUID(),
dst_id,
item->getName(),
- item->LLInventoryItem::getDescription(),
+ item->getActualDescription(),
LLAssetType::AT_LINK, cb);
break;
}
@@ -1718,7 +1718,7 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid,
item->getLinkedUUID(),
cat_uuid,
item->getName(),
- item->LLInventoryItem::getDescription(),
+ item->getActualDescription(),
LLAssetType::AT_LINK,
cb);
@@ -1902,7 +1902,7 @@ static void remove_non_link_items(LLInventoryModel::item_array_t &items)
}
//a predicate for sorting inventory items by actual descriptions
-bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* item2)
+bool sort_by_actual_description(const LLInventoryItem* item1, const LLInventoryItem* item2)
{
if (!item1 || !item2)
{
@@ -1910,7 +1910,7 @@ bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* it
return true;
}
- return item1->LLInventoryItem::getDescription() < item2->LLInventoryItem::getDescription();
+ return item1->getActualDescription() < item2->getActualDescription();
}
void item_array_diff(LLInventoryModel::item_array_t& full_list,
@@ -2345,10 +2345,11 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor
class LLDeferredCOFLinkObserver: public LLInventoryObserver
{
public:
- LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer<LLInventoryCallback> cb = NULL):
+ LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer<LLInventoryCallback> cb = NULL, std::string description = ""):
mItemID(item_id),
mDoUpdate(do_update),
- mCallback(cb)
+ mCallback(cb),
+ mDescription(description)
{
}
@@ -2370,23 +2371,24 @@ public:
private:
const LLUUID mItemID;
bool mDoUpdate;
+ std::string mDescription;
LLPointer<LLInventoryCallback> mCallback;
};
// BAP - note that this runs asynchronously if the item is not already loaded from inventory.
// Dangerous if caller assumes link will exist after calling the function.
-void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer<LLInventoryCallback> cb)
+void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer<LLInventoryCallback> cb, const std::string description)
{
const LLInventoryItem *item = gInventory.getItem(item_id);
if (!item)
{
- LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb);
+ LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb, description);
gInventory.addObserver(observer);
}
else
{
- addCOFItemLink(item, do_update, cb);
+ addCOFItemLink(item, do_update, cb, description);
}
}
@@ -2409,8 +2411,9 @@ void modified_cof_cb(const LLUUID& inv_item)
}
}
-void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer<LLInventoryCallback> cb)
+void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer<LLInventoryCallback> cb, const std::string description)
{
+ std::string link_description = description;
const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item);
if (!vitem)
{
@@ -2474,18 +2477,48 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
{
cb = new LLBoostFuncInventoryCallback(modified_cof_cb);
}
- const std::string description = vitem->getIsLinkType() ? vitem->getDescription() : "";
+ if (vitem->getIsLinkType())
+ {
+ link_description = vitem->getActualDescription();
+ }
link_inventory_item( gAgent.getID(),
vitem->getLinkedUUID(),
getCOF(),
vitem->getName(),
- description,
+ link_description,
LLAssetType::AT_LINK,
cb);
}
return;
}
+LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& item_id)
+{
+
+ LLInventoryModel::item_array_t result;
+ const LLViewerInventoryItem *vitem =
+ dynamic_cast<const LLViewerInventoryItem*>(gInventory.getItem(item_id));
+
+ if (vitem)
+ {
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(LLAppearanceMgr::getCOF(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ for (S32 i=0; i<item_array.count(); i++)
+ {
+ const LLViewerInventoryItem* inv_item = item_array.get(i).get();
+ if (inv_item->getLinkedUUID() == vitem->getLinkedUUID())
+ {
+ result.put(item_array.get(i));
+ }
+ }
+ }
+ return result;
+}
+
void LLAppearanceMgr::removeAllClothesFromAvatar()
{
// Fetch worn clothes (i.e. the ones in COF).
@@ -2644,7 +2677,7 @@ void LLAppearanceMgr::updateIsDirty()
if (item1->getLinkedUUID() != item2->getLinkedUUID() ||
item1->getName() != item2->getName() ||
- item1->LLInventoryItem::getDescription() != item2->LLInventoryItem::getDescription())
+ item1->getActualDescription() != item2->getActualDescription())
{
mOutfitIsDirty = true;
return;
@@ -2855,8 +2888,8 @@ struct WearablesOrderComparator
return true;
}
- const std::string& desc1 = item1->LLInventoryItem::getDescription();
- const std::string& desc2 = item2->LLInventoryItem::getDescription();
+ const std::string& desc1 = item1->getActualDescription();
+ const std::string& desc2 = item2->getActualDescription();
bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]);
bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]);
@@ -2914,7 +2947,7 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base
if (!item) continue;
std::string new_order_str = build_order_string((LLWearableType::EType)type, i);
- if (new_order_str == item->LLInventoryItem::getDescription()) continue;
+ if (new_order_str == item->getActualDescription()) continue;
item->setDescription(new_order_str);
item->setComplete(TRUE);
@@ -3179,8 +3212,8 @@ bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_b
closer_to_body ? --it : ++it;
LLViewerInventoryItem* swap_item = *it;
if (!swap_item) return false;
- std::string tmp = swap_item->LLInventoryItem::getDescription();
- swap_item->setDescription(item->LLInventoryItem::getDescription());
+ std::string tmp = swap_item->getActualDescription();
+ swap_item->setDescription(item->getActualDescription());
item->setDescription(tmp);
@@ -3213,7 +3246,7 @@ void LLAppearanceMgr::sortItemsByActualDescription(LLInventoryModel::item_array_
{
if (items.size() < 2) return;
- std::sort(items.begin(), items.end(), sort_by_description);
+ std::sort(items.begin(), items.end(), sort_by_actual_description);
}
//#define DUMP_CAT_VERBOSE
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 31dbce892a..bb4c9ee5a2 100755
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -129,9 +129,12 @@ public:
LLPointer<LLInventoryCallback> cb);
// Add COF link to individual item.
- void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL);
- void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL);
+ void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL, const std::string description = "");
+ void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL, const std::string description = "");
+ // Find COF entries referencing the given item.
+ LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id);
+
// Remove COF entries
void removeCOFItemLinks(const LLUUID& item_id);
void removeCOFLinksOfType(LLWearableType::EType type);
diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp
index 26041767fd..0601796436 100644
--- a/indra/newview/llinventorylistitem.cpp
+++ b/indra/newview/llinventorylistitem.cpp
@@ -231,7 +231,7 @@ const std::string& LLPanelInventoryListItemBase::getDescription() const
{
return LLStringUtil::null;
}
- return inv_item->getDescription();
+ return inv_item->getActualDescription();
}
time_t LLPanelInventoryListItemBase::getCreationDate() const
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 606e78bd58..fe4b55bb5a 100644..100755
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -1056,16 +1056,47 @@ void LLPanelEditWearable::saveChanges(bool force_save_as)
U32 index = gAgentWearables.getWearableIndex(mWearablePtr);
std::string new_name = mNameEditor->getText();
+
+ // Find an existing link to this wearable's inventory item, if any, and its description field.
+ LLInventoryItem *link_item = NULL;
+ std::string description;
+ LLInventoryModel::item_array_t links =
+ LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID());
+ if (links.size()>0)
+ {
+ link_item = links.get(0).get();
+ if (link_item && link_item->getIsLinkType())
+ {
+ description = link_item->getActualDescription();
+ }
+ }
+
if (force_save_as)
{
- // the name of the wearable has changed, re-save wearable with new name
- LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID());
- gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE);
- mNameEditor->setText(mWearableItem->getName());
+ // the name of the wearable has changed, re-save wearable with new name
+ LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID());
+ gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, description, FALSE);
+ mNameEditor->setText(mWearableItem->getName());
}
else
{
- gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name);
+ // Make another copy of this link, with the same
+ // description. This is needed to bump the COF
+ // version so texture baking service knows appearance has changed.
+ if (link_item)
+ {
+ // Create new link
+ link_inventory_item( gAgent.getID(),
+ link_item->getLinkedUUID(),
+ LLAppearanceMgr::instance().getCOF(),
+ link_item->getName(),
+ description,
+ LLAssetType::AT_LINK,
+ NULL);
+ // Remove old link
+ gInventory.purgeObject(link_item->getUUID());
+ }
+ gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name);
}
}