Skip to content
Snippets Groups Projects
Commit cf2f0edd authored by Mnikolenko Productengine's avatar Mnikolenko Productengine
Browse files

SL-13278 FIXED Creating default clothing not accessible through "Edit My...

SL-13278 FIXED Creating default clothing not accessible through "Edit My Outfit" for any type that does not already exist
parent 372ed555
No related branches found
No related tags found
No related merge requests found
...@@ -1282,6 +1282,7 @@ void LLPanelOutfitEdit::showFilteredWearablesListView(LLWearableType::EType type ...@@ -1282,6 +1282,7 @@ void LLPanelOutfitEdit::showFilteredWearablesListView(LLWearableType::EType type
//e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE //e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE
applyListViewFilter(static_cast<EListViewItemType>(LVIT_SHAPE + type)); applyListViewFilter(static_cast<EListViewItemType>(LVIT_SHAPE + type));
mWearableItemsList->setMenuWearableType(type);
} }
static void update_status_widget_rect(LLView * widget, S32 right_border) static void update_status_widget_rect(LLView * widget, S32 right_border)
......
...@@ -639,6 +639,7 @@ LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p) ...@@ -639,6 +639,7 @@ LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
: LLInventoryItemsList(p) : LLInventoryItemsList(p)
{ {
setSortOrder(E_SORT_BY_TYPE_LAYER, false); setSortOrder(E_SORT_BY_TYPE_LAYER, false);
mMenuWearableType = LLWearableType::WT_NONE;
mIsStandalone = p.standalone; mIsStandalone = p.standalone;
if (mIsStandalone) if (mIsStandalone)
{ {
...@@ -730,10 +731,15 @@ void LLWearableItemsList::onRightClick(S32 x, S32 y) ...@@ -730,10 +731,15 @@ void LLWearableItemsList::onRightClick(S32 x, S32 y)
getSelectedUUIDs(selected_uuids); getSelectedUUIDs(selected_uuids);
if (selected_uuids.empty()) if (selected_uuids.empty())
{ {
return; if ((mMenuWearableType != LLWearableType::WT_NONE) && (size() == 0))
{
ContextMenu::instance().show(this, mMenuWearableType, x, y);
}
}
else
{
ContextMenu::instance().show(this, selected_uuids, x, y);
} }
ContextMenu::instance().show(this, selected_uuids, x, y);
} }
void LLWearableItemsList::setSortOrder(ESortOrder sort_order, bool sort_now) void LLWearableItemsList::setSortOrder(ESortOrder sort_order, bool sort_now)
...@@ -784,6 +790,46 @@ void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, const uuid_ve ...@@ -784,6 +790,46 @@ void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, const uuid_ve
mParent = NULL; // to avoid dereferencing an invalid pointer mParent = NULL; // to avoid dereferencing an invalid pointer
} }
void LLWearableItemsList::ContextMenu::show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y)
{
mParent = dynamic_cast<LLWearableItemsList*>(spawning_view);
LLContextMenu* menup = mMenuHandle.get();
if (menup)
{
//preventing parent (menu holder) from deleting already "dead" context menus on exit
LLView* parent = menup->getParent();
if (parent)
{
parent->removeChild(menup);
}
delete menup;
mUUIDs.clear();
}
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("Wearable.CreateNew", boost::bind(createNewWearableByType, w_type));
menup = createFromFile("menu_wearable_list_item.xml");
if (!menup)
{
LL_WARNS() << "Context menu creation failed" << LL_ENDL;
return;
}
setMenuItemVisible(menup, "create_new", true);
setMenuItemEnabled(menup, "create_new", true);
setMenuItemVisible(menup, "wearable_attach_to", false);
setMenuItemVisible(menup, "wearable_attach_to_hud", false);
std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getTypeName(w_type));
LLMenuItemGL* menu_item = menup->getChild<LLMenuItemGL>("create_new");
menu_item->setLabel(new_label);
mMenuHandle = menup->getHandle();
menup->show(x, y);
LLMenuGL::showPopup(spawning_view, menup, x, y);
mParent = NULL; // to avoid dereferencing an invalid pointer
}
// virtual // virtual
LLContextMenu* LLWearableItemsList::ContextMenu::createMenu() LLContextMenu* LLWearableItemsList::ContextMenu::createMenu()
{ {
...@@ -1004,4 +1050,10 @@ void LLWearableItemsList::ContextMenu::createNewWearable(const LLUUID& item_id) ...@@ -1004,4 +1050,10 @@ void LLWearableItemsList::ContextMenu::createNewWearable(const LLUUID& item_id)
LLAgentWearables::createWearable(item->getWearableType(), true); LLAgentWearables::createWearable(item->getWearableType(), true);
} }
// static
void LLWearableItemsList::ContextMenu::createNewWearableByType(LLWearableType::EType type)
{
LLAgentWearables::createWearable(type, true);
}
// EOF // EOF
...@@ -415,6 +415,8 @@ class LLWearableItemsList : public LLInventoryItemsList ...@@ -415,6 +415,8 @@ class LLWearableItemsList : public LLInventoryItemsList
public: public:
/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y); /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
void show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y);
protected: protected:
enum { enum {
MASK_CLOTHING = 0x01, MASK_CLOTHING = 0x01,
...@@ -431,6 +433,7 @@ class LLWearableItemsList : public LLInventoryItemsList ...@@ -431,6 +433,7 @@ class LLWearableItemsList : public LLInventoryItemsList
static void setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val); static void setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val);
static void updateMask(U32& mask, LLAssetType::EType at); static void updateMask(U32& mask, LLAssetType::EType at);
static void createNewWearable(const LLUUID& item_id); static void createNewWearable(const LLUUID& item_id);
static void createNewWearableByType(LLWearableType::EType type);
LLWearableItemsList* mParent; LLWearableItemsList* mParent;
}; };
...@@ -469,6 +472,8 @@ class LLWearableItemsList : public LLInventoryItemsList ...@@ -469,6 +472,8 @@ class LLWearableItemsList : public LLInventoryItemsList
void setSortOrder(ESortOrder sort_order, bool sort_now = true); void setSortOrder(ESortOrder sort_order, bool sort_now = true);
void setMenuWearableType(LLWearableType::EType type) { mMenuWearableType = type; }
protected: protected:
friend class LLUICtrlFactory; friend class LLUICtrlFactory;
LLWearableItemsList(const LLWearableItemsList::Params& p); LLWearableItemsList(const LLWearableItemsList::Params& p);
...@@ -479,6 +484,8 @@ class LLWearableItemsList : public LLInventoryItemsList ...@@ -479,6 +484,8 @@ class LLWearableItemsList : public LLInventoryItemsList
bool mWornIndicationEnabled; bool mWornIndicationEnabled;
ESortOrder mSortOrder; ESortOrder mSortOrder;
LLWearableType::EType mMenuWearableType;
}; };
#endif //LL_LLWEARABLEITEMSLIST_H #endif //LL_LLWEARABLEITEMSLIST_H
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<menu_item_call <menu_item_call
label="Replace" label="Replace"
layout="topleft" layout="topleft"
visible="false"
name="wear_replace"> name="wear_replace">
<on_click <on_click
function="Wearable.Wear" /> function="Wearable.Wear" />
...@@ -11,6 +12,7 @@ ...@@ -11,6 +12,7 @@
<menu_item_call <menu_item_call
label="Wear" label="Wear"
layout="topleft" layout="topleft"
visible="false"
name="wear_wear"> name="wear_wear">
<on_click <on_click
function="Wearable.Wear" /> function="Wearable.Wear" />
...@@ -18,6 +20,7 @@ ...@@ -18,6 +20,7 @@
<menu_item_call <menu_item_call
label="Add" label="Add"
layout="topleft" layout="topleft"
visible="false"
name="wear_add"> name="wear_add">
<on_click <on_click
function="Wearable.Add" /> function="Wearable.Add" />
...@@ -25,6 +28,7 @@ ...@@ -25,6 +28,7 @@
<menu_item_call <menu_item_call
label="Take Off / Detach" label="Take Off / Detach"
layout="topleft" layout="topleft"
visible="false"
name="take_off_or_detach"> name="take_off_or_detach">
<on_click <on_click
function="Wearable.TakeOffDetach" /> function="Wearable.TakeOffDetach" />
...@@ -32,6 +36,7 @@ ...@@ -32,6 +36,7 @@
<menu_item_call <menu_item_call
label="Detach" label="Detach"
layout="topleft" layout="topleft"
visible="false"
name="detach"> name="detach">
<on_click <on_click
function="Attachment.Detach" /> function="Attachment.Detach" />
...@@ -47,6 +52,7 @@ ...@@ -47,6 +52,7 @@
<menu_item_call <menu_item_call
label="Take Off" label="Take Off"
layout="topleft" layout="topleft"
visible="false"
name="take_off"> name="take_off">
<on_click <on_click
function="Clothing.TakeOff" /> function="Clothing.TakeOff" />
...@@ -54,6 +60,7 @@ ...@@ -54,6 +60,7 @@
<menu_item_call <menu_item_call
label="Edit" label="Edit"
layout="topleft" layout="topleft"
visible="false"
name="edit"> name="edit">
<on_click <on_click
function="Wearable.Edit" /> function="Wearable.Edit" />
...@@ -61,6 +68,7 @@ ...@@ -61,6 +68,7 @@
<menu_item_call <menu_item_call
label="Item Profile" label="Item Profile"
layout="topleft" layout="topleft"
visible="false"
name="object_profile"> name="object_profile">
<on_click <on_click
function="Attachment.Profile" /> function="Attachment.Profile" />
...@@ -68,6 +76,7 @@ ...@@ -68,6 +76,7 @@
<menu_item_call <menu_item_call
label="Show Original" label="Show Original"
layout="topleft" layout="topleft"
visible="false"
name="show_original"> name="show_original">
<on_click <on_click
function="Wearable.ShowOriginal" /> function="Wearable.ShowOriginal" />
...@@ -75,6 +84,7 @@ ...@@ -75,6 +84,7 @@
<menu_item_call <menu_item_call
label="Create New" label="Create New"
layout="topleft" layout="topleft"
visible="false"
name="create_new" name="create_new"
translate="false"> translate="false">
<on_click <on_click
...@@ -83,6 +93,7 @@ ...@@ -83,6 +93,7 @@
<menu_item_call <menu_item_call
label="--no options--" label="--no options--"
layout="topleft" layout="topleft"
visible="false"
name="--no options--" name="--no options--"
translate="false"> translate="false">
</menu_item_call> </menu_item_call>
......
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