Feature Request: Add option to hide own look at beacon(from Alchemy)

Option is in System->Security & Privacy, at the top with the rest of the lookat options.

Syncs llhudeffectlookat with Alchemy
This commit is contained in:
Inusaito Sayori
2015-05-20 21:09:56 -04:00
parent eec85de620
commit aa1e0ce067
6 changed files with 134 additions and 121 deletions

View File

@@ -157,6 +157,17 @@
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>0</integer>
</map> </map>
<key>AlchemyLookAtHideSelf</key>
<map>
<key>Comment</key>
<string>Hide own Look At beacon when Look At render is enabled</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>AlchemyMouselookIFF</key> <key>AlchemyMouselookIFF</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@@ -193,6 +193,7 @@ void LLPrefsAscentSys::refreshValues()
mBroadcastViewerEffects = gSavedSettings.getBOOL("BroadcastViewerEffects"); mBroadcastViewerEffects = gSavedSettings.getBOOL("BroadcastViewerEffects");
mDisablePointAtAndBeam = gSavedSettings.getBOOL("DisablePointAtAndBeam"); mDisablePointAtAndBeam = gSavedSettings.getBOOL("DisablePointAtAndBeam");
mPrivateLookAt = gSavedSettings.getBOOL("PrivateLookAt"); mPrivateLookAt = gSavedSettings.getBOOL("PrivateLookAt");
mHideOwnLookAt = gSavedSettings.getBOOL("AlchemyLookAtHideSelf");
mShowLookAt = gSavedSettings.getBOOL("AscentShowLookAt"); mShowLookAt = gSavedSettings.getBOOL("AscentShowLookAt");
mLookAtNames = gSavedSettings.getS32("LookAtNameSystem"); mLookAtNames = gSavedSettings.getS32("LookAtNameSystem");
mLookAtLines = gSavedSettings.getBOOL("AlchemyLookAtLines"); mLookAtLines = gSavedSettings.getBOOL("AlchemyLookAtLines");
@@ -340,6 +341,7 @@ void LLPrefsAscentSys::cancel()
gSavedSettings.setBOOL("BroadcastViewerEffects", mBroadcastViewerEffects); gSavedSettings.setBOOL("BroadcastViewerEffects", mBroadcastViewerEffects);
gSavedSettings.setBOOL("DisablePointAtAndBeam", mDisablePointAtAndBeam); gSavedSettings.setBOOL("DisablePointAtAndBeam", mDisablePointAtAndBeam);
gSavedSettings.setBOOL("PrivateLookAt", mPrivateLookAt); gSavedSettings.setBOOL("PrivateLookAt", mPrivateLookAt);
gSavedSettings.setBOOL("AlchemyLookAtHideSelf", mHideOwnLookAt);
gSavedSettings.setBOOL("AscentShowLookAt", mShowLookAt); gSavedSettings.setBOOL("AscentShowLookAt", mShowLookAt);
gSavedSettings.setS32("LookAtNameSystem", mLookAtNames); gSavedSettings.setS32("LookAtNameSystem", mLookAtNames);
gSavedSettings.setBOOL("AlchemyLookAtLines", mLookAtLines); gSavedSettings.setBOOL("AlchemyLookAtLines", mLookAtLines);

View File

@@ -103,6 +103,7 @@ private:
bool mBroadcastViewerEffects; bool mBroadcastViewerEffects;
bool mDisablePointAtAndBeam; bool mDisablePointAtAndBeam;
bool mPrivateLookAt; bool mPrivateLookAt;
bool mHideOwnLookAt;
bool mShowLookAt; bool mShowLookAt;
S32 mLookAtNames; S32 mLookAtNames;
bool mLookAtLines; bool mLookAtLines;

View File

