diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-07-19 17:15:32 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2010-07-19 17:15:32 -0400 |
commit | 1dae91d7354aef57625e3508b23a4bb21de242e8 (patch) | |
tree | 6759f56f1a65b00a92522550c0ef30c09c147f08 /indra/newview | |
parent | d4845c1d263c07aaa0b8c2c638cd2a214e166bdd (diff) |
EXT-8360 WIP - propagating COF item name changes various places
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llcofwearables.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lloutfitobserver.cpp | 42 | ||||
-rw-r--r-- | indra/newview/lloutfitobserver.h | 5 | ||||
-rw-r--r-- | indra/newview/llpaneleditwearable.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 2 |
6 files changed, 50 insertions, 10 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index a7d90ab8d3..d2449abf08 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2209,6 +2209,7 @@ void LLAppearanceMgr::updateIsDirty() LLViewerInventoryItem *item2 = outfit_items.get(i); if (item1->getLinkedUUID() != item2->getLinkedUUID() || + item1->getName() != item2->getName() || item1->LLInventoryItem::getDescription() != item2->LLInventoryItem::getDescription()) { mOutfitIsDirty = true; diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 86d9121213..0e03fd8833 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -393,7 +393,7 @@ void LLCOFWearables::refresh() return; } - if (mCOFVersion == catp->getVersion()) return; + //if (mCOFVersion == catp->getVersion()) return; mCOFVersion = catp->getVersion(); typedef std::vector<LLSD> values_vector_t; diff --git a/indra/newview/lloutfitobserver.cpp b/indra/newview/lloutfitobserver.cpp index 03414b9964..99835edad2 100644 --- a/indra/newview/lloutfitobserver.cpp +++ b/indra/newview/lloutfitobserver.cpp @@ -40,6 +40,7 @@ LLOutfitObserver::LLOutfitObserver() : mCOFLastVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { + mItemNameHash.finalize(); gInventory.addObserver(this); } @@ -87,13 +88,25 @@ bool LLOutfitObserver::checkCOF() if (cof.isNull()) return false; + bool cof_changed = false; + LLMD5 itemNameHash; + hashItemNames(itemNameHash); + if (itemNameHash != mItemNameHash) + { + cof_changed = true; + mItemNameHash = itemNameHash; + } + S32 cof_version = getCategoryVersion(cof); + if (cof_version != mCOFLastVersion) + { + cof_changed = true; + mCOFLastVersion = cof_version; + } - if (cof_version == mCOFLastVersion) + if (!cof_changed) return false; - - mCOFLastVersion = cof_version; - + // dirtiness state should be updated before sending signal LLAppearanceMgr::getInstance()->updateIsDirty(); mCOFChanged(); @@ -101,6 +114,27 @@ bool LLOutfitObserver::checkCOF() return true; } +void LLOutfitObserver::hashItemNames(LLMD5& itemNameHash) +{ + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), + cat_array, + item_array, + false); + for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); + iter != item_array.end(); + iter++) + { + const LLViewerInventoryItem *item = (*iter); + if (!item) + continue; + const std::string& name = item->getName(); + itemNameHash.update(name); + } + itemNameHash.finalize(); +} + void LLOutfitObserver::checkBaseOutfit() { LLUUID baseoutfit_id = diff --git a/indra/newview/lloutfitobserver.h b/indra/newview/lloutfitobserver.h index 3a66b5ea9f..f526609135 100644 --- a/indra/newview/lloutfitobserver.h +++ b/indra/newview/lloutfitobserver.h @@ -34,6 +34,7 @@ #define LL_OUTFITOBSERVER_H #include "llsingleton.h" +#include "llmd5.h" /** * Outfit observer facade that provides simple possibility to subscribe on @@ -72,6 +73,8 @@ protected: bool checkCOF(); + void hashItemNames(LLMD5& itemNameHash); + void checkBaseOutfit(); //last version number of a COF category @@ -84,6 +87,8 @@ protected: bool mLastOutfitDirtiness; + LLMD5 mItemNameHash; + private: signal_t mBOFReplaced; signal_t mBOFChanged; diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index f7e8a7b1a7..ddb5f49ab0 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -786,7 +786,7 @@ BOOL LLPanelEditWearable::isDirty() const if (mWearablePtr) { if (mWearablePtr->isDirty() || - mWearablePtr->getName().compare(mNameEditor->getText()) != 0) + mWearableItem->getName().compare(mNameEditor->getText()) != 0) { isDirty = TRUE; } @@ -987,7 +987,7 @@ void LLPanelEditWearable::saveChanges(bool 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, new_name, FALSE); - mNameEditor->setText(mWearablePtr->getName()); + mNameEditor->setText(mWearableItem->getName()); } else { @@ -1004,7 +1004,7 @@ void LLPanelEditWearable::revertChanges() } mWearablePtr->revertValues(); - mNameEditor->setText(mWearablePtr->getName()); + mNameEditor->setText(mWearableItem->getName()); updatePanelPickerControls(mWearablePtr->getType()); updateTypeSpecificControls(mWearablePtr->getType()); gAgentAvatarp->wearableUpdated(mWearablePtr->getType(), FALSE); @@ -1050,7 +1050,7 @@ void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show) mDescTitle->setText(description_title); // set name - mNameEditor->setText(wearable->getName()); + mNameEditor->setText(mWearableItem->getName()); updatePanelPickerControls(type); updateTypeSpecificControls(type); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 937b794686..bb8c01bccf 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -1088,7 +1088,7 @@ void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list) void LLPanelOutfitEdit::onCOFChanged() { //the panel is only updated when is visible to a user - if (!isInVisibleChain()) return; +// if (!isInVisibleChain()) return; update(); } |