Add Avatar Center and Neck attachment points to the context and pie menus. Fixes FIRE-3805.

ziree 2011-11-16 21:59:02 +01:00
parent 40a3c1aa5a
commit 78ee763830
6 changed files with 88 additions and 22 deletions

View File

@ -396,7 +396,7 @@
<attachment_point
id="39"
group="9"
pie_slice="1"
pie_slice="4"
name="Neck"
joint="mNeck"
position="0 0 0"
@ -406,7 +406,7 @@
<attachment_point
id="40"
group="9"
pie_slice="2"
pie_slice="0"
name="Avatar Center"
joint="mRoot"
position="0 0 0"

View File

@ -191,18 +191,18 @@ LLMenuGL* gDetachSubMenu = NULL;
LLMenuGL* gTakeOffClothes = NULL;
LLContextMenu* gAttachScreenPieMenu = NULL;
LLContextMenu* gAttachPieMenu = NULL;
LLContextMenu* gAttachBodyPartPieMenus[8];
LLContextMenu* gAttachBodyPartPieMenus[10];
LLContextMenu* gDetachPieMenu = NULL;
LLContextMenu* gDetachScreenPieMenu = NULL;
LLContextMenu* gDetachBodyPartPieMenus[8];
LLContextMenu* gDetachBodyPartPieMenus[10];
// ## Zi: Pie menu
PieMenu* gPieAttachScreenMenu = NULL;
PieMenu* gPieAttachMenu = NULL;
PieMenu* gPieAttachBodyPartMenus[8];
PieMenu* gPieAttachBodyPartMenus[10];
PieMenu* gPieDetachMenu = NULL;
PieMenu* gPieDetachScreenMenu = NULL;
PieMenu* gPieDetachBodyPartMenus[8];
PieMenu* gPieDetachBodyPartMenus[10];
// ## Zi: Pie menu
LLMenuItemCallGL* gAFKMenu = NULL;

View File

@ -186,8 +186,8 @@ extern LLContextMenu* gAttachScreenPieMenu;
extern LLContextMenu* gDetachScreenPieMenu;
extern LLContextMenu* gAttachPieMenu;
extern LLContextMenu* gDetachPieMenu;
extern LLContextMenu* gAttachBodyPartPieMenus[8];
extern LLContextMenu* gDetachBodyPartPieMenus[8];
extern LLContextMenu* gAttachBodyPartPieMenus[10];
extern LLContextMenu* gDetachBodyPartPieMenus[10];
// ## Zi: Pie Menu
// Pie menus in 3D scene
@ -203,8 +203,8 @@ extern PieMenu* gPieAttachScreenMenu;
extern PieMenu* gPieDetachScreenMenu;
extern PieMenu* gPieAttachMenu;
extern PieMenu* gPieDetachMenu;
extern PieMenu* gPieAttachBodyPartMenus[8];
extern PieMenu* gPieDetachBodyPartMenus[8];
extern PieMenu* gPieAttachBodyPartMenus[10];
extern PieMenu* gPieDetachBodyPartMenus[10];
// ## Zi: Pie Menu
extern LLMenuItemCallGL* gAFKMenu;

View File

@ -5755,7 +5755,7 @@ BOOL LLVOAvatar::loadSkeletonNode ()
int group = info->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;
}

View File

@ -289,6 +289,12 @@ BOOL LLVOAvatarSelf::buildMenus()
params.name(params.label);
gAttachBodyPartPieMenus[7] = LLUICtrlFactory::create<LLContextMenu> (params);
gDetachBodyPartPieMenus[8] = NULL; // HUD attachment spots
params.label(LLTrans::getString("BodyPartsOther"));
params.name(params.label);
gAttachBodyPartPieMenus[9] = LLUICtrlFactory::create<LLContextMenu> (params);
gDetachBodyPartPieMenus[0] = NULL;
params.label(LLTrans::getString("BodyPartsRightArm"));
@ -317,6 +323,12 @@ BOOL LLVOAvatarSelf::buildMenus()
params.name(params.label);
gDetachBodyPartPieMenus[7] = LLUICtrlFactory::create<LLContextMenu> (params);
gDetachBodyPartPieMenus[8] = NULL; // HUD attachment spots
params.label(LLTrans::getString("BodyPartsOther"));
params.name(params.label);
gDetachBodyPartPieMenus[9] = LLUICtrlFactory::create<LLContextMenu> (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<PieMenu> (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<PieMenu> (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<S32, S32> attachment_pie_menu_map;
std::multimap<S32, S32> attachment_pie_menu_map; // ## Zi: Pie menu
std::multimap<S32, S32> 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<S32, S32>::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<S32, S32>::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<LLMenuItemCallGL>(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<S32, S32>::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<PieSlice>(slice_params);
gPieDetachBodyPartMenus[group]->addChild(slice);
// ## Zi: Pie menu
}
}
// ## Zi: Pie menu
}
return TRUE;
}

View File

@ -2039,6 +2039,7 @@ Returns a string with the requested data about the region
<string name="BodyPartsLeftLeg">Left Leg</string>
<string name="BodyPartsTorso">Torso</string>
<string name="BodyPartsRightLeg">Right Leg</string>
<string name="BodyPartsOther">Other</string>
<!-- slider -->
<string name="GraphicsQualityLow">Low</string>