diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index ca60b79f9d8d66fac93f532add58f558f486b58e..a2329d84b1f18dcebdc927628844527f89d1b706 100755 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -33,8 +33,12 @@ #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloaterreg.h" #include "llinventoryfunctions.h" #include "llinventoryicon.h" +#include "llselectmgr.h" +#include "lltoolcomp.h" +#include "lltoolmgr.h" #include "lltransutil.h" #include "llviewerattachmenu.h" #include "llvoavatarself.h" @@ -805,6 +809,7 @@ LLContextMenu* LLWearableItemsList::ContextMenu::createMenu() // Register handlers for body parts. // Register handlers for attachments. + registrar.add("Attachment.Edit", boost::bind(&handleAttachmentEdit, ids)); registrar.add("Attachment.Detach", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids)); registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id)); @@ -893,6 +898,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu //visible only when one item selected and this item is worn setMenuItemVisible(menu, "edit", !standalone && mask & (MASK_CLOTHING|MASK_BODYPART) && n_worn == n_items && n_worn == 1); setMenuItemEnabled(menu, "edit", n_editable == 1 && n_worn == 1 && n_items == 1); + setMenuItemVisible(menu, "edit_attachment", mask == MASK_ATTACHMENT && n_worn == n_items); setMenuItemVisible(menu, "create_new", mask & (MASK_CLOTHING|MASK_BODYPART) && n_items == 1); setMenuItemEnabled(menu, "create_new", canAddWearables(ids)); setMenuItemVisible(menu, "show_original", !standalone); @@ -1059,4 +1065,34 @@ bool LLWearableItemsList::ContextMenu::canAddWearables(const uuid_vec_t& item_id return true; } +void LLWearableItemsList::ContextMenu::handleAttachmentEdit(const uuid_vec_t& item_uuids) +{ + std::vector<LLViewerObject*> object_list; + object_list.reserve(item_uuids.size()); + + for (const auto& id : item_uuids) + { + if (id.isNull()) + continue; + + if (LLInventoryItem* itemp = gInventory.getItem(id)) + { + LLViewerObject* objectp = gAgentAvatarp->getWornAttachment(itemp->getLinkedUUID()); + if (objectp) + { + object_list.push_back(objectp); + } + } + } + + if (!object_list.empty()) + { + LLSelectMgr::getInstance()->deselectAll(); + LLFloaterReg::showInstance("build"); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool(LLToolCompTranslate::getInstance()); + LLSelectMgr::getInstance()->selectObjectAndFamily(object_list); + } +} + // EOF diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index f89b74e9f72d54df42abc9e5f6acaaf49d7c7265..03ba2463aede17ff5781f72432d41442d8073389 100755 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -428,6 +428,7 @@ public: static void updateMask(U32& mask, LLAssetType::EType at); static void createNewWearable(const LLUUID& item_id); static bool canAddWearables(const uuid_vec_t& item_ids); + static void handleAttachmentEdit(const uuid_vec_t& item_uuids); LLWearableItemsList* mParent; }; diff --git a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml index aa56b4ba63c2d730710c781ec6e34780935776ca..6fc97b2680bc876ed28d2f472736ce620dd1d104 100755 --- a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml +++ b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml @@ -35,6 +35,13 @@ name="detach"> <on_click function="Attachment.Detach" /> + </menu_item_call> + <menu_item_call + label="Edit" + layout="topleft" + name="edit_attachment"> + <on_click + function="Attachment.Edit" /> </menu_item_call> <context_menu label="Attach to"