From 1a74c055cb48802e1e99a4d88237649ec0d6fd8e Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 14 Oct 2016 12:59:34 +0200 Subject: [PATCH] Add Bento enhanced skeleton attachment points to pie menu * Attachment spots have been manually added to menu_pie_avatar_self.xml and menu_pie_object.xml due to the limitations of the pie menu with a total of 8 slices. * "Left Hand" and "Right Hand" have been moved to the according "Left Arm" and "Right Arm" groups to make room for the additionally needed Extended Skeleton pie slice * "Left Arm", "Right Arm", "Left Leg" and "Right Leg" groups have been re-organized in a logical manner, since the current layout wasn't consistant at all --- indra/newview/character/avatar_lad.xml | 34 +-- indra/newview/llvoavatarself.cpp | 247 ++++++++++++------ .../default/xui/de/menu_pie_avatar_self.xml | 22 +- .../skins/default/xui/de/menu_pie_object.xml | 22 +- .../default/xui/en/menu_pie_avatar_self.xml | 161 +++++++++++- .../skins/default/xui/en/menu_pie_object.xml | 161 +++++++++++- 6 files changed, 549 insertions(+), 98 deletions(-) diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 13f2f72c09..131da49d2c 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -30,7 +30,7 @@ Pie menu #include "piemenu.h" #include "pieslice.h" -// ## Zi: Pie menu +#include "pieseparator.h" +// Pie menu // [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) #include "rlvhandler.h" #include "rlvlocks.h" // [/RLVa:KB] -//-TT Client LSL Bridge +// Client LSL Bridge #include "fslslbridge.h" -//-TT +// #include "lggbeammaps.h" #include "llmeshrepository.h" #include "llvovolume.h" @@ -479,12 +480,13 @@ BOOL LLVOAvatarSelf::buildMenus() //------------------------------------------------------------------------- // build the attach and detach pie menus //------------------------------------------------------------------------- + PieMenu::Params pieParams; + pieParams.visible(false); + gPieAttachBodyPartMenus[0] = NULL; - PieMenu::Params pieParams; pieParams.label(LLTrans::getString("BodyPartsRightArm")); pieParams.name(pieParams.label); - pieParams.visible(false); gPieAttachBodyPartMenus[1] = LLUICtrlFactory::create (pieParams); pieParams.label(LLTrans::getString("BodyPartsHead")); @@ -543,13 +545,6 @@ BOOL LLVOAvatarSelf::buildMenus() if (gAttachBodyPartPieMenus[i]) { gAttachPieMenu->appendContextSubMenu( gAttachBodyPartPieMenus[i] ); - // Pie menu - // Ansa: Exclude Bento additions for now until we figured out a way where to put them... - if (i < PIE_MAX_SLICES) - { - gPieAttachMenu->appendContextSubMenu(gPieAttachBodyPartMenus[i]); - } - // } else { @@ -561,18 +556,15 @@ BOOL LLVOAvatarSelf::buildMenus() if (attachment && attachment->getGroup() == i) { LLMenuItemCallGL::Params item_params; - PieSlice::Params slice_params; // Pie menu std::string sub_piemenu_name = attachment->getName(); if (LLTrans::getString(sub_piemenu_name) != "") { item_params.label = LLTrans::getString(sub_piemenu_name); - slice_params.label = LLTrans::getString(sub_piemenu_name); // Pie menu } else { item_params.label = sub_piemenu_name; - slice_params.label = sub_piemenu_name; // Pie menu } item_params.name =(item_params.label ); item_params.on_click.function_name = "Object.AttachToAvatar"; @@ -584,23 +576,7 @@ BOOL LLVOAvatarSelf::buildMenus() gAttachPieMenu->addChild(item); - // Pie menu - // Ansa: Exclude Bento additions for now until we figured out a way where to put them... - if (i < PIE_MAX_SLICES) - { - slice_params.name = (slice_params.label); - slice_params.on_click.function_name = "Object.AttachToAvatar"; - slice_params.on_click.parameter = iter->first; - slice_params.on_enable.function_name = "Object.EnableWear"; - slice_params.on_enable.parameter = iter->first; - PieSlice* slice = LLUICtrlFactory::create(slice_params); - - gPieAttachMenu->addChild(slice); - } - // Pie menu - break; - } } } @@ -608,13 +584,6 @@ BOOL LLVOAvatarSelf::buildMenus() if (gDetachBodyPartPieMenus[i]) { gDetachPieMenu->appendContextSubMenu( gDetachBodyPartPieMenus[i] ); - // Pie menu - // Ansa: Exclude Bento additions for now until we figured out a way where to put them... - if (i < PIE_MAX_SLICES) - { - gPieDetachMenu->appendContextSubMenu(gPieDetachBodyPartMenus[i]); - } - // Pie menu } else { @@ -626,17 +595,14 @@ BOOL LLVOAvatarSelf::buildMenus() if (attachment && attachment->getGroup() == i) { LLMenuItemCallGL::Params item_params; - PieSlice::Params slice_params; // Pie menu std::string sub_piemenu_name = attachment->getName(); if (LLTrans::getString(sub_piemenu_name) != "") { item_params.label = LLTrans::getString(sub_piemenu_name); - slice_params.label = LLTrans::getString(sub_piemenu_name); // Pie menu } else { item_params.label = sub_piemenu_name; - slice_params.label = sub_piemenu_name; // Pie menu } item_params.name =(item_params.label ); item_params.on_click.function_name = "Attachment.DetachFromPoint"; @@ -647,26 +613,111 @@ BOOL LLVOAvatarSelf::buildMenus() gDetachPieMenu->addChild(item); - // Pie menu - // Ansa: Exclude Bento additions for now until we figured out a way where to put them... - if (i < PIE_MAX_SLICES) - { - slice_params.name = (slice_params.label); - slice_params.on_click.function_name = "Attachment.DetachFromPoint"; - slice_params.on_click.parameter = iter->first; - slice_params.on_enable.function_name = "Attachment.PointFilled"; - slice_params.on_enable.parameter = iter->first; - PieSlice* slice = LLUICtrlFactory::create(slice_params); + break; + } + } + } + } - gPieDetachMenu->addChild(slice); + // Pie menu + for (S32 i = 0; i < PIE_MAX_SLICES; i++) + { + // Skip former slices of left and right hand that have been moved into the + // corresponding Left/Right arm groups; + // 0 is Bento enhanced skeleton now, manually added in menu_pie_avatar_self.xml + // and menu_pie_object.xml + if (i == 0) + { + continue; + } + else if (i == 4) + { + PieSeparator::Params pie_sep_params; + pieParams.name("AttachSlot4Separator"); + gPieAttachMenu->addChild(LLUICtrlFactory::create(pie_sep_params)); + pieParams.name("DetachSlot4Separator"); + gPieDetachMenu->addChild(LLUICtrlFactory::create(pie_sep_params)); + continue; + } + + if (gPieAttachBodyPartMenus[i]) + { + gPieAttachMenu->appendContextSubMenu(gPieAttachBodyPartMenus[i]); + } + else + { + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (attachment && attachment->getGroup() == i) + { + PieSlice::Params slice_params; + + std::string sub_piemenu_name = attachment->getName(); + if (LLTrans::getString(sub_piemenu_name) != "") + { + slice_params.label = LLTrans::getString(sub_piemenu_name); } - // Pie menu + else + { + slice_params.label = sub_piemenu_name; + } + + slice_params.name = (slice_params.label); + slice_params.on_click.function_name = "Object.AttachToAvatar"; + slice_params.on_click.parameter = iter->first; + slice_params.on_enable.function_name = "Object.EnableWear"; + slice_params.on_enable.parameter = iter->first; + PieSlice* slice = LLUICtrlFactory::create(slice_params); + + gPieAttachMenu->addChild(slice); + + break; + } + } + } + + if (gPieDetachBodyPartMenus[i]) + { + gPieDetachMenu->appendContextSubMenu(gPieDetachBodyPartMenus[i]); + } + else + { + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (attachment && attachment->getGroup() == i) + { + PieSlice::Params slice_params; + std::string sub_piemenu_name = attachment->getName(); + if (LLTrans::getString(sub_piemenu_name) != "") + { + slice_params.label = LLTrans::getString(sub_piemenu_name); + } + else + { + slice_params.label = sub_piemenu_name; + } + + slice_params.name = (slice_params.label); + slice_params.on_click.function_name = "Attachment.DetachFromPoint"; + slice_params.on_click.parameter = iter->first; + slice_params.on_enable.function_name = "Attachment.PointFilled"; + slice_params.on_enable.parameter = iter->first; + PieSlice* slice = LLUICtrlFactory::create(slice_params); + + gPieDetachMenu->addChild(slice); break; } } } } + // Pie menu // add screen attachments for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); @@ -840,33 +891,73 @@ BOOL LLVOAvatarSelf::buildMenus() item_params.on_enable.parameter = attach_index; item = LLUICtrlFactory::create(item_params); gDetachBodyPartPieMenus[group]->addChild(item); - - // Pie menu - // Ansa: Exclude Bento additions for now until we figured out a way where to put them... - if (group < PIE_MAX_SLICES) - { - PieSlice::Params slice_params; - slice_params.name = attachment->getName(); - slice_params.label = LLTrans::getString(attachment->getName()); - slice_params.on_click.function_name = "Object.AttachToAvatar"; - slice_params.on_click.parameter = attach_index; - slice_params.on_enable.function_name = "Object.EnableWear"; - slice_params.on_enable.parameter = attach_index; - - PieSlice* slice = LLUICtrlFactory::create(slice_params); - gPieAttachBodyPartMenus[group]->addChild(slice); - - slice_params.on_click.function_name = "Attachment.DetachFromPoint"; - slice_params.on_click.parameter = attach_index; - slice_params.on_enable.function_name = "Attachment.PointFilled"; - slice_params.on_enable.parameter = attach_index; - slice = LLUICtrlFactory::create(slice_params); - gPieDetachBodyPartMenus[group]->addChild(slice); - } - // Pie menu } } } + + // Pie menu + for (S32 group = 0; group < PIE_MAX_SLICES; group++) + { + // skip over groups that don't have sub menus + if (!gPieAttachBodyPartMenus[group] || !gPieDetachBodyPartMenus[group]) + { + continue; + } + + std::multimap attachment_pie_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(); + ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if(attachment && attachment->getGroup() == group) + { + // 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)); + } + } + + // 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) + { + S32 attach_index = attach_it->second; + + // Skip bridge attachment spot + if (attach_index == 127) + { + continue; + } + // + + LLViewerJointAttachment* attachment = get_if_there(mAttachmentPoints, attach_index, (LLViewerJointAttachment*)NULL); + if (attachment) + { + PieSlice::Params slice_params; + slice_params.name = attachment->getName(); + slice_params.label = LLTrans::getString(attachment->getName()); + slice_params.on_click.function_name = "Object.AttachToAvatar"; + slice_params.on_click.parameter = attach_index; + slice_params.on_enable.function_name = "Object.EnableWear"; + slice_params.on_enable.parameter = attach_index; + + PieSlice* slice = LLUICtrlFactory::create(slice_params); + gPieAttachBodyPartMenus[group]->addChild(slice); + + slice_params.on_click.function_name = "Attachment.DetachFromPoint"; + slice_params.on_click.parameter = attach_index; + slice_params.on_enable.function_name = "Attachment.PointFilled"; + slice_params.on_enable.parameter = attach_index; + slice = LLUICtrlFactory::create(slice_params); + gPieDetachBodyPartMenus[group]->addChild(slice); + } + } + } + // Pie menu + return TRUE; } diff --git a/indra/newview/skins/default/xui/de/menu_pie_avatar_self.xml b/indra/newview/skins/default/xui/de/menu_pie_avatar_self.xml index 2fc563aadb..dd82489e2b 100644 --- a/indra/newview/skins/default/xui/de/menu_pie_avatar_self.xml +++ b/indra/newview/skins/default/xui/de/menu_pie_avatar_self.xml @@ -21,7 +21,27 @@ - + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/de/menu_pie_object.xml b/indra/newview/skins/default/xui/de/menu_pie_object.xml index ac9c5f046b..e85f4da02d 100644 --- a/indra/newview/skins/default/xui/de/menu_pie_object.xml +++ b/indra/newview/skins/default/xui/de/menu_pie_object.xml @@ -13,7 +13,27 @@ - + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_pie_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_pie_avatar_self.xml index fb2564a8ca..b5314bf63d 100644 --- a/indra/newview/skins/default/xui/en/menu_pie_avatar_self.xml +++ b/indra/newview/skins/default/xui/en/menu_pie_avatar_self.xml @@ -184,7 +184,166 @@ + name="Pie Object Detach"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_pie_object.xml b/indra/newview/skins/default/xui/en/menu_pie_object.xml index d5ca21e3bc..3209fe8ede 100644 --- a/indra/newview/skins/default/xui/en/menu_pie_object.xml +++ b/indra/newview/skins/default/xui/en/menu_pie_object.xml @@ -115,7 +115,166 @@ name="Pie Object Attach HUD" /> + name="Pie Object Attach"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +