summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llcofwearables.cpp22
-rw-r--r--indra/newview/llcofwearables.h4
-rw-r--r--indra/newview/llpaneloutfitedit.cpp19
-rw-r--r--indra/newview/llpaneloutfitedit.h3
4 files changed, 42 insertions, 6 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 4c0f51056d..f613fae42d 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -283,7 +283,8 @@ LLCOFWearables::LLCOFWearables() : LLPanel(),
mClothingTab(NULL),
mAttachmentsTab(NULL),
mBodyPartsTab(NULL),
- mLastSelectedTab(NULL)
+ mLastSelectedTab(NULL),
+ mCOFVersion(-1)
{
mClothingMenu = new CofClothingContextMenu(this);
mAttachmentMenu = new CofAttachmentContextMenu(this);
@@ -378,6 +379,23 @@ void LLCOFWearables::onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expa
void LLCOFWearables::refresh()
{
+ const LLUUID cof_id = LLAppearanceMgr::instance().getCOF();
+ if (cof_id.isNull())
+ {
+ llwarns << "COF ID cannot be NULL" << llendl;
+ return;
+ }
+
+ LLViewerInventoryCategory* catp = gInventory.getCategory(cof_id);
+ if (!catp)
+ {
+ llwarns << "COF category cannot be NULL" << llendl;
+ return;
+ }
+
+ if (mCOFVersion == catp->getVersion()) return;
+ mCOFVersion = catp->getVersion();
+
typedef std::vector<LLSD> values_vector_t;
typedef std::map<LLFlatListView*, values_vector_t> selection_map_t;
@@ -393,7 +411,7 @@ void LLCOFWearables::refresh()
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t cof_items;
- gInventory.collectDescendents(LLAppearanceMgr::getInstance()->getCOF(), cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
+ gInventory.collectDescendents(cof_id, cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
populateAttachmentsAndBodypartsLists(cof_items);
diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h
index 0518d59df3..d005b75eaa 100644
--- a/indra/newview/llcofwearables.h
+++ b/indra/newview/llcofwearables.h
@@ -81,6 +81,7 @@ public:
LLPanel* getSelectedItem();
void getSelectedItems(std::vector<LLPanel*>& selected_items) const;
+ /* Repopulate the COF wearables list if the COF category has been changed since the last refresh */
void refresh();
void clear();
@@ -123,6 +124,9 @@ protected:
LLListContextMenu* mClothingMenu;
LLListContextMenu* mAttachmentMenu;
LLListContextMenu* mBodyPartMenu;
+
+ /* COF category version since last refresh */
+ S32 mCOFVersion;
};
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index f8350a56ef..827ecb1c92 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -263,7 +263,7 @@ LLPanelOutfitEdit::LLPanelOutfitEdit()
observer.addBOFReplacedCallback(boost::bind(&LLPanelOutfitEdit::updateCurrentOutfitName, this));
observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this));
- observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::update, this));
+ observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::onCOFChanged, this));
gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true));
gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false));
@@ -331,7 +331,7 @@ BOOL LLPanelOutfitEdit::postBuild()
childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
- setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this));
+ setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2));
mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
@@ -583,11 +583,16 @@ void LLPanelOutfitEdit::onPlusBtnClicked(void)
}
}
-void LLPanelOutfitEdit::onVisibilityChange()
+void LLPanelOutfitEdit::onVisibilityChange(const LLSD &in_visible_chain)
{
showAddWearablesPanel(false);
mWearableItemsList->resetSelection();
mInventoryItemsPanel->clearSelection();
+
+ if (in_visible_chain.asBoolean())
+ {
+ update();
+ }
}
void LLPanelOutfitEdit::onAddWearableClicked(void)
@@ -1014,5 +1019,13 @@ void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list)
// return selected_id;
}
+void LLPanelOutfitEdit::onCOFChanged()
+{
+ //the panel is only updated when is visible to a user
+ if (!isInVisibleChain()) return;
+
+ update();
+}
+
// EOF
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index fb9a35411c..1eef211276 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -148,7 +148,7 @@ public:
void onInventorySelectionChange();
void onPlusBtnClicked(void);
- void onVisibilityChange();
+ void onVisibilityChange(const LLSD &in_visible_chain);
void applyFolderViewFilter(EFolderViewItemType type);
void applyListViewFilter(EListViewItemType type);
@@ -196,6 +196,7 @@ private:
void onOutfitChanging(bool started);
void getSelectedItemsUUID(uuid_vec_t& uuid_list);
void getCurrentItemUUID(LLUUID& selected_id);
+ void onCOFChanged();
LLTextBox* mCurrentOutfitName;
LLTextBox* mStatus;