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.cpp87
1 files changed, 40 insertions, 47 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index b6bcf9544d..b444cb8ce6 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -84,50 +84,48 @@ LLToolPie::LLToolPie()
: LLTool(std::string("Select")),
mPieMouseButtonDown( FALSE ),
mGrabMouseButtonDown( FALSE ),
- mHitLand( FALSE ),
- mHitObjectID(),
mMouseOutsideSlop( FALSE )
{ }
BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
{
- gPickFaces = TRUE;
//left mouse down always picks transparent
- gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, leftMouseCallback,
- TRUE, TRUE);
+ gViewerWindow->pickAsync(x, y, mask, leftMouseCallback, TRUE, TRUE);
mGrabMouseButtonDown = TRUE;
return TRUE;
}
// static
-void LLToolPie::leftMouseCallback(S32 x, S32 y, MASK mask)
+void LLToolPie::leftMouseCallback(const LLPickInfo& pick_info)
{
- LLToolPie::getInstance()->pickAndShowMenu(x, y, mask, FALSE);
+ LLToolPie::getInstance()->mPick = pick_info;
+ LLToolPie::getInstance()->pickAndShowMenu(FALSE);
}
BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
- // Pick faces in case they select "Copy Texture" and need that info.
- gPickFaces = TRUE;
// don't pick transparent so users can't "pay" transparent objects
- gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, rightMouseCallback,
- FALSE, TRUE);
+ gViewerWindow->pickAsync(x, y, mask, rightMouseCallback, FALSE);
mPieMouseButtonDown = TRUE;
// don't steal focus from UI
return FALSE;
}
// static
-void LLToolPie::rightMouseCallback(S32 x, S32 y, MASK mask)
+void LLToolPie::rightMouseCallback(const LLPickInfo& pick_info)
{
- LLToolPie::getInstance()->pickAndShowMenu(x, y, mask, TRUE);
+ LLToolPie::getInstance()->mPick = pick_info;
+ LLToolPie::getInstance()->pickAndShowMenu(TRUE);
}
// True if you selected an object.
-BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
+BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
{
- if (!always_show && gLastHitParcelWall)
+ S32 x = mPick.mMousePt.mX;
+ S32 y = mPick.mMousePt.mY;
+ MASK mask = mPick.mKeyMask;
+ if (!always_show && mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL)
{
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel();
if (parcel)
@@ -151,25 +149,18 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
}
// didn't click in any UI object, so must have clicked in the world
- LLViewerObject *object = gViewerWindow->lastObjectHit();
+ LLViewerObject *object = mPick.getObject();
LLViewerObject *parent = NULL;
- mHitLand = !object && !gLastHitPosGlobal.isExactlyZero();
- if (!mHitLand)
+ if (mPick.mPickType != LLPickInfo::PICK_LAND)
{
LLViewerParcelMgr::getInstance()->deselectLand();
}
if (object)
{
- mHitObjectID = object->mID;
-
parent = object->getRootEdit();
}
- else
- {
- mHitObjectID.setNull();
- }
BOOL touchable = (object && object->flagHandleTouch())
|| (parent && parent->flagHandleTouch());
@@ -206,19 +197,19 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
{
// pay event goes to object actually clicked on
sClickActionObject = object;
- sLeftClickSelection = LLToolSelect::handleObjectSelection(object, MASK_NONE, FALSE, TRUE);
+ sLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
return TRUE;
}
break;
case CLICK_ACTION_BUY:
sClickActionObject = parent;
- sLeftClickSelection = LLToolSelect::handleObjectSelection(parent, MASK_NONE, FALSE, TRUE);
+ sLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
return TRUE;
case CLICK_ACTION_OPEN:
if (parent && parent->allowOpen())
{
sClickActionObject = parent;
- sLeftClickSelection = LLToolSelect::handleObjectSelection(parent, MASK_NONE, FALSE, TRUE);
+ sLeftClickSelection = LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE, TRUE);
}
return TRUE;
case CLICK_ACTION_PLAY:
@@ -239,12 +230,13 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
{
gGrabTransientTool = this;
LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
- return LLToolGrab::getInstance()->handleObjectHit( object, x, y, mask);
+ return LLToolGrab::getInstance()->handleObjectHit( mPick );
}
- if (!object && gLastHitHUDIcon && gLastHitHUDIcon->getSourceObject())
+ LLHUDIcon* last_hit_hud_icon = mPick.mHUDIcon;
+ if (!object && last_hit_hud_icon && last_hit_hud_icon->getSourceObject())
{
- LLFloaterScriptDebug::show(gLastHitHUDIcon->getSourceObject()->getID());
+ LLFloaterScriptDebug::show(last_hit_hud_icon->getSourceObject()->getID());
}
// If left-click never selects or spawns a menu
@@ -273,7 +265,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
gViewerWindow->hideCursor();
LLToolCamera::getInstance()->setMouseCapture(TRUE);
- LLToolCamera::getInstance()->pickCallback(gViewerWindow->getCurrentMouseX(), gViewerWindow->getCurrentMouseY(), mask);
+ LLToolCamera::getInstance()->pickCallback(mPick);
gAgent.setFocusOnAvatar(TRUE, TRUE);
return TRUE;
@@ -292,22 +284,22 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
}
// Can't ignore children here.
- LLToolSelect::handleObjectSelection(object, mask, FALSE, TRUE);
+ LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
// Spawn pie menu
- if (mHitLand)
+ if (mPick.mPickType == LLPickInfo::PICK_LAND)
{
- LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( gLastHitPosGlobal );
+ LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal );
gMenuHolder->setParcelSelection(selection);
gPieLand->show(x, y, mPieMouseButtonDown);
// VEFFECT: ShowPie
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
- effectp->setPositionGlobal(gLastHitPosGlobal);
+ effectp->setPositionGlobal(mPick.mPosGlobal);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
effectp->setDuration(0.25f);
}
- else if (mHitObjectID == gAgent.getID() )
+ else if (mPick.mObjectID == gAgent.getID() )
{
if(!gPieSelf)
{
@@ -377,7 +369,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
// Don't show when you click on someone else, it freaks them
// out.
LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
- effectp->setPositionGlobal(gLastHitPosGlobal);
+ effectp->setPositionGlobal(mPick.mPosGlobal);
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
effectp->setDuration(0.25f);
}
@@ -544,7 +536,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
LLViewerObject *parent = NULL;
if (gHoverView)
{
- object = gHoverView->getLastHoverObject();
+ object = gViewerWindow->getHoverPick().getObject();
}
if (object)
@@ -581,7 +573,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
{
- LLViewerObject* obj = gViewerWindow->lastObjectHit();
+ LLViewerObject* obj = mPick.getObject();
U8 click_action = final_click_action(obj);
if (click_action != CLICK_ACTION_NONE)
{
@@ -626,18 +618,18 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
if (gSavedSettings.getBOOL("DoubleClickAutoPilot"))
{
- if (gLastHitLand
- && !gLastHitPosGlobal.isExactlyZero())
+ if (mPick.mPickType == LLPickInfo::PICK_LAND
+ && !mPick.mPosGlobal.isExactlyZero())
{
handle_go_to();
return TRUE;
}
- else if (gLastHitObjectID.notNull()
- && !gLastHitPosGlobal.isExactlyZero())
+ else if (mPick.mObjectID.notNull()
+ && !mPick.mPosGlobal.isExactlyZero())
{
// Hit an object
// HACK: Call the last hit position the point we hit on the object
- gLastHitPosGlobal += gLastHitObjectOffset;
+ //gLastHitPosGlobal += gLastHitObjectOffset;
handle_go_to();
return TRUE;
}
@@ -649,7 +641,7 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
objects gets you into trouble.
// If double-click on object or land, go there.
- LLViewerObject *object = gViewerWindow->lastObjectHit();
+ LLViewerObject *object = gViewerWindow->getLastPick().getObject();
if (object)
{
if (object->isAvatar())
@@ -756,10 +748,11 @@ static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp)
if (objectp.isNull()) return;
// did we hit a valid face on the object?
- if( gLastHitObjectFace < 0 || gLastHitObjectFace >= objectp->getNumTEs() ) return;
+ S32 face = LLToolPie::getInstance()->getPick().mObjectFace;
+ if( face < 0 || face >= objectp->getNumTEs() ) return;
// is media playing on this face?
- if (!LLViewerMedia::isActiveMediaTexture(objectp->getTE(gLastHitObjectFace)->getID()))
+ if (!LLViewerMedia::isActiveMediaTexture(objectp->getTE(face)->getID()))
{
handle_click_action_play();
return;