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
No related branches found
No related tags found
No related merge requests found
...@@ -165,6 +165,14 @@ class CofClothingContextMenu : public CofContextMenu ...@@ -165,6 +165,14 @@ class CofClothingContextMenu : public CofContextMenu
} }
protected: 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() /*virtual*/ LLContextMenu* createMenu()
{ {
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
...@@ -173,8 +181,7 @@ class CofClothingContextMenu : public CofContextMenu ...@@ -173,8 +181,7 @@ class CofClothingContextMenu : public CofContextMenu
functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1); functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);
registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs)); registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs));
registrar.add("Clothing.MoveUp", boost::bind(moveWearable, selected_id, false)); registrar.add("Clothing.Replace", boost::bind(replaceWearable));
registrar.add("Clothing.MoveDown", boost::bind(moveWearable, selected_id, true));
registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id)); registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id)); registrar.add("Clothing.Create", boost::bind(&CofClothingContextMenu::createNew, this, selected_id));
...@@ -194,15 +201,7 @@ class CofClothingContextMenu : public CofContextMenu ...@@ -194,15 +201,7 @@ class CofClothingContextMenu : public CofContextMenu
std::string param = data.asString(); std::string param = data.asString();
LLUUID selected_id = mUUIDs.back(); LLUUID selected_id = mUUIDs.back();
if ("move_up" == param) if ("take_off" == param)
{
return gAgentWearables.canMoveWearable(selected_id, false);
}
else if ("move_down" == param)
{
return gAgentWearables.canMoveWearable(selected_id, true);
}
else if ("take_off" == param)
{ {
return get_is_item_worn(selected_id); return get_is_item_worn(selected_id);
} }
...@@ -210,15 +209,12 @@ class CofClothingContextMenu : public CofContextMenu ...@@ -210,15 +209,12 @@ class CofClothingContextMenu : public CofContextMenu
{ {
return mUUIDs.size() == 1 && gAgentWearables.isWearableModifiable(selected_id); 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 return true;
// 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);
} }
}; };
......
...@@ -13,34 +13,24 @@ ...@@ -13,34 +13,24 @@
parameter="take_off" /> parameter="take_off" />
</menu_item_call> </menu_item_call>
<menu_item_call <menu_item_call
label="Move Up a Layer" label="Edit"
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"
layout="topleft" layout="topleft"
name="move_down"> name="edit">
<on_click <on_click
function="Clothing.MoveDown" /> function="Clothing.Edit" />
<on_enable <on_enable
function="Clothing.OnEnable" function="Clothing.OnEnable"
parameter="move_down" /> parameter="edit" />
</menu_item_call> </menu_item_call>
<menu_item_call <menu_item_call
label="Edit" label="Replace"
layout="topleft" layout="topleft"
name="edit"> name="replace">
<on_click <on_click
function="Clothing.Edit" /> function="Clothing.Replace" />
<on_enable <on_enable
function="Clothing.OnEnable" function="Clothing.OnEnable"
parameter="edit" /> parameter="replace" />
</menu_item_call> </menu_item_call>
<menu_item_call <menu_item_call
label="Create New" label="Create New"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment