aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-03-06 00:02:53 -0700
committerJacek Antonelli2010-03-11 19:15:19 -0600
commitbcf5fd77cb0027cc95e412aca4ea75189e22285c (patch)
tree4b0d1a604e8df5728bc7d8b17296060c88db9768 /linden
parentApplied ImageGLPickMaskCrashFix patch from Cool Viewer. (diff)
downloadmeta-impy-bcf5fd77cb0027cc95e412aca4ea75189e22285c.zip
meta-impy-bcf5fd77cb0027cc95e412aca4ea75189e22285c.tar.gz
meta-impy-bcf5fd77cb0027cc95e412aca4ea75189e22285c.tar.bz2
meta-impy-bcf5fd77cb0027cc95e412aca4ea75189e22285c.tar.xz
SNOW-97: Building hotkeys to navigate prims in a link set.
Patch by Thickbrick Sleaford.
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/newview/llviewermenu.cpp93
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml23
2 files changed, 116 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index c403700..c5964d5 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -4534,6 +4534,97 @@ class LLToolsSnapObjectXY : public view_listener_t
4534 } 4534 }
4535}; 4535};
4536 4536
4537// Determine if the option to cycle between linked prims is shown
4538class LLToolsEnableSelectNextPart : public view_listener_t
4539{
4540 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4541 {
4542 bool new_value = (gSavedSettings.getBOOL("EditLinkedParts") &&
4543 !LLSelectMgr::getInstance()->getSelection()->isEmpty());
4544 gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
4545 return true;
4546 }
4547};
4548
4549// Cycle selection through linked children in selected object.
4550// FIXME: Order of children list is not always the same as sim's idea of link order. This may confuse
4551// resis. Need link position added to sim messages to address this.
4552class LLToolsSelectNextPart : public view_listener_t
4553{
4554 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
4555 {
4556 S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
4557 if (gSavedSettings.getBOOL("EditLinkedParts") && object_count)
4558 {
4559 LLViewerObject* selected = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
4560 if (selected && selected->getRootEdit())
4561 {
4562 bool fwd = (userdata.asString() == "next");
4563 bool prev = (userdata.asString() == "previous");
4564 bool ifwd = (userdata.asString() == "includenext");
4565 bool iprev = (userdata.asString() == "includeprevious");
4566 LLViewerObject* to_select = NULL;
4567 LLViewerObject::child_list_t children = selected->getRootEdit()->getChildren();
4568 children.push_front(selected->getRootEdit()); // need root in the list too
4569
4570 for (LLViewerObject::child_list_t::iterator iter = children.begin(); iter != children.end(); ++iter)
4571 {
4572 if ((*iter)->isSelected())
4573 {
4574 if (object_count > 1 && (fwd || prev)) // multiple selection, find first or last selected if not include
4575 {
4576 to_select = *iter;
4577 if (fwd)
4578 {
4579 // stop searching if going forward; repeat to get last hit if backward
4580 break;
4581 }
4582 }
4583 else if ((object_count == 1) || (ifwd || iprev)) // single selection or include
4584 {
4585 if (fwd || ifwd)
4586 {
4587 ++iter;
4588 while (iter != children.end() && ((*iter)->isAvatar() || (ifwd && (*iter)->isSelected())))
4589 {
4590 ++iter; // skip sitting avatars and selected if include
4591 }
4592 }
4593 else // backward
4594 {
4595 iter = (iter == children.begin() ? children.end() : iter);
4596 --iter;
4597 while (iter != children.begin() && ((*iter)->isAvatar() || (iprev && (*iter)->isSelected())))
4598 {
4599 --iter; // skip sitting avatars and selected if include
4600 }
4601 }
4602 iter = (iter == children.end() ? children.begin() : iter);
4603 to_select = *iter;
4604 break;
4605 }
4606 }
4607 }
4608
4609 if (to_select)
4610 {
4611 if (gFocusMgr.childHasKeyboardFocus(gFloaterTools))
4612 {
4613 gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes
4614 }
4615 if (fwd || prev)
4616 {
4617 LLSelectMgr::getInstance()->deselectAll();
4618 }
4619 LLSelectMgr::getInstance()->selectObjectOnly(to_select);
4620 return true;
4621 }
4622 }
4623 }
4624 return true;
4625 }
4626};
4627
4537// in order to link, all objects must have the same owner, and the 4628// in order to link, all objects must have the same owner, and the
4538// agent must have the ability to modify all of the objects. However, 4629// agent must have the ability to modify all of the objects. However,
4539// we're not answering that question with this method. The question 4630// we're not answering that question with this method. The question
@@ -10666,6 +10757,7 @@ void initialize_menus()
10666 addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); 10757 addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts");
10667 addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY"); 10758 addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY");
10668 addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid"); 10759 addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid");
10760 addMenu(new LLToolsSelectNextPart(), "Tools.SelectNextPart");
10669 addMenu(new LLToolsLink(), "Tools.Link"); 10761 addMenu(new LLToolsLink(), "Tools.Link");
10670 addMenu(new LLToolsUnlink(), "Tools.Unlink"); 10762 addMenu(new LLToolsUnlink(), "Tools.Unlink");
10671 addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations"); 10763 addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations");
@@ -10679,6 +10771,7 @@ void initialize_menus()
10679 addMenu(new LLToolsSetBulkPerms(), "Tools.SetBulkPerms"); 10771 addMenu(new LLToolsSetBulkPerms(), "Tools.SetBulkPerms");
10680 10772
10681 addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie"); 10773 addMenu(new LLToolsEnableToolNotPie(), "Tools.EnableToolNotPie");
10774 addMenu(new LLToolsEnableSelectNextPart(), "Tools.EnableSelectNextPart");
10682 addMenu(new LLToolsEnableLink(), "Tools.EnableLink"); 10775 addMenu(new LLToolsEnableLink(), "Tools.EnableLink");
10683 addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink"); 10776 addMenu(new LLToolsEnableUnlink(), "Tools.EnableUnlink");
10684 addMenu(new LLToolsEnableTake(), "Tools.EnableTake"); 10777 addMenu(new LLToolsEnableTake(), "Tools.EnableTake");
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
index f8e569e..18a7db8 100644
--- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
@@ -661,6 +661,29 @@
661 <on_check control="EditLinkedParts" /> 661 <on_check control="EditLinkedParts" />
662 <on_enable function="Tools.EnableToolNotPie" /> 662 <on_enable function="Tools.EnableToolNotPie" />
663 </menu_item_check> 663 </menu_item_check>
664 <menu create_jump_keys="true" drop_shadow="true" enabled="true" label="Select Linked Parts"
665 mouse_opaque="false" name="Select Linked Parts" opaque="true" tear_off="true">
666 <menu_item_call enabled="false" label="Select Next Part" mouse_opaque="true"
667 name="Select Next Part" shortcut="control|.">
668 <on_click function="Tools.SelectNextPart" userdata="next" />
669 <on_enable function="Tools.EnableSelectNextPart" />
670 </menu_item_call>
671 <menu_item_call enabled="false" label="Select Previous Part" mouse_opaque="true"
672 name="Select Previous Part" shortcut="control|,">
673 <on_click function="Tools.SelectNextPart" userdata="previous" />
674 <on_enable function="Tools.EnableSelectNextPart" />
675 </menu_item_call>
676 <menu_item_call enabled="false" label="Include Next Part" mouse_opaque="true"
677 name="Include Next Part" shortcut="control|shift|.">
678 <on_click function="Tools.SelectNextPart" userdata="includenext" />
679 <on_enable function="Tools.EnableSelectNextPart" />
680 </menu_item_call>
681 <menu_item_call enabled="false" label="Include Previous Part" mouse_opaque="true"
682 name="Include Previous Part" shortcut="control|shift|,">
683 <on_click function="Tools.SelectNextPart" userdata="includeprevious" />
684 <on_enable function="Tools.EnableSelectNextPart" />
685 </menu_item_call>
686 </menu>
664 <menu_item_call name="Link" enabled="false" label="Link" 687 <menu_item_call name="Link" enabled="false" label="Link"
665 shortcut="control|L"> 688 shortcut="control|L">
666 <on_click function="Tools.Link" userdata="" /> 689 <on_click function="Tools.Link" userdata="" />