Removed redundant double-click-teleport logic.

This commit is contained in:
Shyotl
2012-06-09 02:28:42 -05:00
parent 1a217b23c6
commit 5ce477c7cc
2 changed files with 26 additions and 74 deletions

View File

@@ -779,38 +779,26 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
llinfos << "LLToolPie handleDoubleClick (becoming mouseDown)" << llendl;
}
if (gSavedSettings.getBOOL("DoubleClickAutoPilot") || gSavedSettings.getBOOL("DoubleClickTeleport"))
if (gSavedSettings.getBOOL("DoubleClickAutoPilot"))
{
if (mPick.mPickType == LLPickInfo::PICK_LAND
&& !mPick.mPosGlobal.isExactlyZero())
if ((mPick.mPickType == LLPickInfo::PICK_LAND && !mPick.mPosGlobal.isExactlyZero()) ||
(mPick.mObjectID.notNull() && !mPick.mPosGlobal.isExactlyZero()))
{
handle_go_to();
return TRUE;
}
else if (mPick.mObjectID.notNull()
&& !mPick.mPosGlobal.isExactlyZero())
{
// Hit an object
// Do not go to attachments...
if (mPick.getObject() && !mPick.getObject()->isHUDAttachment())
{
// HACK: Call the last hit position the point we hit on the object
//gLastHitPosGlobal += gLastHitObjectOffset;
handle_go_to();
return TRUE;
}
}
} else
/* code added to support double click teleports */
if (gSavedSettings.getBOOL("DoubleClickTeleport"))
}
else if (gSavedSettings.getBOOL("DoubleClickTeleport"))
{
LLViewerObject* objp = mPick.getObject();
LLViewerObject* parentp = objp ? objp->getRootEdit() : NULL;
bool is_in_world = mPick.mObjectID.notNull() && objp && !objp->isHUDAttachment();
bool is_land = mPick.mPickType == LLPickInfo::PICK_LAND;
bool pos_non_zero = !mPick.mPosGlobal.isExactlyZero();
bool has_touch_handler = (objp && objp->flagHandleTouch()) || (parentp && parentp->flagHandleTouch());
bool has_click_action = final_click_action(objp);
if (pos_non_zero && (is_land || (is_in_world && !has_touch_handler && !has_click_action)))
{
LLVector3d pos = mPick.mPosGlobal;
@@ -821,30 +809,6 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
}
return FALSE;
/* JC - don't do go-there, because then double-clicking on physical
objects gets you into trouble.
// If double-click on object or land, go there.
LLViewerObject *object = gViewerWindow->getLastPick().getObject();
if (object)
{
if (object->isAvatar())
{
LLFloaterAvatarInfo::showFromAvatar(object->getID());
}
else
{
handle_go_to(NULL);
}
}
else if (!gLastHitPosGlobal.isExactlyZero())
{
handle_go_to(NULL);
}
return TRUE;
*/
}

View File

@@ -2751,44 +2751,32 @@ bool handle_go_to()
*/
// [/RLVa:KB]
// JAMESDEBUG try simulator autopilot
// try simulator autopilot
std::vector<std::string> strings;
std::string val;
LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
if (gSavedSettings.getBOOL("DoubleClickTeleport")
)
val = llformat("%g", pos.mdV[VX]);
strings.push_back(val);
val = llformat("%g", pos.mdV[VY]);
strings.push_back(val);
val = llformat("%g", pos.mdV[VZ]);
strings.push_back(val);
send_generic_message("autopilot", strings);
LLViewerParcelMgr::getInstance()->deselectLand();
if (isAgentAvatarValid() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
{
LLVector3d hips_offset(0.0f, 0.0f, 1.2f);
gAgent.teleportViaLocation(pos + hips_offset);
gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID());
}
else
else
{
// JAMESDEBUG try simulator autopilot
std::vector<std::string> strings;
std::string val;
val = llformat("%g", pos.mdV[VX]);
strings.push_back(val);
val = llformat("%g", pos.mdV[VY]);
strings.push_back(val);
val = llformat("%g", pos.mdV[VZ]);
strings.push_back(val);
send_generic_message("autopilot", strings);
LLViewerParcelMgr::getInstance()->deselectLand();
if (gAgentAvatarp && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
{
gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID());
}
else
{
// Snap camera back to behind avatar
gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
}
// Could be first use
LLFirstUse::useGoTo();
// Snap camera back to behind avatar
gAgentCamera.setFocusOnAvatar(TRUE, ANIMATE);
}
// Could be first use
LLFirstUse::useGoTo();
return true;
}