From 78ee763830495236f9518772d21bcf7ebff906a7 Mon Sep 17 00:00:00 2001 From: ziree Date: Wed, 16 Nov 2011 21:59:02 +0100 Subject: [PATCH] Add Avatar Center and Neck attachment points to the context and pie menus. Fixes FIRE-3805. --- indra/newview/character/avatar_lad.xml | 4 +- indra/newview/llviewermenu.cpp | 8 +- indra/newview/llviewermenu.h | 8 +- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatarself.cpp | 87 ++++++++++++++++--- .../newview/skins/default/xui/en/strings.xml | 1 + 6 files changed, 88 insertions(+), 22 deletions(-) diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index aa7c054c2d..bc0316d719 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -396,7 +396,7 @@ mGroup; if (group >= 0) { - if (group < 0 || group >= 9) + if (group < 0 || group >= 10) { llwarns << "Invalid group number (" << group << ") for attachment point " << info->mName << llendl; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e3df8ea976..8419c9045b 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -289,6 +289,12 @@ BOOL LLVOAvatarSelf::buildMenus() params.name(params.label); gAttachBodyPartPieMenus[7] = LLUICtrlFactory::create (params); + gDetachBodyPartPieMenus[8] = NULL; // HUD attachment spots + + params.label(LLTrans::getString("BodyPartsOther")); + params.name(params.label); + gAttachBodyPartPieMenus[9] = LLUICtrlFactory::create (params); + gDetachBodyPartPieMenus[0] = NULL; params.label(LLTrans::getString("BodyPartsRightArm")); @@ -317,6 +323,12 @@ BOOL LLVOAvatarSelf::buildMenus() params.name(params.label); gDetachBodyPartPieMenus[7] = LLUICtrlFactory::create (params); + gDetachBodyPartPieMenus[8] = NULL; // HUD attachment spots + + params.label(LLTrans::getString("BodyPartsOther")); + params.name(params.label); + gDetachBodyPartPieMenus[9] = LLUICtrlFactory::create (params); + // ## Zi: Pie menu //------------------------------------------------------------------------- // build the attach and detach pie menus @@ -351,6 +363,9 @@ BOOL LLVOAvatarSelf::buildMenus() pieParams.name(pieParams.label); gPieAttachBodyPartMenus[7] = LLUICtrlFactory::create (pieParams); + gPieAttachBodyPartMenus[8] = NULL; // HUD attachment spots + gPieAttachBodyPartMenus[9] = NULL; // New attachment spots, will be moved to "Torso" + gPieDetachBodyPartMenus[0] = NULL; pieParams.label(LLTrans::getString("BodyPartsRightArm")); @@ -378,14 +393,22 @@ BOOL LLVOAvatarSelf::buildMenus() pieParams.label(LLTrans::getString("BodyPartsRightLeg")); pieParams.name(pieParams.label); gPieDetachBodyPartMenus[7] = LLUICtrlFactory::create (pieParams); + + gPieDetachBodyPartMenus[8] = NULL; // HUD attachment spots + gPieDetachBodyPartMenus[9] = NULL; // Other attachment spots, will be moved to "Torso" // ## Zi: Pie menu - for (S32 i = 0; i < 8; i++) + for (S32 i = 0; i < 10; i++) { + // skip HUD attachment spots (needed for Neck and Avatar Center group above 8) -Zi + if(i==8) + continue; + if (gAttachBodyPartPieMenus[i]) { gAttachPieMenu->appendContextSubMenu( gAttachBodyPartPieMenus[i] ); - gPieAttachMenu->appendContextSubMenu( gPieAttachBodyPartMenus[i] ); // ## Zi: Pie menu + if(gPieAttachBodyPartMenus[i]) + gPieAttachMenu->appendContextSubMenu( gPieAttachBodyPartMenus[i] ); // ## Zi: Pie menu } else { @@ -442,7 +465,8 @@ BOOL LLVOAvatarSelf::buildMenus() if (gDetachBodyPartPieMenus[i]) { gDetachPieMenu->appendContextSubMenu( gDetachBodyPartPieMenus[i] ); - gPieDetachMenu->appendContextSubMenu( gPieDetachBodyPartMenus[i] ); // ## Zi: Pie menu + if(gPieDetachBodyPartMenus[i]) + gPieDetachMenu->appendContextSubMenu( gPieDetachBodyPartMenus[i] ); // ## Zi: Pie menu } else { @@ -608,16 +632,20 @@ BOOL LLVOAvatarSelf::buildMenus() } } - for (S32 group = 0; group < 8; group++) + for (S32 group = 0; group < 10; group++) { + // skip HUD attachment spots (needed for Neck and Avatar Center group above 8) -Zi + if(group==8) + continue; + // skip over groups that don't have sub menus if (!gAttachBodyPartPieMenus[group] || !gDetachBodyPartPieMenus[group]) { continue; } - std::multimap attachment_pie_menu_map; - + std::multimap attachment_pie_menu_map; // ## Zi: Pie menu + std::multimap attachment_linear_menu_map; // gather up all attachment points assigned to this group, and throw into map sorted by pie slice number for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); @@ -625,16 +653,29 @@ BOOL LLVOAvatarSelf::buildMenus() { LLViewerJointAttachment* attachment = iter->second; if(attachment->getGroup() == group) + { + // use multimap to provide a partial order off of the pie slice key + S32 pie_index = attachment->getPieSlice(); + attachment_linear_menu_map.insert(std::make_pair(pie_index, iter->first)); + } + + // ## Zi: Pie menu + // bad hack to add the new "Neck" and "Avatar Center" points in group 9 to + // "Torso" (group 6). There was no room anywhere else that would have made + // sense. Going forward we will probably have to have a static XML file for + // the pie menu. + if(attachment->getGroup() == group || (group==6 && attachment->getGroup()==9)) { // use multimap to provide a partial order off of the pie slice key S32 pie_index = attachment->getPieSlice(); attachment_pie_menu_map.insert(std::make_pair(pie_index, iter->first)); } + // ## Zi: Pie menu } - // add in requested order to pie menu, inserting separators as necessary - for (std::multimap::iterator attach_it = attachment_pie_menu_map.begin(); - attach_it != attachment_pie_menu_map.end(); ++attach_it) + // add in requested order to linear menu, inserting separators as necessary + for (std::multimap::iterator attach_it = attachment_linear_menu_map.begin(); + attach_it != attachment_linear_menu_map.end(); ++attach_it) { S32 attach_index = attach_it->second; @@ -659,8 +700,32 @@ BOOL LLVOAvatarSelf::buildMenus() item_params.on_enable.parameter = attach_index; item = LLUICtrlFactory::create(item_params); gDetachBodyPartPieMenus[group]->addChild(item); + } + } + + // ## Zi: Pie menu + // we need a second loop here because the pie menu might have a different number of slices than the linear menu + + // we don't have anything above 8 in the pie, the new group 9 is remapped to 6 + if(group>8) + continue; + + // add in requested order to pie menu, inserting separators as necessary + for (std::multimap::iterator pie_attach_it = attachment_pie_menu_map.begin(); + pie_attach_it != attachment_pie_menu_map.end(); ++pie_attach_it) + { + S32 attach_index = pie_attach_it->second; + + LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); + if (attachment) + { + attach_index = pie_attach_it->second; + + // Hide the bridge attachment point from the pie menu. + // Doesn't make so much sense to have it and it frees up a slice for the neck and avatar center points. + if(attach_index==127) + continue; - // ## Zi: Pie menu PieSlice::Params slice_params; slice_params.name = attachment->getName(); slice_params.label = LLTrans::getString(attachment->getName()); @@ -678,9 +743,9 @@ BOOL LLVOAvatarSelf::buildMenus() slice_params.on_enable.parameter = attach_index; slice = LLUICtrlFactory::create(slice_params); gPieDetachBodyPartMenus[group]->addChild(slice); - // ## Zi: Pie menu } } + // ## Zi: Pie menu } return TRUE; } diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 4093099965..61d67aea6b 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2039,6 +2039,7 @@ Returns a string with the requested data about the region Left Leg Torso Right Leg + Other Low