diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-01-16 11:34:42 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-01-16 11:34:42 -0500 |
commit | 6a8947679cdb3a3d6ce9d4d175a2bdfed4b7eee3 (patch) | |
tree | 79d985e8e1182052fea3d917de4d2031eca4d720 /indra/newview/llpaneleditwearable.cpp | |
parent | f48011e4d04f744a93a18267bf7b78ec0b717b7c (diff) |
SH-3645 WIP - preserve item order after wearable save as
Diffstat (limited to 'indra/newview/llpaneleditwearable.cpp')
-rwxr-xr-x | indra/newview/llpaneleditwearable.cpp | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index cca3b90329..fe4b55bb5a 100755 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1056,36 +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 { - LLInventoryModel::item_array_t links = - LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); - if (links.size()>0) + // 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) { - // Make another copy of this link, with the same description. - LLInventoryItem *item = links.get(0).get(); - if (item) - { - const std::string description = item->getIsLinkType() ? item->getActualDescription() : ""; - link_inventory_item( gAgent.getID(), - item->getLinkedUUID(), - LLAppearanceMgr::instance().getCOF(), - item->getName(), - description, - LLAssetType::AT_LINK, - NULL); - gInventory.purgeObject(item->getUUID()); - } + // 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); - } } |