From e82bfbeab428a8a13cf38dd790b9d114279ec6f9 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 19 Sep 2024 19:19:21 +0200 Subject: [PATCH] Ultimately sort out the add/remove buttons in appearance window --- indra/newview/llwearableitemslist.cpp | 37 +++++-------------- indra/newview/llwearableitemslist.h | 5 --- .../xui/en/widgets/cof_wearable_list_item.xml | 2 + 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 0b6350d169..e534f3e651 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -186,7 +186,6 @@ LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item : LLPanelWearableListItem(item, params) , mWornIndicationEnabled(worn_indication_enabled) , mShowWidgets(show_widgets) -, mIsWorn(false) // Make Add/Remove buttons work { if(mShowWidgets) { @@ -211,8 +210,6 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name, // an inventory observer upon link in COF beind added or removed so actual // worn status of a linked item may still remain unchanged. bool is_worn = LLAppearanceMgr::instance().isLinkedInCOF(mInventoryItemUUID); - // Make Add/Remove buttons work - mIsWorn = is_worn; // Better attachment list //if (mWornIndicationEnabled && is_worn) //{ @@ -255,13 +252,10 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name, { setShowWidget(mAddWearableBtn, !is_worn); - // Make Add/Remove buttons work - //// 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, 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(mRemoveWearableBtn, show_remove); if(mHovered) { @@ -549,7 +543,7 @@ FSPanelCOFWearableOutfitListItem::FSPanelCOFWearableOutfitListItem(LLViewerInven bool show_widgets, const FSPanelCOFWearableOutfitListItem::Params& params) : LLPanelWearableOutfitItem(item, worn_indication_enabled, params, show_widgets) -, mWeightCtrl(NULL) +, mWeightCtrl(nullptr) { LLTextBox::Params weight_params = params.item_weight; applyXUILayout(weight_params, this); @@ -570,7 +564,8 @@ bool FSPanelCOFWearableOutfitListItem::postBuild() // Reserve space for 'delete' button event if it is invisible. setRightWidgetsWidth(mWeightCtrl->getRect().getWidth() + 5); - setWidgetsVisible(true); + mWeightCtrl->setVisible(true); + reshapeWidgets(); return true; @@ -591,19 +586,7 @@ void FSPanelCOFWearableOutfitListItem::updateItemWeight(U32 item_weight) void FSPanelCOFWearableOutfitListItem::updateItem(const std::string& name, EItemState item_state) { LLPanelWearableOutfitItem::updateItem(name, item_state); - - setShowWidget("add_wearable", false); - setShowWidget("remove_wearable", mShowWidgets && mIsWorn && mHovered); - setWidgetsVisible(true); - reshapeWidgets(); -} - -//virtual -void FSPanelCOFWearableOutfitListItem::onMouseEnter(S32 x, S32 y, MASK mask) -{ - LLPanelInventoryListItemBase::onMouseEnter(x, y, mask); - setShowWidget("remove_wearable", mShowWidgets && mIsWorn); - setWidgetsVisible(true); + mWeightCtrl->setVisible(true); reshapeWidgets(); } @@ -611,8 +594,8 @@ void FSPanelCOFWearableOutfitListItem::onMouseEnter(S32 x, S32 y, MASK mask) void FSPanelCOFWearableOutfitListItem::onMouseLeave(S32 x, S32 y, MASK mask) { LLPanelInventoryListItemBase::onMouseLeave(x, y, mask); - setShowWidget("remove_wearable", false); - setWidgetsVisible(true); + setWidgetsVisible(false); + mWeightCtrl->setVisible(true); // setWidgetsVisible sets this invisible - make it visible again reshapeWidgets(); } diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index f22f44b40d..36d9685500 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -107,11 +107,7 @@ private: LLButton* mAddWearableBtn = nullptr; LLButton* mRemoveWearableBtn = nullptr; bool mWornIndicationEnabled; - // Make Add/Remove buttons work -protected: bool mShowWidgets; - bool mIsWorn; - // }; class LLPanelDeletableWearableListItem : public LLPanelWearableListItem @@ -259,7 +255,6 @@ public: /*virtual*/ void updateItem(const std::string& name, EItemState item_state = IS_DEFAULT); - /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); protected: diff --git a/indra/newview/skins/default/xui/en/widgets/cof_wearable_list_item.xml b/indra/newview/skins/default/xui/en/widgets/cof_wearable_list_item.xml index c8bcdced25..55c000b5b4 100644 --- a/indra/newview/skins/default/xui/en/widgets/cof_wearable_list_item.xml +++ b/indra/newview/skins/default/xui/en/widgets/cof_wearable_list_item.xml @@ -59,6 +59,7 @@ width="70" />