summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolpie.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoolpie.cpp')
-rw-r--r--indra/newview/lltoolpie.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 2f4a69a53c..84c463495b 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 "llviewercontrol.h"
#include "llfocusmgr.h"
//#include "llfirstuse.h"
@@ -204,15 +205,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()))
@@ -263,7 +264,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());
@@ -273,7 +274,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 );
}
@@ -329,14 +330,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;
}
@@ -410,26 +411,28 @@ 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_HAND;
+ if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting?
+ {
+ cursor = UI_CURSOR_TOOLSIT;
+ }
}
break;
case CLICK_ACTION_BUY:
- cursor = UI_CURSOR_HAND;
+ cursor = UI_CURSOR_TOOLBUY;
break;
case CLICK_ACTION_OPEN:
// Open always opens the parent.
if (parent && parent->allowOpen())
{
- cursor = UI_CURSOR_HAND;
+ cursor = UI_CURSOR_TOOLOPEN;
}
break;
case CLICK_ACTION_PAY:
if ((object && object->flagTakesMoney())
|| (parent && parent->flagTakesMoney()))
{
- cursor = UI_CURSOR_HAND;
+ cursor = UI_CURSOR_TOOLBUY;
}
break;
case CLICK_ACTION_ZOOM:
@@ -496,6 +499,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;
@@ -507,10 +512,11 @@ 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 (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
{
show_highlight = true;
- ECursorType cursor = cursor_from_object(object);
+ ECursorType cursor = cursor_from_object(click_action_object);
gViewerWindow->setCursor(cursor);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
@@ -592,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);
}
@@ -964,7 +970,7 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l
}
}
}
-
+
// Avoid showing tip over media that's displaying unless it's for sale
// also check the primary node since sometimes it can have an action even though
@@ -972,9 +978,9 @@ BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string l
bool needs_tip = (!is_media_displaying ||
for_sale) &&
- (has_media ||
- needs_tooltip(nodep) ||
- needs_tooltip(LLSelectMgr::getInstance()->getPrimaryHoverNode()));
+ (has_media ||
+ needs_tooltip(nodep) ||
+ needs_tooltip(LLSelectMgr::getInstance()->getPrimaryHoverNode()));
if (show_all_object_tips || needs_tip)
{