diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/lltoolselect.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/lltoolselect.cpp')
-rw-r--r-- | linden/indra/newview/lltoolselect.cpp | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/linden/indra/newview/lltoolselect.cpp b/linden/indra/newview/lltoolselect.cpp index d4a8153..d2f23ab 100644 --- a/linden/indra/newview/lltoolselect.cpp +++ b/linden/indra/newview/lltoolselect.cpp | |||
@@ -56,7 +56,7 @@ extern BOOL gAllowSelectAvatar; | |||
56 | const F32 SELECTION_ROTATION_TRESHOLD = 0.1f; | 56 | const F32 SELECTION_ROTATION_TRESHOLD = 0.1f; |
57 | 57 | ||
58 | LLToolSelect::LLToolSelect( LLToolComposite* composite ) | 58 | LLToolSelect::LLToolSelect( LLToolComposite* composite ) |
59 | : LLTool( "Select", composite ), | 59 | : LLTool( std::string("Select"), composite ), |
60 | mIgnoreGroup( FALSE ) | 60 | mIgnoreGroup( FALSE ) |
61 | { | 61 | { |
62 | } | 62 | } |
@@ -64,39 +64,24 @@ LLToolSelect::LLToolSelect( LLToolComposite* composite ) | |||
64 | // True if you selected an object. | 64 | // True if you selected an object. |
65 | BOOL LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask) | 65 | BOOL LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask) |
66 | { | 66 | { |
67 | BOOL handled = FALSE; | 67 | // do immediate pick query |
68 | 68 | mPick = gViewerWindow->pickImmediate(x, y, TRUE); | |
69 | // didn't click in any UI object, so must have clicked in the world | ||
70 | LLViewerObject* object = NULL; | ||
71 | |||
72 | // You must hit the body for this tool to think you hit the object. | ||
73 | object = gObjectList.findObject( gLastHitObjectID ); | ||
74 | |||
75 | if (object) | ||
76 | { | ||
77 | mSelectObjectID = object->getID(); | ||
78 | handled = TRUE; | ||
79 | } | ||
80 | else | ||
81 | { | ||
82 | mSelectObjectID.setNull(); | ||
83 | } | ||
84 | 69 | ||
85 | // Pass mousedown to agent | 70 | // Pass mousedown to agent |
86 | LLTool::handleMouseDown(x, y, mask); | 71 | LLTool::handleMouseDown(x, y, mask); |
87 | 72 | ||
88 | return handled; | 73 | return mPick.getObject().notNull(); |
89 | } | 74 | } |
90 | 75 | ||
91 | BOOL LLToolSelect::handleDoubleClick(S32 x, S32 y, MASK mask) | ||
92 | { | ||
93 | //RN: double click to toggle individual/linked picking??? | ||
94 | return LLTool::handleDoubleClick(x, y, mask); | ||
95 | } | ||
96 | 76 | ||
97 | // static | 77 | // static |
98 | LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObject *object, MASK mask, BOOL ignore_group, BOOL temp_select) | 78 | LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pick, BOOL ignore_group, BOOL temp_select, BOOL select_root) |
99 | { | 79 | { |
80 | LLViewerObject* object = pick.getObject(); | ||
81 | if (select_root) | ||
82 | { | ||
83 | object = object->getRootEdit(); | ||
84 | } | ||
100 | BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly"); | 85 | BOOL select_owned = gSavedSettings.getBOOL("SelectOwnedOnly"); |
101 | BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); | 86 | BOOL select_movable = gSavedSettings.getBOOL("SelectMovableOnly"); |
102 | 87 | ||
@@ -108,14 +93,16 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje | |||
108 | LLSelectMgr::getInstance()->setForceSelection(TRUE); | 93 | LLSelectMgr::getInstance()->setForceSelection(TRUE); |
109 | } | 94 | } |
110 | 95 | ||
111 | BOOL extend_select = (mask == MASK_SHIFT) || (mask == MASK_CONTROL); | 96 | BOOL extend_select = (pick.mKeyMask == MASK_SHIFT) || (pick.mKeyMask == MASK_CONTROL); |
112 | 97 | ||
113 | // If no object, check for icon, then just deselect | 98 | // If no object, check for icon, then just deselect |
114 | if (!object) | 99 | if (!object) |
115 | { | 100 | { |
116 | if (gLastHitHUDIcon && gLastHitHUDIcon->getSourceObject()) | 101 | LLHUDIcon* last_hit_hud_icon = pick.mHUDIcon; |
102 | |||
103 | if (last_hit_hud_icon && last_hit_hud_icon->getSourceObject()) | ||
117 | { | 104 | { |
118 | LLFloaterScriptDebug::show(gLastHitHUDIcon->getSourceObject()->getID()); | 105 | LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID()); |
119 | } | 106 | } |
120 | else if (!extend_select) | 107 | else if (!extend_select) |
121 | { | 108 | { |
@@ -212,9 +199,12 @@ LLSafeHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObje | |||
212 | select_node->setTransient(TRUE); | 199 | select_node->setTransient(TRUE); |
213 | } | 200 | } |
214 | 201 | ||
215 | for (S32 i = 0; i < (S32)root_object->mChildList.size(); i++) | 202 | LLViewerObject::const_child_list_t& child_list = root_object->getChildren(); |
203 | for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); | ||
204 | iter != child_list.end(); iter++) | ||
216 | { | 205 | { |
217 | select_node = selection->findNode(root_object->mChildList[i]); | 206 | LLViewerObject* child = *iter; |
207 | select_node = selection->findNode(child); | ||
218 | if (select_node) | 208 | if (select_node) |
219 | { | 209 | { |
220 | select_node->setTransient(TRUE); | 210 | select_node->setTransient(TRUE); |
@@ -240,8 +230,7 @@ BOOL LLToolSelect::handleMouseUp(S32 x, S32 y, MASK mask) | |||
240 | { | 230 | { |
241 | mIgnoreGroup = gSavedSettings.getBOOL("EditLinkedParts"); | 231 | mIgnoreGroup = gSavedSettings.getBOOL("EditLinkedParts"); |
242 | 232 | ||
243 | LLViewerObject* object = gObjectList.findObject(mSelectObjectID); | 233 | handleObjectSelection(mPick, mIgnoreGroup, FALSE); |
244 | LLToolSelect::handleObjectSelection(object, mask, mIgnoreGroup, FALSE); | ||
245 | 234 | ||
246 | return LLTool::handleMouseUp(x, y, mask); | 235 | return LLTool::handleMouseUp(x, y, mask); |
247 | } | 236 | } |
@@ -275,3 +264,4 @@ void LLToolSelect::onMouseCaptureLost() | |||
275 | 264 | ||
276 | 265 | ||
277 | 266 | ||
267 | |||