EXT-7786 FIXED COF Wearables List is updated only when visible (panel outfit eidt)
Every single delete/create operation in the COF causes LLCOFWearables to be updated - on each update its contained LLFlatListView is repopulated. That means massive creation of LLPanel's instances (LLUICtrlFactory::buildPanel(...)). Half of the panel creation time is spent in the EXPAT xml library on parsing the .xml files of the panel item. I've forbidden updates of LLCOFWearables when Panel Outfit Edit is not in the visible chain. Panel Outfit Edit is now updated only when it is visible Also LLCOFWearables refures to refresh its content if COF category version hasn't been changed since the last refresh. Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/715 --HG-- branch : product-enginemeow-7.2.2
parent
b6b0465bbc
commit
eaf114fdfd
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue