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/lltoolfocus.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/lltoolfocus.cpp')
-rw-r--r-- | linden/indra/newview/lltoolfocus.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/linden/indra/newview/lltoolfocus.cpp b/linden/indra/newview/lltoolfocus.cpp index e5a3ed5..ffc1766 100644 --- a/linden/indra/newview/lltoolfocus.cpp +++ b/linden/indra/newview/lltoolfocus.cpp | |||
@@ -69,7 +69,7 @@ const F32 FOCUS_OFFSET_FACTOR = 1.f; | |||
69 | // | 69 | // |
70 | 70 | ||
71 | LLToolCamera::LLToolCamera() | 71 | LLToolCamera::LLToolCamera() |
72 | : LLTool("Camera"), | 72 | : LLTool(std::string("Camera")), |
73 | mAccumX(0), | 73 | mAccumX(0), |
74 | mAccumY(0), | 74 | mAccumY(0), |
75 | mMouseDownX(0), | 75 | mMouseDownX(0), |
@@ -126,28 +126,28 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) | |||
126 | 126 | ||
127 | gViewerWindow->hideCursor(); | 127 | gViewerWindow->hideCursor(); |
128 | 128 | ||
129 | gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, pickCallback); | 129 | gViewerWindow->pickAsync(x, y, mask, pickCallback); |
130 | // don't steal focus from UI | 130 | // don't steal focus from UI |
131 | return FALSE; | 131 | return FALSE; |
132 | } | 132 | } |
133 | 133 | ||
134 | void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) | 134 | void LLToolCamera::pickCallback(const LLPickInfo& pick_info) |
135 | { | 135 | { |
136 | if (!LLToolCamera::getInstance()->hasMouseCapture()) | 136 | if (!LLToolCamera::getInstance()->hasMouseCapture()) |
137 | { | 137 | { |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | 140 | ||
141 | LLToolCamera::getInstance()->mMouseDownX = x; | 141 | LLToolCamera::getInstance()->mMouseDownX = pick_info.mMousePt.mX; |
142 | LLToolCamera::getInstance()->mMouseDownY = y; | 142 | LLToolCamera::getInstance()->mMouseDownY = pick_info.mMousePt.mY; |
143 | 143 | ||
144 | gViewerWindow->moveCursorToCenter(); | 144 | gViewerWindow->moveCursorToCenter(); |
145 | 145 | ||
146 | // Potentially recenter if click outside rectangle | 146 | // Potentially recenter if click outside rectangle |
147 | LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); | 147 | LLViewerObject* hit_obj = pick_info.getObject(); |
148 | 148 | ||
149 | // Check for hit the sky, or some other invalid point | 149 | // Check for hit the sky, or some other invalid point |
150 | if (!hit_obj && gLastHitPosGlobal.isExactlyZero()) | 150 | if (!hit_obj && pick_info.mPosGlobal.isExactlyZero()) |
151 | { | 151 | { |
152 | LLToolCamera::getInstance()->mValidClickPoint = FALSE; | 152 | LLToolCamera::getInstance()->mValidClickPoint = FALSE; |
153 | return; | 153 | return; |
@@ -195,29 +195,27 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) | |||
195 | } | 195 | } |
196 | } | 196 | } |
197 | //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool | 197 | //RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool |
198 | else if (mask & MASK_ALT || | 198 | else if (pick_info.mKeyMask & MASK_ALT || |
199 | (LLToolMgr::getInstance()->getCurrentTool()->getName() == "Camera")) | 199 | (LLToolMgr::getInstance()->getCurrentTool()->getName() == "Camera")) |
200 | { | 200 | { |
201 | LLViewerObject* hit_obj = gViewerWindow->lastObjectHit(); | 201 | LLViewerObject* hit_obj = pick_info.getObject(); |
202 | if (hit_obj) | 202 | if (hit_obj) |
203 | { | 203 | { |
204 | // ...clicked on a world object, so focus at its position | 204 | // ...clicked on a world object, so focus at its position |
205 | // Use "gLastHitPosGlobal" because it's correct for avatar heads, | ||
206 | // not pelvis. | ||
207 | if (!hit_obj->isHUDAttachment()) | 205 | if (!hit_obj->isHUDAttachment()) |
208 | { | 206 | { |
209 | gAgent.setFocusOnAvatar(FALSE, ANIMATE); | 207 | gAgent.setFocusOnAvatar(FALSE, ANIMATE); |
210 | gAgent.setFocusGlobal( gLastHitObjectOffset + gLastHitPosGlobal, gLastHitObjectID); | 208 | gAgent.setFocusGlobal(pick_info); |
211 | } | 209 | } |
212 | } | 210 | } |
213 | else if (!gLastHitPosGlobal.isExactlyZero()) | 211 | else if (!pick_info.mPosGlobal.isExactlyZero()) |
214 | { | 212 | { |
215 | // Hit the ground | 213 | // Hit the ground |
216 | gAgent.setFocusOnAvatar(FALSE, ANIMATE); | 214 | gAgent.setFocusOnAvatar(FALSE, ANIMATE); |
217 | gAgent.setFocusGlobal( gLastHitPosGlobal, gLastHitObjectID); | 215 | gAgent.setFocusGlobal(pick_info); |
218 | } | 216 | } |
219 | 217 | ||
220 | if (!(mask & MASK_ALT) && | 218 | if (!(pick_info.mKeyMask & MASK_ALT) && |
221 | gAgent.cameraThirdPerson() && | 219 | gAgent.cameraThirdPerson() && |
222 | gViewerWindow->getLeftMouseDown() && | 220 | gViewerWindow->getLeftMouseDown() && |
223 | !gSavedSettings.getBOOL("FreezeTime") && | 221 | !gSavedSettings.getBOOL("FreezeTime") && |
@@ -238,7 +236,7 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask) | |||
238 | LLVector3d cam_pos = gAgent.getCameraPositionGlobal(); | 236 | LLVector3d cam_pos = gAgent.getCameraPositionGlobal(); |
239 | cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgent.calcCustomizeAvatarUIOffset( cam_pos )); | 237 | cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgent.calcCustomizeAvatarUIOffset( cam_pos )); |
240 | 238 | ||
241 | gAgent.setCameraPosAndFocusGlobal( cam_pos, gLastHitObjectOffset + gLastHitPosGlobal, gLastHitObjectID); | 239 | gAgent.setCameraPosAndFocusGlobal( cam_pos, pick_info.mPosGlobal, pick_info.mObjectID); |
242 | } | 240 | } |
243 | } | 241 | } |
244 | 242 | ||