summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2016-11-29 11:30:59 +0000
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2016-11-29 11:30:59 +0000
commita088a12992e8741b3a41781179aae69dc8a83adb (patch)
tree48ea52403a8e396c0facfd00e87f1c78a86e015f /indra/newview
parentd91584ed708e87be1906a23772c56b31a34164dc (diff)
parent3ff62d000fd2c66625f1c86d5e91bd0e7d824a04 (diff)
Merged in MAINT-6803 face cycling
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llviewermenu.cpp126
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml20
2 files changed, 109 insertions, 37 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index c45233c638..24df985e3a 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -79,6 +79,7 @@
#include "lllandmarkactions.h"
#include "llgroupmgr.h"
#include "lltooltip.h"
+#include "lltoolface.h"
#include "llhints.h"
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
@@ -5185,30 +5186,83 @@ class LLToolsEnableSelectNextPart : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
- bool new_value = (gSavedSettings.getBOOL("EditLinkedParts") &&
- !LLSelectMgr::getInstance()->getSelection()->isEmpty());
+ bool new_value = (!LLSelectMgr::getInstance()->getSelection()->isEmpty()
+ && (gSavedSettings.getBOOL("EditLinkedParts")
+ || LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool()));
return new_value;
}
};
-// Cycle selection through linked children in selected object.
+// Cycle selection through linked children or/and faces in selected object.
// FIXME: Order of children list is not always the same as sim's idea of link order. This may confuse
// resis. Need link position added to sim messages to address this.
-class LLToolsSelectNextPart : public view_listener_t
+class LLToolsSelectNextPartFace : public view_listener_t
{
- bool handleEvent(const LLSD& userdata)
- {
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool cycle_faces = LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool();
+ bool cycle_linked = gSavedSettings.getBOOL("EditLinkedParts");
+
+ if (!cycle_faces && !cycle_linked)
+ {
+ // Nothing to do
+ return true;
+ }
+
+ bool fwd = (userdata.asString() == "next");
+ bool prev = (userdata.asString() == "previous");
+ bool ifwd = (userdata.asString() == "includenext");
+ bool iprev = (userdata.asString() == "includeprevious");
+
+ LLViewerObject* to_select = NULL;
+ bool restart_face_on_part = !cycle_faces;
+ S32 new_te = 0;
+
+ if (cycle_faces)
+ {
+ // Cycle through faces of current selection, if end is reached, swithc to next part (if present)
+ LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
+ if (!nodep) return false;
+ to_select = nodep->getObject();
+ if (!to_select) return false;
+
+ S32 te_count = to_select->getNumTEs();
+ S32 selected_te = nodep->getLastSelectedTE();
+
+ if ((fwd || ifwd) && selected_te >= 0)
+ {
+ if (selected_te + 1 < te_count)
+ {
+ // select next face
+ new_te = selected_te + 1;
+ }
+ else
+ {
+ // restart from first face on next part
+ restart_face_on_part = true;
+ }
+ }
+ else if ((prev || iprev) && selected_te < te_count)
+ {
+ if (selected_te - 1 >= 0)
+ {
+ // select previous face
+ new_te = selected_te - 1;
+ }
+ else
+ {
+ // restart from last face on next part
+ restart_face_on_part = true;
+ }
+ }
+ }
+
S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
- if (gSavedSettings.getBOOL("EditLinkedParts") && object_count)
+ if (cycle_linked && object_count && restart_face_on_part)
{
LLViewerObject* selected = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
if (selected && selected->getRootEdit())
{
- bool fwd = (userdata.asString() == "next");
- bool prev = (userdata.asString() == "previous");
- bool ifwd = (userdata.asString() == "includenext");
- bool iprev = (userdata.asString() == "includeprevious");
- LLViewerObject* to_select = NULL;
LLViewerObject::child_list_t children = selected->getRootEdit()->getChildren();
children.push_front(selected->getRootEdit()); // need root in the list too
@@ -5250,22 +5304,40 @@ class LLToolsSelectNextPart : public view_listener_t
}
}
}
-
- if (to_select)
- {
- if (gFocusMgr.childHasKeyboardFocus(gFloaterTools))
- {
- gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes
- }
- if (fwd || prev)
- {
- LLSelectMgr::getInstance()->deselectAll();
- }
- LLSelectMgr::getInstance()->selectObjectOnly(to_select);
- return true;
- }
}
}
+
+ if (to_select)
+ {
+ if (gFocusMgr.childHasKeyboardFocus(gFloaterTools))
+ {
+ gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes
+ }
+ if (fwd || prev)
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+ if (cycle_faces)
+ {
+ if (restart_face_on_part)
+ {
+ if (fwd || ifwd)
+ {
+ new_te = 0;
+ }
+ else
+ {
+ new_te = to_select->getNumTEs() - 1;
+ }
+ }
+ LLSelectMgr::getInstance()->addAsIndividual(to_select, new_te, FALSE);
+ }
+ else
+ {
+ LLSelectMgr::getInstance()->selectObjectOnly(to_select);
+ }
+ return true;
+ }
return true;
}
};
@@ -8747,7 +8819,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts");
view_listener_t::addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY");
view_listener_t::addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid");
- view_listener_t::addMenu(new LLToolsSelectNextPart(), "Tools.SelectNextPart");
+ view_listener_t::addMenu(new LLToolsSelectNextPartFace(), "Tools.SelectNextPart");
commit.add("Tools.Link", boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance()));
commit.add("Tools.Unlink", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()));
view_listener_t::addMenu(new LLToolsStopAllAnimations(), "Tools.StopAllAnimations");
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 8a649a57d1..dce06630f8 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -885,12 +885,12 @@
</menu_item_check>
<menu
create_jump_keys="true"
- label="Select Linked Parts"
- name="Select Linked Parts"
+ label="Select Elements"
+ name="Select Elements"
tear_off="true">
<menu_item_call
- label="Select Next Part"
- name="Select Next Part"
+ label="Select Next Part or Face"
+ name="Select Next Part or Face"
shortcut="control|.">
<menu_item_call.on_click
function="Tools.SelectNextPart"
@@ -899,8 +899,8 @@
function="Tools.EnableSelectNextPart" />
</menu_item_call>
<menu_item_call
- label="Select Previous Part"
- name="Select Previous Part"
+ label="Select Previous Part or Face"
+ name="Select Previous Part or Face"
shortcut="control|,">
<menu_item_call.on_click
function="Tools.SelectNextPart"
@@ -909,8 +909,8 @@
function="Tools.EnableSelectNextPart" />
</menu_item_call>
<menu_item_call
- label="Include Next Part"
- name="Include Next Part"
+ label="Include Next Part or Face"
+ name="Include Next Part or Face"
shortcut="control|shift|.">
<menu_item_call.on_click
function="Tools.SelectNextPart"
@@ -919,8 +919,8 @@
function="Tools.EnableSelectNextPart" />
</menu_item_call>
<menu_item_call
- label="Include Previous Part"
- name="Include Previous Part"
+ label="Include Previous Part or Face"
+ name="Include Previous Part or Face"
shortcut="control|shift|,">
<menu_item_call.on_click
function="Tools.SelectNextPart"