diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 46 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 21 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfit_edit.xml | 1 |
3 files changed, 51 insertions, 17 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index f96750fb0b..74d9e895c2 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -154,7 +154,8 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mShowEmptyMessage(p.show_empty_message), mSuppressFolderMenu(p.suppress_folder_menu), mSuppressOpenItemAction(false), - mViewsInitialized(false), + mBuildViewsOnInit(p.preinitialize_views), + mViewsInitialized(VIEWS_UNINITIALIZED), mInvFVBridgeBuilder(NULL), mInventoryViewModel(p.name), mGroupedItemBridge(new LLFolderViewGroupedItemBridge) @@ -281,14 +282,22 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) mCompletionObserver = new LLInvPanelComplObserver(boost::bind(&LLInventoryPanel::onItemsCompletion, this)); mInventory->addObserver(mCompletionObserver); - // Build view of inventory if we need default full hierarchy and inventory ready, otherwise do in onIdle. - // Initializing views takes a while so always do it onIdle if viewer already loaded. - if (mInventory->isInventoryUsable() && !mViewsInitialized && LLStartUp::getStartupState() <= STATE_WEARABLES_WAIT) - { - initializeViews(); - } - - gIdleCallbacks.addFunction(onIdle, (void*)this); + if (mBuildViewsOnInit) + { + // Build view of inventory if we need default full hierarchy and inventory is ready, otherwise do in onIdle. + // Initializing views takes a while so always do it onIdle if viewer already loaded. + if (mInventory->isInventoryUsable() + && mViewsInitialized == VIEWS_UNINITIALIZED + && LLStartUp::getStartupState() <= STATE_WEARABLES_WAIT) + { + initializeViews(); + } + else if (mViewsInitialized != VIEWS_INITIALIZING) + { + mViewsInitialized = VIEWS_INITIALIZING; + gIdleCallbacks.addFunction(onIdle, (void*)this); + } + } if (mSortOrderSetting != INHERIT_SORT_ORDER) { @@ -334,6 +343,17 @@ LLInventoryPanel::~LLInventoryPanel() clearFolderRoot(); } +/*virtual*/ +void LLInventoryPanel::onVisibilityChange(BOOL new_visibility) +{ + if (new_visibility && mViewsInitialized == VIEWS_UNINITIALIZED) + { + mViewsInitialized = VIEWS_INITIALIZING; + gIdleCallbacks.addFunction(onIdle, (void*)this); + } + LLPanel::onVisibilityChange(new_visibility); +} + void LLInventoryPanel::draw() { // Select the desired item (in case it wasn't loaded when the selection was requested) @@ -657,7 +677,7 @@ void LLInventoryPanel::modelChanged(U32 mask) { LL_RECORD_BLOCK_TIME(FTM_REFRESH); - if (!mViewsInitialized) return; + if (mViewsInitialized != VIEWS_INITIALIZED) return; const LLInventoryModel* model = getModel(); if (!model) return; @@ -723,11 +743,11 @@ void LLInventoryPanel::onIdle(void *userdata) LLInventoryPanel *self = (LLInventoryPanel*)userdata; // Inventory just initialized, do complete build - if (!self->mViewsInitialized) + if (self->mViewsInitialized != VIEWS_INITIALIZED) { self->initializeViews(); } - if (self->mViewsInitialized) + if (self->mViewsInitialized == VIEWS_INITIALIZED) { gIdleCallbacks.deleteFunction(onIdle, (void*)self); } @@ -810,7 +830,7 @@ void LLInventoryPanel::initializeViews() gIdleCallbacks.addFunction(idle, this); - mViewsInitialized = true; + mViewsInitialized = VIEWS_INITIALIZED; openStartFolderOrMyInventory(); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index c202333f45..ad6010f09c 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -108,6 +108,10 @@ public: Optional<LLFolderViewFolder::Params> folder; Optional<LLFolderViewItem::Params> item; + // All item and folder views will be initialized on init if true (default) + // Will initialize on visibility change otherwise. + Optional<bool> preinitialize_views; + Params() : sort_order_setting("sort_order_setting"), inventory("", &gInventory), @@ -126,7 +130,8 @@ public: accepts_drag_and_drop("accepts_drag_and_drop"), folder_view("folder_view"), folder("folder"), - item("item") + item("item"), + preinitialize_views("preinitialize_views", true) {} }; @@ -154,6 +159,7 @@ public: LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; } // LLView methods + /*virtual*/ void onVisibilityChange(BOOL new_visibility); void draw(); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); BOOL handleHover(S32 x, S32 y, MASK mask); @@ -313,7 +319,7 @@ public: void addHideFolderType(LLFolderType::EType folder_type); public: - BOOL getIsViewsInitialized() const { return mViewsInitialized; } + bool getViewsInitialized() const { return mViewsInitialized == VIEWS_INITIALIZED; } protected: // Builds the UI. Call this once the inventory is usable. void initializeViews(); @@ -349,8 +355,15 @@ private: LLFolderViewItem *target_view, LLFolderViewFolder *parent_folder_view); - bool mBuildDefaultHierarchy; // default inventory hierarchy should be created in postBuild() - bool mViewsInitialized; // Views have been generated + typedef enum e_views_initialization_state + { + VIEWS_UNINITIALIZED = 0, + VIEWS_INITIALIZING, + VIEWS_INITIALIZED, + } EViewsInitializationState; + + bool mBuildViewsOnInit; + EViewsInitializationState mViewsInitialized; // Whether views have been generated }; diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index adbeb09935..6fd54d7c6a 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -321,6 +321,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap name="folder_view" top_pad="0" width="313" + preinitialize_views="false" visible="false"/> <panel name="filtered_wearables_panel" background_opaque="true" |