diff options
Diffstat (limited to 'indra/newview/llpaneleditwearable.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/newview/llpaneleditwearable.cpp | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index fd41d08102..a49bbcd924 100644..100755 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -885,7 +885,10 @@ void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_c void LLPanelEditWearable::onBackButtonClicked(void* userdata) { LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata; - panel->saveChanges(true); + if ( panel->isDirty() ) + { + LLAppearanceMgr::instance().setOutfitDirty( true ); + } } //static @@ -1050,26 +1053,57 @@ void LLPanelEditWearable::incrementCofVersionLegacy() void LLPanelEditWearable::saveChanges(bool force_save_as) { - if (!mWearablePtr || !isDirty()) - { - // do nothing if no unsaved changes - return; - } + if (!mWearablePtr || !isDirty()) + { + // do nothing if no unsaved changes + return; + } - U32 index = gAgentWearables.getWearableIndex(mWearablePtr); + U32 index = gAgentWearables.getWearableIndex(mWearablePtr); - 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()); - gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE); - mNameEditor->setText(mWearableItem->getName()); - } - else - { - gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); - } + 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, description, FALSE); + mNameEditor->setText(mWearableItem->getName()); + } + else + { + // 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); + } if (gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion() > 0) { @@ -1214,7 +1248,7 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BO void LLPanelEditWearable::showDefaultSubpart() { - changeCamera(3); + changeCamera(0); } void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index) |