summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolpie.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-05-11 16:11:09 -0700
committerJames Cook <james@lindenlab.com>2010-05-11 16:11:09 -0700
commit2b7153c26a6dd5284218253910f466a0faeff708 (patch)
tree8b8f54545c540d4e5f28d4a91215280117f52dff /indra/newview/lltoolpie.cpp
parentbae06b4b62587bd567495e3940a323e4c635a63e (diff)
parent8e1dbbbb5628eee210a0a7c25f32287d7b754a8b (diff)
merge from dessie/viewer-public right before SLE code landed
Diffstat (limited to 'indra/newview/lltoolpie.cpp')
-rw-r--r--indra/newview/lltoolpie.cpp68
1 files changed, 37 insertions, 31 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 4bf0e18123..67db778bdb 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -39,6 +39,7 @@
#include "llparcel.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "llavatarnamecache.h"
#include "llviewercontrol.h"
#include "llfocusmgr.h"
@@ -181,10 +182,10 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
parent = object->getRootEdit();
}
-
- BOOL touchable = (object && object->flagHandleTouch())
- || (parent && parent->flagHandleTouch());
-
+ if (handleMediaClick(mPick))
+ {
+ return TRUE;
+ }
// If it's a left-click, and we have a special action, do it.
if (useClickAction(mask, object, parent))
@@ -205,15 +206,15 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
// touch behavior down below...
break;
case CLICK_ACTION_SIT:
-
- if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting
{
- handle_object_sit_or_stand();
- // put focus in world when sitting on an object
- gFocusMgr.setKeyboardFocus(NULL);
- return TRUE;
- } // else nothing (fall through to touch)
-
+ if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // agent not already sitting
+ {
+ handle_object_sit_or_stand();
+ // put focus in world when sitting on an object
+ gFocusMgr.setKeyboardFocus(NULL);
+ return TRUE;
+ } // else nothing (fall through to touch)
+ }
case CLICK_ACTION_PAY:
if ((object && object->flagTakesMoney())
|| (parent && parent->flagTakesMoney()))
@@ -264,7 +265,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
if (object)
{
- gAgent.setFocusOnAvatar(FALSE, ANIMATE);
+ gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
LLBBox bbox = object->getBoundingBoxAgent() ;
F32 angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getAspect() > 1.f ? LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect() : LLViewerCamera::getInstance()->getView());
@@ -274,7 +275,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
obj_to_cam.normVec();
LLVector3d object_center_global = gAgent.getPosGlobalFromAgent(bbox.getCenterAgent());
- gAgent.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
+ gAgentCamera.setCameraPosAndFocusGlobal(object_center_global + LLVector3d(obj_to_cam * distance),
object_center_global,
mPick.mObjectID );
}
@@ -286,14 +287,12 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
}
}
- if (handleMediaClick(mPick))
- {
- return TRUE;
- }
-
// put focus back "in world"
gFocusMgr.setKeyboardFocus(NULL);
+ BOOL touchable = (object && object->flagHandleTouch())
+ || (parent && parent->flagHandleTouch());
+
// Switch to grab tool if physical or triggerable
if (object &&
!object->isAvatar() &&
@@ -330,14 +329,14 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
}
object = (LLViewerObject*)object->getParent();
}
- if (object && object == gAgent.getAvatarObject())
+ if (object && object == gAgentAvatarp)
{
// we left clicked on avatar, switch to focus mode
LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
gViewerWindow->hideCursor();
LLToolCamera::getInstance()->setMouseCapture(TRUE);
LLToolCamera::getInstance()->pickCallback(mPick);
- gAgent.setFocusOnAvatar(TRUE, TRUE);
+ gAgentCamera.setFocusOnAvatar(TRUE, TRUE);
return TRUE;
}
@@ -411,9 +410,11 @@ ECursorType cursor_from_object(LLViewerObject* object)
switch(click_action)
{
case CLICK_ACTION_SIT:
- if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting?
{
- cursor = UI_CURSOR_TOOLSIT;
+ if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting?
+ {
+ cursor = UI_CURSOR_TOOLSIT;
+ }
}
break;
case CLICK_ACTION_BUY:
@@ -497,6 +498,8 @@ void LLToolPie::selectionPropertiesReceived()
BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
{
mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE);
+ // perform a separate pick that detects transparent objects since they respond to 1-click actions
+ LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, TRUE);
// Show screen-space highlight glow effect
bool show_highlight = false;
@@ -508,21 +511,23 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
parent = object->getRootEdit();
}
- if (object && useClickAction(mask, object, parent))
+ LLViewerObject* click_action_object = click_action_pick.getObject();
+ if (handleMediaHover(mHoverPick))
{
+ // *NOTE: If you think the hover glow conflicts with the media outline, you
+ // could disable it here.
show_highlight = true;
- ECursorType cursor = cursor_from_object(object);
- gViewerWindow->setCursor(cursor);
+ // cursor set by media object
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
- else if (handleMediaHover(mHoverPick))
+ else if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
{
- // *NOTE: If you think the hover glow conflicts with the media outline, you
- // could disable it here.
show_highlight = true;
- // cursor set by media object
+ ECursorType cursor = cursor_from_object(click_action_object);
+ gViewerWindow->setCursor(cursor);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
+
else if ((object && !object->isAvatar() && object->usePhysics())
|| (parent && !parent->isAvatar() && parent->usePhysics()))
{
@@ -593,7 +598,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
mGrabMouseButtonDown = FALSE;
LLToolMgr::getInstance()->clearTransientTool();
- gAgent.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on
+ gAgentCamera.setLookAt(LOOKAT_TARGET_CONVERSATION, obj); // maybe look at object/person clicked on
return LLTool::handleMouseUp(x, y, mask);
}
@@ -1279,6 +1284,7 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
if (!parcel ||
objectp.isNull() ||
+ objectp->isHUDAttachment() ||
pick.mObjectFace < 0 ||
pick.mObjectFace >= objectp->getNumTEs())
{