Skip to content
Snippets Groups Projects
Commit 66ce337a authored by Andrew Polunin's avatar Andrew Polunin
Browse files

EXT-7914 FIXED (Update context menu for worn clothing in the Edit Outfit panel)

- Removed the following menu items: Move Up a Layer, Move Down a Layer.
- Added 'Replace' menu item.
- Implemented method replaceWearable() - handler for the 'Replace' menu item.

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/642/

--HG--
branch : product-engine
parent 435c7399
Branches
Tags
No related merge requests found
......@@ -165,6 +165,14 @@ class CofClothingContextMenu : public CofContextMenu
}
protected:
static void replaceWearable()
{
static LLButton* show_add_wearables_btn =
LLSideTray::getInstance()->getChild<LLButton>("show_add_wearables_btn");
show_add_wearables_btn->onCommit();
}
/*virtual*/ LLContextMenu* createMenu()
{
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
......@@ -173,8 +181,7 @@ class CofClothingContextMenu : public CofContextMenu
functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);
registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs));
registrar.add("Clothing.MoveUp", boost::bind(moveWearable, selected_id, false));
registrar.add("Clothing.MoveDown", boost::bind(moveWearable, selected_id, true));
registrar.add("Clothing.Replace", boost::bind(replaceWearable));
registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id));
......@@ -194,15 +201,7 @@ class CofClothingContextMenu : public CofContextMenu
std::string param = data.asString();
LLUUID selected_id = mUUIDs.back();
if ("move_up" == param)
{
return gAgentWearables.canMoveWearable(selected_id, false);
}
else if ("move_down" == param)
{
return gAgentWearables.canMoveWearable(selected_id, true);
}
else if ("take_off" == param)
if ("take_off" == param)
{
return get_is_item_worn(selected_id);
}
......@@ -210,15 +209,12 @@ class CofClothingContextMenu : public CofContextMenu
{
return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id);
}
return true;
else if ("replace" == param)
{
return get_is_item_worn(selected_id) && mUUIDs.size() == 1;
}
// We don't use LLAppearanceMgr::moveWearable() directly because
// the item may be invalidated between setting the callback and calling it.
static bool moveWearable(const LLUUID& item_id, bool closer_to_body)
{
LLViewerInventoryItem* item = gInventory.getItem(item_id);
return LLAppearanceMgr::instance().moveWearable(item, closer_to_body);
return true;
}
};
......
......@@ -13,34 +13,24 @@
parameter="take_off" />
</menu_item_call>
<menu_item_call
label="Move Up a Layer"
layout="topleft"
name="move_up">
<on_click
function="Clothing.MoveUp" />
<on_enable
function="Clothing.OnEnable"
parameter="move_up" />
</menu_item_call>
<menu_item_call
label="Move Down a Layer"
label="Edit"
layout="topleft"
name="move_down">
name="edit">
<on_click
function="Clothing.MoveDown" />
function="Clothing.Edit" />
<on_enable
function="Clothing.OnEnable"
parameter="move_down" />
parameter="edit" />
</menu_item_call>
<menu_item_call
label="Edit"
label="Replace"
layout="topleft"
name="edit">
name="replace">
<on_click
function="Clothing.Edit" />
function="Clothing.Replace" />
<on_enable
function="Clothing.OnEnable"
parameter="edit" />
parameter="replace" />
</menu_item_call>
<menu_item_call
label="Create New"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment