diff options
| -rw-r--r-- | indra/newview/llfilteredwearablelist.cpp | 30 | ||||
| -rw-r--r-- | indra/newview/llfilteredwearablelist.h | 12 | ||||
| -rw-r--r-- | indra/newview/llinventoryitemslist.h | 5 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 6 | 
4 files changed, 48 insertions, 5 deletions
| diff --git a/indra/newview/llfilteredwearablelist.cpp b/indra/newview/llfilteredwearablelist.cpp index f2af9b5300..e67a6a2b77 100644 --- a/indra/newview/llfilteredwearablelist.cpp +++ b/indra/newview/llfilteredwearablelist.cpp @@ -37,6 +37,7 @@  LLFilteredWearableListManager::LLFilteredWearableListManager(LLInventoryItemsList* list, LLInventoryCollectFunctor* collector)  : mWearableList(list)  , mCollector(collector) +, mListStale(true)  {  	llassert(mWearableList);  	gInventory.addObserver(this); @@ -64,7 +65,16 @@ void LLFilteredWearableListManager::changed(U32 mask)  		return;  	} -	populateList(); +	if (mWearableList->isInVisibleChain() || mWearableList->getForceRefresh()) +	{ +		// Todo: current populateList() is time consuming and changed() is time-sensitive, +		// either move from here or optimize +		populateList(); +	} +	else +	{ +		mListStale = true; +	}  }  void LLFilteredWearableListManager::setFilterCollector(LLInventoryCollectFunctor* collector) @@ -73,13 +83,31 @@ void LLFilteredWearableListManager::setFilterCollector(LLInventoryCollectFunctor  	populateList();  } +void LLFilteredWearableListManager::populateIfNeeded() +{ +	if (mListStale) +	{ +		populateList(); +	} +} + +LLTrace::BlockTimerStatHandle FTM_MANAGER_LIST_POPULATION("Manager List Population"); +  void LLFilteredWearableListManager::populateList()  { +	LL_RECORD_BLOCK_TIME(FTM_MANAGER_LIST_POPULATION); +  	LLInventoryModel::cat_array_t cat_array;  	LLInventoryModel::item_array_t item_array;  	if(mCollector)  	{ +		// Too slow with large inventory! +		// Consider refactoring into "request once, append ids on changed()", since +		// Inventory observer provides ids of changed items this should be possible, +		// but will likely require modifying LLInventoryItemsList to avoid code-repeats. +		// Or make something like "gather everything and filter manually on idle" +		mListStale = false;  		gInventory.collectDescendentsIf(  				gInventory.getRootFolderID(),  				cat_array, diff --git a/indra/newview/llfilteredwearablelist.h b/indra/newview/llfilteredwearablelist.h index f44ab1466f..197302f41d 100644 --- a/indra/newview/llfilteredwearablelist.h +++ b/indra/newview/llfilteredwearablelist.h @@ -52,9 +52,9 @@ public:  	void setFilterCollector(LLInventoryCollectFunctor* collector);  	/** -	 * Populates wearable list with filtered data. -	 */ -	void populateList(); +	* Populates wearable list with filtered data in case there were any updates. +	*/ +	void populateIfNeeded();  	/**  	 * Drop operation @@ -62,8 +62,14 @@ public:  	void holdProgress();  private: +	/** +	* Populates wearable list with filtered data. +	*/ +	void populateList(); +  	LLInventoryItemsList* mWearableList;  	LLInventoryCollectFunctor* mCollector; +	bool mListStale;  };  #endif //LL_LLFILTEREDWEARABLELIST_H diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h index fe05c2ed7c..ce41105f98 100644 --- a/indra/newview/llinventoryitemslist.h +++ b/indra/newview/llinventoryitemslist.h @@ -61,6 +61,11 @@ public:  	 */  	void setForceRefresh(bool force_refresh){ mForceRefresh = force_refresh; } +	/** +	* If refreshes when invisible. +	*/ +	bool getForceRefresh(){ return mForceRefresh;  } +  	virtual bool selectItemByValue(const LLSD& value, bool select = true);  	void updateSelection(); diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 208ee77f2d..3f6bdde127 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -578,7 +578,6 @@ void LLPanelOutfitEdit::onOpen(const LLSD& key)  		// *TODO: this method is called even panel is not visible to user because its parent layout panel is hidden.  		// So, we can defer initializing a bit.  		mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mListViewItemTypes[LVIT_ALL]->collector); -		mWearableListManager->populateList();  		displayCurrentOutfit();  		mInitialized = true;  	} @@ -632,6 +631,10 @@ void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables)  		// Reset mWearableItemsList position to top. See EXT-8180.  		mWearableItemsList->goToTop();  	} +	else +	{ +		mWearableListManager->populateIfNeeded(); +	}  	//switching button bars  	getChildView("no_add_wearables_button_bar")->setVisible( !show_add_wearables); @@ -661,6 +664,7 @@ void LLPanelOutfitEdit::showWearablesListView()  	{  		updateWearablesPanelVerbButtons();  		updateFiltersVisibility(); +		mWearableListManager->populateIfNeeded();  	}  	mListViewBtn->setToggleState(TRUE);  } | 
