Ultimately sort out the add/remove buttons in appearance window

master
Ansariel 2024-09-19 19:19:21 +02:00
parent e9907f0cbb
commit e82bfbeab4
3 changed files with 12 additions and 32 deletions

View File

@ -186,7 +186,6 @@ LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item
: LLPanelWearableListItem(item, params)
, mWornIndicationEnabled(worn_indication_enabled)
, mShowWidgets(show_widgets)
, mIsWorn(false) // <FS:Ansariel> 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);
// <FS:Ansariel> Make Add/Remove buttons work
mIsWorn = is_worn;
// <FS:Ansariel> Better attachment list
//if (mWornIndicationEnabled && is_worn)
//{
@ -255,13 +252,10 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name,
{
setShowWidget(mAddWearableBtn, !is_worn);
// <FS:Ansariel> 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);
// </FS:Ansariel>
// 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();
}

View File

@ -107,11 +107,7 @@ private:
LLButton* mAddWearableBtn = nullptr;
LLButton* mRemoveWearableBtn = nullptr;
bool mWornIndicationEnabled;
// <FS:Ansariel> Make Add/Remove buttons work
protected:
bool mShowWidgets;
bool mIsWorn;
// </FS:Ansariel>
};
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:

View File

@ -59,6 +59,7 @@
width="70" />
<add_btn
name="add_wearable"
visible="false"
layout="topleft"
follows="top|right"
image_unselected="Add_Icon"
@ -70,6 +71,7 @@
tab_stop="false" />
<remove_btn
name="remove_wearable"
visible="false"
layout="topleft"
follows="top|right"
image_unselected="Remove_Icon"