@@ -2,31 +2,25 @@
* @file llhudeffectlookat.cpp * @file llhudeffectlookat.cpp
* @brief LLHUDEffectLookAt class implementation * @brief LLHUDEffectLookAt class implementation
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -39,24 +33,22 @@
#include "message.h" #include "message.h"
#include "llagent.h" #include "llagent.h"
#include "llagentcamera.h" #include "llagentcamera.h"
#include "llvoavatarself.h" #include "llvoavatar.h"
#include "lldrawable.h" #include "lldrawable.h"
#include "llviewerobjectlist.h" #include "llviewerobjectlist.h"
#include "llrendersphere.h" #include "llrendersphere.h"
#include "llselectmgr.h" #include "llselectmgr.h"
#include "llglheaders.h" #include "llglheaders.h"
#include "llxmltree.h" #include "llxmltree.h"
// <edit>
// <alchemy>
#include "llavatarnamecache.h" #include "llavatarnamecache.h"
#include "llresmgr.h"
#include "llhudrender.h" #include "llhudrender.h"
#include "llviewerwindow.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
// </edit> // </alchemy>
#include "rlvhandler.h" #include "rlvhandler.h"
//BOOL LLHUDEffectLookAt::sDebugLookAt = FALSE; // <alchemy/>
// packet layout // packet layout
const S32 SOURCE_AVATAR = 0; const S32 SOURCE_AVATAR = 0;
@@ -253,7 +245,10 @@ static BOOL loadAttentions()
LLHUDEffectLookAt::LLHUDEffectLookAt(const U8 type) : LLHUDEffectLookAt::LLHUDEffectLookAt(const U8 type) :
LLHUDEffect(type), LLHUDEffect(type),
mKillTime(0.f), mKillTime(0.f),
mLastSendTime(0.f) // <alchemy>
mLastSendTime(0.f),
mDebugLookAt(gSavedSettings, "AscentShowLookAt", false)
// </alchemy>
{ {
clearLookAtTarget(); clearLookAtTarget();
// parse the default sets // parse the default sets
@@ -341,20 +336,20 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
htonmemcpy(source_id.mData, &(packed_data[SOURCE_AVATAR]), MVT_LLUUID, 16); htonmemcpy(source_id.mData, &(packed_data[SOURCE_AVATAR]), MVT_LLUUID, 16);
LLVOAvatar *avatarp = gObjectList.findAvatar(source_id); LLViewerObject *objp = gObjectList.findObject(source_id);
if (avatarp) if (objp && objp->isAvatar())
{ {
setSourceObject(avatarp); setSourceObject(objp);
} }
else else
{ {
//llwarns << "Could not find source avatar for lookat effect" << llendl; //LL_WARNS() << "Could not find source avatar for lookat effect" << LL_ENDL;
return; return;
} }
htonmemcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16); htonmemcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16);
LLViewerObject *objp = gObjectList.findObject(target_id); objp = gObjectList.findObject(target_id);
htonmemcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24); htonmemcpy(new_target.mdV, &(packed_data[TARGET_POS]), MVT_LLVector3d, 24);
@@ -368,13 +363,22 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
} }
else else
{ {
//llwarns << "Could not find target object for lookat effect" << llendl; //LL_WARNS() << "Could not find target object for lookat effect" << LL_ENDL;
} }
U8 lookAtTypeUnpacked = 0; U8 lookAtTypeUnpacked = 0;
htonmemcpy(&lookAtTypeUnpacked, &(packed_data[LOOKAT_TYPE]), MVT_U8, 1); htonmemcpy(&lookAtTypeUnpacked, &(packed_data[LOOKAT_TYPE]), MVT_U8, 1);
mTargetType = (ELookAtType)lookAtTypeUnpacked; // <alchemy>
if ((U8)LOOKAT_NUM_TARGETS > lookAtTypeUnpacked)
{
mTargetType = (ELookAtType)lookAtTypeUnpacked;
}
else
{
mTargetType = LOOKAT_TARGET_NONE;
LL_DEBUGS("HUDEffect") << "Invalid target type: " << lookAtTypeUnpacked << LL_ENDL;
}
// </alchemy>
if (mTargetType == LOOKAT_TARGET_NONE) if (mTargetType == LOOKAT_TARGET_NONE)
{ {
clearLookAtTarget(); clearLookAtTarget();
@@ -505,15 +509,15 @@ void LLHUDEffectLookAt::setSourceObject(LLViewerObject* objectp)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLHUDEffectLookAt::render() void LLHUDEffectLookAt::render()
{ {
static const LLCachedControl<bool> private_look_at("PrivateLookAt",false); // <alchemy>
static const LLCachedControl<bool> show_look_at("AscentShowLookAt", false); if (mDebugLookAt && mSourceObject.notNull())
if (private_look_at && (gAgentAvatarp == ((LLVOAvatar*)(LLViewerObject*)mSourceObject)))
return;
if (show_look_at && mSourceObject.notNull())
{ {
LLGLDepthTest gls_depth(GL_TRUE,GL_FALSE); static LLCachedControl<bool> isOwnHidden(gSavedSettings, "AlchemyLookAtHideSelf", true);
static LLCachedControl<bool> isPrivate(gSavedSettings, "PrivateLookAt", false);
static const LLCachedControl<bool> show_look_at("AscentShowLookAt", false);
if ((isOwnHidden || isPrivate) && static_cast<LLVOAvatar*>(mSourceObject.get())->isSelf())
return;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -534,7 +538,8 @@ void LLHUDEffectLookAt::render()
gGL.vertex3f(0.f, 0.f, -1.f); gGL.vertex3f(0.f, 0.f, -1.f);
gGL.vertex3f(0.f, 0.f, 1.f); gGL.vertex3f(0.f, 0.f, 1.f);
static const LLCachedControl<bool> lookAtLines(gSavedSettings, "AlchemyLookAtLines", false);
static LLCachedControl<bool> lookAtLines(gSavedSettings, "AlchemyLookAtLines", false);
if (lookAtLines) if (lookAtLines)
{ {
const std::string targname = (*mAttentions)[mTargetType].mName; const std::string targname = (*mAttentions)[mTargetType].mName;
@@ -545,46 +550,54 @@ void LLHUDEffectLookAt::render()
gGL.vertex3f(dist.mV[VX], dist.mV[VY], dist.mV[VZ] + 0.5f); gGL.vertex3f(dist.mV[VX], dist.mV[VY], dist.mV[VZ] + 0.5f);
} }
} }
} gGL.end(); }
gGL.end();
gGL.popMatrix(); gGL.popMatrix();
// <edit>
static const LLCachedControl<S32> lookAtNames("LookAtNameSystem"); static LLCachedControl<S32> lookAtNames(gSavedSettings, "LookAtNameSystem", 0);
if (lookAtNames < 0) return; if (lookAtNames >= 0)
std::string text; {
if (!LLAvatarNameCache::getNSName(static_cast<LLVOAvatar*>(mSourceObject.get())->getID(), text, lookAtNames)) return; std::string text;
if (text.length() > 9 && 0 == text.compare(text.length() - 9, 9, " Resident")) if (!LLAvatarNameCache::getNSName(static_cast<LLVOAvatar*>(mSourceObject.get())->getID(), text, lookAtNames)) return;
text.erase(text.length() - 9); if (text.length() > 9 && 0 == text.compare(text.length() - 9, 9, " Resident"))
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) text.erase(text.length() - 9);
text = RlvStrings::getAnonym(text); if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
LLVector3 offset = gAgentCamera.getCameraPositionAgent() - target; text = RlvStrings::getAnonym(text);
offset.normalize();
LLVector3 shadow_offset = offset * 0.49f; LLVector3 offset = gAgentCamera.getCameraPositionAgent() - target;
offset *= 0.5f; offset.normalize();
const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF); LLVector3 shadow_offset = offset * 0.49f;
LLGLEnable gl_blend(GL_BLEND); offset *= 0.5f;
gGL.pushMatrix(); LLGLEnable gl_blend(GL_BLEND);
gViewerWindow->setup2DViewport();
hud_render_utf8text(text, const LLFontGL* fontp = LLFontGL::getFontSansSerif();
target + shadow_offset, gGL.pushMatrix();
*font, hud_render_utf8text(
LLFontGL::NORMAL, text,
LLFontGL::NO_SHADOW, target + shadow_offset,
-0.5f * font->getWidthF32(text) + 2.0f, *fontp,
-2.0f, LLFontGL::NORMAL,
LLColor4::black, LLFontGL::NO_SHADOW,
FALSE); -0.5f * fontp->getWidthF32(text) + 2.0f,
hud_render_utf8text(text, -2.0f,
target + offset, LLColor4::black,
*font, FALSE
LLFontGL::NORMAL, );
LLFontGL::NO_SHADOW, hud_render_utf8text(
-0.5f * font->getWidthF32(text), text,
0.0f, target + offset,
(*mAttentions)[mTargetType].mColor, *fontp,
FALSE); LLFontGL::NORMAL,
gGL.popMatrix(); LLFontGL::NO_SHADOW,
// </edit> -0.5f * fontp->getWidthF32(text),
0.0f,
(*mAttentions)[mTargetType].mColor,
FALSE
);
gGL.popMatrix();
}
} }
// </alchemy>
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -592,8 +605,6 @@ void LLHUDEffectLookAt::render()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLHUDEffectLookAt::update() void LLHUDEffectLookAt::update()
{ {
static const LLCachedControl<bool> show_look_at("AscentShowLookAt", false);
// If the target object is dead, set the target object to NULL // If the target object is dead, set the target object to NULL
if (!mTargetObject.isNull() && mTargetObject->isDead()) if (!mTargetObject.isNull() && mTargetObject->isDead())
{ {
@@ -640,14 +651,10 @@ void LLHUDEffectLookAt::update()
} }
} }
// Singu note: this displays extra information for look at targets. Due to the bug in llvoavatar.cpp if (mDebugLookAt) // <alchemy/>
// it was never displayed before and is not something users exect: turning it off for now
#if 0
if (show_look_at)
{ {
((LLVOAvatar*)(LLViewerObject*)mSourceObject)->addDebugText((*mAttentions)[mTargetType].mName); // ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->addDebugText((*mAttentions)[mTargetType].mName); // <alchemy/>
} }
#endif
} }
/** /**
@@ -662,11 +669,6 @@ void LLHUDEffectLookAt::update()
*/ */
bool LLHUDEffectLookAt::calcTargetPosition() bool LLHUDEffectLookAt::calcTargetPosition()
{ {
if (gNoRender)
{
return false;
}
LLViewerObject *target_obj = (LLViewerObject *)mTargetObject; LLViewerObject *target_obj = (LLViewerObject *)mTargetObject;
LLVector3 local_offset; LLVector3 local_offset;

View File

@@ -2,31 +2,25 @@
* @file llhudeffectlookat.h * @file llhudeffectlookat.h
* @brief LLHUDEffectLookAt class definition * @brief LLHUDEffectLookAt class definition
* *
* $LicenseInfo:firstyear=2002&license=viewergpl$ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code * Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab * Copyright (C) 2010, Linden Research, Inc.
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* *
* There are special exceptions to the terms and conditions of the GPL as * This library is free software; you can redistribute it and/or
* it is applied to this Source Code. View the full text of the exception * modify it under the terms of the GNU Lesser General Public
* in the file doc/FLOSS-exception.txt in this software distribution, or * License as published by the Free Software Foundation;
* online at * version 2.1 of the License only.
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* *
* By copying, modifying or distributing this software, you acknowledge * This library is distributed in the hope that it will be useful,
* that you have read and understood your obligations described above, * but WITHOUT ANY WARRANTY; without even the implied warranty of
* and agree to abide by those obligations. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* *
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO * You should have received a copy of the GNU Lesser General Public
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, * License along with this library; if not, write to the Free Software
* COMPLETENESS OR PERFORMANCE. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$ * $/LicenseInfo$
*/ */
@@ -34,7 +28,7 @@
#define LL_LLHUDEFFECTLOOKAT_H #define LL_LLHUDEFFECTLOOKAT_H
#include "llhudeffect.h" #include "llhudeffect.h"
#include "llframetimer.h" #include "llcontrol.h" // <alchemy/>
class LLViewerObject; class LLViewerObject;
class LLVOAvatar; class LLVOAvatar;
@@ -85,7 +79,8 @@ protected:
void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset); void setTargetObjectAndOffset(LLViewerObject *objp, LLVector3d offset);
void setTargetPosGlobal(const LLVector3d &target_pos_global); void setTargetPosGlobal(const LLVector3d &target_pos_global);
public: //public:
// static BOOL sDebugLookAt; // <alchemy/>
private: private:
ELookAtType mTargetType; ELookAtType mTargetType;
@@ -96,6 +91,7 @@ private:
LLVector3 mTargetPos; LLVector3 mTargetPos;
F32 mLastSendTime; F32 mLastSendTime;
LLAttentionSet* mAttentions; LLAttentionSet* mAttentions;
LLCachedControl<bool> mDebugLookAt; // <alchemy/>
}; };
#endif // LL_LLHUDEFFECTLOOKAT_H #endif // LL_LLHUDEFFECTLOOKAT_H

