Reduce findChild stalls in appearance floater

master
Rye Mutt 2024-07-25 23:24:39 -04:00
parent 005f3bd62a
commit 10e5e56946
13 changed files with 97 additions and 54 deletions

View File

@ -739,13 +739,16 @@ void LLOutfitGallery::onFilterSubStringChanged(const std::string& new_string, co
void LLOutfitGallery::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
{
if (mOutfitMap[base_id])
auto base_it = mOutfitMap.find(base_id);
if (base_it != mOutfitMap.end())
{
mOutfitMap[base_id]->setOutfitWorn(true);
base_it->second->setOutfitWorn(true);
}
if (mOutfitMap[prev_id])
auto prev_it = mOutfitMap.find(prev_id);
if (prev_it != mOutfitMap.end())
{
mOutfitMap[prev_id]->setOutfitWorn(false);
prev_it->second->setOutfitWorn(false);
}
}
@ -859,13 +862,16 @@ void LLOutfitGallery::onChangeOutfitSelection(LLWearableItemsList* list, const L
{
if (mSelectedOutfitUUID == category_id)
return;
if (mOutfitMap[mSelectedOutfitUUID])
auto selected_it = mOutfitMap.find(mSelectedOutfitUUID);
if (selected_it != mOutfitMap.end())
{
mOutfitMap[mSelectedOutfitUUID]->setSelected(false);
selected_it->second->setSelected(false);
}
if (mOutfitMap[category_id])
auto category_it = mOutfitMap.find(category_id);
if (category_it != mOutfitMap.end())
{
mOutfitMap[category_id]->setSelected(true);
category_it->second->setSelected(true);
}
// mSelectedOutfitUUID will be set in LLOutfitListBase::ChangeOutfitSelection
}
@ -887,9 +893,10 @@ bool LLOutfitGallery::canWearSelected()
bool LLOutfitGallery::hasDefaultImage(const LLUUID& outfit_cat_id)
{
if (mOutfitMap[outfit_cat_id])
auto outfit_it = mOutfitMap.find(outfit_cat_id);
if (outfit_it != mOutfitMap.end())
{
return mOutfitMap[outfit_cat_id]->isDefaultImage();
return outfit_it->second->isDefaultImage();
}
return false;
}
@ -937,6 +944,7 @@ LLOutfitGalleryItem::~LLOutfitGalleryItem()
bool LLOutfitGalleryItem::postBuild()
{
mPreviewIcon = getChild<LLIconCtrl>("preview_outfit");
setDefaultImage();
mOutfitNameText = getChild<LLTextBox>("outfit_name");
@ -952,10 +960,12 @@ void LLOutfitGalleryItem::draw()
LLPanel::draw();
// Draw border
LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "OutfitGalleryItemSelected" : "OutfitGalleryItemUnselected", LLColor4::white);
LLRect border = getChildView("preview_outfit")->getRect();
static LLUIColor selected_color = LLUIColorTable::instance().getColor("OutfitGalleryItemSelected", LLColor4::white);
static LLUIColor unselected_color = LLUIColorTable::instance().getColor("OutfitGalleryItemUnselected", LLColor4::white);
const LLColor4& border_color = mSelected ? selected_color : unselected_color;
LLRect border = mPreviewIcon->getRect();
border.mRight = border.mRight + 1;
gl_rect_2d(border, border_color.get(), false);
gl_rect_2d(border, border_color, false);
// If the floater is focused, don't apply its alpha to the texture (STORM-677).
const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
@ -1111,7 +1121,7 @@ bool LLOutfitGalleryItem::setImageAssetId(LLUUID image_asset_id)
{
mImageAssetId = image_asset_id;
mTexturep = texture;
getChildView("preview_outfit")->setVisible(false);
mPreviewIcon->setVisible(false);
mDefaultImage = false;
mImageUpdatePending = (texture->getDiscardLevel() == -1);
return true;
@ -1128,7 +1138,7 @@ void LLOutfitGalleryItem::setDefaultImage()
{
mTexturep = NULL;
mImageAssetId.setNull();
getChildView("preview_outfit")->setVisible(true);
mPreviewIcon->setVisible(true);
mDefaultImage = true;
mImageUpdatePending = false;
}

View File

@ -261,6 +261,7 @@ private:
LLTextBox* mOutfitNameText;
LLTextBox* mOutfitWornText;
LLPanel* mTextBgPanel;
LLIconCtrl* mPreviewIcon = nullptr;
bool mSelected;
bool mWorn;
bool mDefaultImage;

View File

@ -434,6 +434,8 @@ LLPanelOutfitEdit::~LLPanelOutfitEdit()
delete mCOFDragAndDropObserver;
delete mWearableListViewItemsComparator;
while (!mListViewItemTypes.empty()) {
delete mListViewItemTypes.back();
mListViewItemTypes.pop_back();
@ -476,8 +478,11 @@ bool LLPanelOutfitEdit::postBuild()
mFolderViewBtn = getChild<LLButton>("folder_view_btn");
mListViewBtn = getChild<LLButton>("list_view_btn");
mFilterPanel = getChild<LLView>("filter_panel");
mFilterBtn = getChild<LLButton>("filter_button");
mFilterBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this));
childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesFolderView, this), NULL);
childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL);
@ -530,13 +535,17 @@ bool LLPanelOutfitEdit::postBuild()
mSearchFilter = getChild<LLFilterEditor>("look_item_filter");
mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2));
childSetAction("show_add_wearables_btn", boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this));
mShowAddWearablesBtn = getChild<LLButton>("show_add_wearables_btn");
mShowAddWearablesBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this));
mPlusBtn = getChild<LLButton>("plus_btn");
mPlusBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance()));
mNoAddWearablesButtonBar = getChild<LLUICtrl>("no_add_wearables_button_bar");
mAddWearablesButtonBar = getChild<LLUICtrl>("add_wearables_button_bar");
/*
* By default AT_CLOTHING are sorted by (in in MY OUTFITS):
* - by type (types order determined in LLWearableType::EType)
@ -567,7 +576,11 @@ bool LLPanelOutfitEdit::postBuild()
getChild<LLButton>(SAVE_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false));
getChild<LLButton>(SAVE_AS_BTN)->setCommitCallback(boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true));
mLoadingIndicator = getChild<LLLoadingIndicator>("edit_outfit_loading_indicator");
mOutfitNameStatusPanel = getChild<LLPanel>("outfit_name_and_status");
onOutfitChanging(gAgentWearables.isCOFChangeInProgress());
return true;
}
@ -603,15 +616,15 @@ void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables)
{
mAddWearablesPanel->setVisible(show_add_wearables);
getChild<LLUICtrl>("show_add_wearables_btn")->setValue(show_add_wearables);
mShowAddWearablesBtn->setValue(show_add_wearables);
updateFiltersVisibility();
getChildView("filter_button")->setVisible( show_add_wearables);
mFilterBtn->setVisible( show_add_wearables);
//search filter should be disabled
if (!show_add_wearables)
{
getChild<LLUICtrl>("filter_button")->setValue(false);
mFilterBtn->setValue(false);
mFolderViewFilterCmbBox->setVisible(false);
mListViewFilterCmbBox->setVisible(false);
@ -638,15 +651,15 @@ void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables)
}
//switching button bars
getChildView("no_add_wearables_button_bar")->setVisible( !show_add_wearables);
getChildView("add_wearables_button_bar")->setVisible( show_add_wearables);
mNoAddWearablesButtonBar->setVisible( !show_add_wearables);
mAddWearablesButtonBar->setVisible( show_add_wearables);
}
void LLPanelOutfitEdit::showWearablesFilter()
{
bool filter_visible = getChild<LLUICtrl>("filter_button")->getValue();
bool filter_visible = mFilterBtn->getValue();
getChildView("filter_panel")->setVisible( filter_visible);
mFilterPanel->setVisible(filter_visible);
if(!filter_visible)
{
@ -1309,19 +1322,17 @@ static void update_status_widget_rect(LLView * widget, S32 right_border)
void LLPanelOutfitEdit::onOutfitChanging(bool started)
{
static LLLoadingIndicator* indicator = getChild<LLLoadingIndicator>("edit_outfit_loading_indicator");
static LLView* status_panel = getChild<LLView>("outfit_name_and_status");
static S32 indicator_delta = status_panel->getRect().getWidth() - indicator->getRect().mLeft;
S32 indicator_delta = mOutfitNameStatusPanel->getRect().getWidth() - mLoadingIndicator->getRect().mLeft;
S32 delta = started ? indicator_delta : 0;
S32 right_border = status_panel->getRect().getWidth() - delta;
S32 right_border = mOutfitNameStatusPanel->getRect().getWidth() - delta;
if (mCurrentOutfitName)
update_status_widget_rect(mCurrentOutfitName, right_border);
if (mStatus)
update_status_widget_rect(mStatus, right_border);
indicator->setVisible(started);
mLoadingIndicator->setVisible(started);
}
void LLPanelOutfitEdit::getCurrentItemUUID(LLUUID& selected_id)

View File

@ -59,6 +59,7 @@ class LLMenuGL;
class LLFindNonLinksByMask;
class LLFindWearablesOfType;
class LLWearableItemTypeNameComparator;
class LLLoadingIndicator;
class LLPanelOutfitEdit : public LLPanel
{
@ -218,7 +219,14 @@ private:
LLButton* mFolderViewBtn;
LLButton* mListViewBtn;
LLButton* mPlusBtn;
LLButton* mShowAddWearablesBtn = nullptr;
LLButton* mFilterBtn = nullptr;
LLPanel* mAddWearablesPanel;
LLPanel* mOutfitNameStatusPanel = nullptr;
LLLoadingIndicator* mLoadingIndicator = nullptr;
LLView* mFilterPanel = nullptr;
LLUICtrl* mNoAddWearablesButtonBar = nullptr;
LLUICtrl* mAddWearablesButtonBar = nullptr;
LLComboBox* mFolderViewFilterCmbBox;
LLComboBox* mListViewFilterCmbBox;

View File

@ -252,7 +252,8 @@ void LLPanelOutfitsInventory::openApearanceTab(const std::string& tab_name)
void LLPanelOutfitsInventory::initListCommandsHandlers()
{
mListCommands = getChild<LLPanel>("bottom_panel");
mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
mWearBtn = mListCommands->getChild<LLButton>("wear_btn");
mWearBtn->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
mOutfitGalleryPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
}
@ -263,14 +264,13 @@ void LLPanelOutfitsInventory::updateListCommands()
bool wear_enabled = isActionEnabled("wear");
bool wear_visible = !isCOFPanelActive();
bool make_outfit_enabled = isActionEnabled("save_outfit");
LLButton* wear_btn = mListCommands->getChild<LLButton>("wear_btn");
mMyOutfitsPanel->childSetEnabled("trash_btn", trash_enabled);
mOutfitGalleryPanel->childSetEnabled("trash_btn", trash_enabled);
wear_btn->setEnabled(wear_enabled);
wear_btn->setVisible(wear_visible);
mWearBtn->setEnabled(wear_enabled);
mWearBtn->setVisible(wear_visible);
getChild<LLButton>(SAVE_BTN)->setEnabled(make_outfit_enabled);
wear_btn->setToolTip(getString((!isOutfitsGalleryPanelActive() && mMyOutfitsPanel->hasItemSelected()) ? "wear_items_tooltip" : "wear_outfit_tooltip"));
mWearBtn->setToolTip(getString((!isOutfitsGalleryPanelActive() && mMyOutfitsPanel->hasItemSelected()) ? "wear_items_tooltip" : "wear_outfit_tooltip"));
}
void LLPanelOutfitsInventory::onTrashButtonClick()

View File

@ -101,6 +101,7 @@ protected:
private:
LLPanel* mListCommands;
LLMenuGL* mMenuAdd;
LLButton* mWearBtn = nullptr;
// List Commands //
//////////////////////////////////////////////////////////////////////////////////

View File

@ -51,12 +51,13 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan
else
buildFromFile( "panel_scrolling_param_base.xml");
getChild<LLUICtrl>("param slider")->setValue(weightToPercent(param->getWeight()));
mParamSlider = getChild<LLUICtrl>("param slider");
mParamSlider->setValue(weightToPercent(param->getWeight()));
std::string display_name = LLTrans::getString(param->getDisplayName());
getChild<LLUICtrl>("param slider")->setLabelArg("[DESC]", display_name);
getChildView("param slider")->setEnabled(mAllowModify);
childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this);
mParamSlider->setLabelArg("[DESC]", display_name);
mParamSlider->setEnabled(mAllowModify);
mParamSlider->setCommitCallback(LLScrollingPanelParamBase::onSliderMoved, this);
setVisible(false);
setBorderVisible( false );
@ -77,9 +78,9 @@ void LLScrollingPanelParamBase::updatePanel(bool allow_modify)
}
F32 current_weight = mWearable->getVisualParamWeight( param->getID() );
getChild<LLUICtrl>("param slider")->setValue(weightToPercent( current_weight ) );
mParamSlider->setValue(weightToPercent( current_weight ) );
mAllowModify = allow_modify;
getChildView("param slider")->setEnabled(mAllowModify);
mParamSlider->setEnabled(mAllowModify);
}
// static

View File

@ -55,6 +55,7 @@ public:
public:
LLViewerVisualParam* mParam;
protected:
LLUICtrl* mParamSlider = nullptr;
bool mAllowModify;
LLWearable *mWearable;
};

View File

@ -39,6 +39,7 @@
#include "llfloaterreg.h"
#include "llfloaterworldmap.h"
#include "llfolderviewmodel.h"
#include "llloadingindicator.h"
#include "lloutfitobserver.h"
#include "llpaneleditwearable.h"
#include "llpaneloutfitsinventory.h"
@ -137,6 +138,8 @@ bool LLSidepanelAppearance::postBuild()
mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
mWearableLoadingIndicator = getChild<LLLoadingIndicator>("wearables_loading_indicator");
mEditOutfitBtn = getChild<LLButton>("edit_outfit_btn");
setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChanged,this,_2));
@ -541,8 +544,8 @@ void LLSidepanelAppearance::inventoryFetched()
void LLSidepanelAppearance::setWearablesLoading(bool val)
{
getChildView("wearables_loading_indicator")->setVisible( val);
getChildView("edit_outfit_btn")->setVisible( !val);
mWearableLoadingIndicator->setVisible(val);
mEditOutfitBtn->setVisible(!val);
if (!val)
{

View File

@ -38,6 +38,7 @@ class LLCurrentlyWornFetchObserver;
class LLPanelEditWearable;
class LLViewerWearable;
class LLPanelOutfitsInventory;
class LLLoadingIndicator;
class LLSidepanelAppearance : public LLPanel
{
@ -86,8 +87,11 @@ private:
LLButton* mOpenOutfitBtn;
LLButton* mEditAppearanceBtn;
LLButton* mEditOutfitBtn = nullptr;
LLPanel* mCurrOutfitPanel;
LLLoadingIndicator* mWearableLoadingIndicator = nullptr;
LLTextBox* mCurrentLookName;
LLTextBox* mOutfitStatus;

View File

@ -102,15 +102,21 @@ LLPanelWearableOutfitItem::Params::Params()
bool LLPanelWearableOutfitItem::postBuild()
{
if (mShowWidgets)
{
mAddWearableBtn = getChild<LLButton>("add_wearable");
mRemoveWearableBtn = getChild<LLButton>("remove_wearable");
}
LLPanelWearableListItem::postBuild();
if(mShowWidgets)
{
addWidgetToRightSide("add_wearable");
addWidgetToRightSide("remove_wearable");
addWidgetToRightSide(mAddWearableBtn);
addWidgetToRightSide(mRemoveWearableBtn);
childSetAction("add_wearable", boost::bind(&LLPanelWearableOutfitItem::onAddWearable, this));
childSetAction("remove_wearable", boost::bind(&LLPanelWearableOutfitItem::onRemoveWearable, this));
mAddWearableBtn->setClickedCallback(boost::bind(&LLPanelWearableOutfitItem::onAddWearable, this));
mRemoveWearableBtn->setClickedCallback(boost::bind(&LLPanelWearableOutfitItem::onRemoveWearable, this));
setWidgetsVisible(false);
reshapeWidgets();
@ -205,12 +211,12 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name,
}
if(mShowWidgets)
{
setShowWidget("add_wearable", !is_worn);
setShowWidget(mAddWearableBtn, !is_worn);
// Body parts can't be removed, only replaced
LLViewerInventoryItem* inv_item = getItem();
bool show_remove = is_worn && inv_item && (inv_item->getType() != LLAssetType::AT_BODYPART);
setShowWidget("remove_wearable", show_remove);
setShowWidget(mRemoveWearableBtn, show_remove);
if(mHovered)
{

View File

@ -104,6 +104,8 @@ protected:
bool worn_indication_enabled, const Params& params, bool show_widgets = false);
private:
LLButton* mAddWearableBtn = nullptr;
LLButton* mRemoveWearableBtn = nullptr;
bool mWornIndicationEnabled;
bool mShowWidgets;
};

View File

@ -33,7 +33,6 @@
top="0"
width="313" >
<check_box
control_name="LowerAlphaTextureInvisible"
follows="left|top"
height="16"
layout="topleft"
@ -58,7 +57,6 @@
</texture_picker>
<check_box
control_name="UpperAlphaTextureInvisible"
follows="left|top"
height="16"
layout="topleft"
@ -83,7 +81,6 @@
</texture_picker>
<check_box
control_name="HeadAlphaTextureInvisible"
follows="left|top"
height="16"
layout="topleft"
@ -108,7 +105,6 @@
</texture_picker>
<check_box
control_name="Eye AlphaTextureInvisible"
follows="left|top"
height="16"
layout="topleft"
@ -133,7 +129,6 @@
</texture_picker>
<check_box
control_name="HairAlphaTextureInvisible"
follows="left|top"
height="16"
layout="topleft"