View File

@@ -91,7 +91,8 @@
<check_box bottom_delta="-25" control_name="BroadcastViewerEffects" follows="top" initial_value="true" label="Broadcast Viewer Effects (does not affect pointat and lookat)" left="10" name="broadcast_viewer_effects" width="400"/> <check_box bottom_delta="-25" control_name="BroadcastViewerEffects" follows="top" initial_value="true" label="Broadcast Viewer Effects (does not affect pointat and lookat)" left="10" name="broadcast_viewer_effects" width="400"/>
<check_box bottom_delta="-20" control_name="DisablePointAtAndBeam" follows="top" initial_value="true" label="Disable Point At And Beam" tool_tip="Don't point at or show your edit beam when selecting an object." name="disable_point_at_and_beams_check"/> <check_box bottom_delta="-20" control_name="DisablePointAtAndBeam" follows="top" initial_value="true" label="Disable Point At And Beam" tool_tip="Don't point at or show your edit beam when selecting an object." name="disable_point_at_and_beams_check"/>
<check_box bottom_delta="-20" control_name="PrivateLookAt" follows="top" initial_value="false" label="Do not Look At objects and/or avatars" tool_tip="Disables headturns and lookat beacons, causing your avatar to look straight ahead (unless scripted to do otherwise)." name="private_look_at_check"/> <check_box bottom_delta="-20" control_name="PrivateLookAt" follows="top" initial_value="false" label="Do not Look At objects and/or avatars" tool_tip="Disables headturns and lookat beacons, causing your avatar to look straight ahead (unless scripted to do otherwise)." name="private_look_at_check"/>
<check_box bottom_delta="-20" control_name="AscentShowLookAt" follows="top" initial_value="false" label="Show others' LookAt beacons" tool_tip="Shows you where others are looking." name="show_look_at_check"/> <check_box bottom_delta="-20" control_name="AlchemyLookAtHideSelf" follows="top" initial_value="false" label="Don't show me my LookAt beacon" tool_tip="Don't show me my own camera crosshairs" name="LookAtHideOwn"/>
<check_box bottom_delta="-20" control_name="AscentShowLookAt" follows="top" initial_value="false" label="Show LookAt beacons" tool_tip="Shows you where people are looking." name="show_look_at_check"/>
<combo_box bottom_delta="-1" left_delta="200" follows="top" height="18" control_name="LookAtNameSystem" name="lookat_namesystem_combobox" width="130" tool_tip="Style for displaying names on LookAt beacons"> <combo_box bottom_delta="-1" left_delta="200" follows="top" height="18" control_name="LookAtNameSystem" name="lookat_namesystem_combobox" width="130" tool_tip="Style for displaying names on LookAt beacons">
<combo_item name="No Names" value="-1">No Names</combo_item> <combo_item name="No Names" value="-1">No Names</combo_item>
<combo_item name="Old Names" value="0">Old Names</combo_item> <combo_item name="Old Names" value="0">Old Names</combo_item>