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>
<integer>0</integer>
</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>
<map>
<key>Comment</key>

View File

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

View File

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

View File

@@ -2,31 +2,25 @@
* @file llhudeffectlookat.cpp
* @brief LLHUDEffectLookAt class implementation
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
* Copyright (c) 2002-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* 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
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,24 +33,22 @@
#include "message.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llvoavatarself.h"
#include "llvoavatar.h"
#include "lldrawable.h"
#include "llviewerobjectlist.h"
#include "llrendersphere.h"
#include "llselectmgr.h"
#include "llglheaders.h"
#include "llxmltree.h"
// <edit>
// <alchemy>
#include "llavatarnamecache.h"
#include "llresmgr.h"
#include "llhudrender.h"
#include "llviewerwindow.h"
#include "llviewercontrol.h"
// </edit>
// </alchemy>
#include "rlvhandler.h"
//BOOL LLHUDEffectLookAt::sDebugLookAt = FALSE; // <alchemy/>
// packet layout
const S32 SOURCE_AVATAR = 0;
@@ -253,7 +245,10 @@ static BOOL loadAttentions()
LLHUDEffectLookAt::LLHUDEffectLookAt(const U8 type) :
LLHUDEffect(type),
mKillTime(0.f),
mLastSendTime(0.f)
// <alchemy>
mLastSendTime(0.f),
mDebugLookAt(gSavedSettings, "AscentShowLookAt", false)
// </alchemy>
{
clearLookAtTarget();
// 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);
LLVOAvatar *avatarp = gObjectList.findAvatar(source_id);
if (avatarp)
LLViewerObject *objp = gObjectList.findObject(source_id);
if (objp && objp->isAvatar())
{
setSourceObject(avatarp);
setSourceObject(objp);
}
else
{
//llwarns << "Could not find source avatar for lookat effect" << llendl;
//LL_WARNS() << "Could not find source avatar for lookat effect" << LL_ENDL;
return;
}
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);
@@ -368,13 +363,22 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
}
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;
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)
{
clearLookAtTarget();
@@ -505,15 +509,15 @@ void LLHUDEffectLookAt::setSourceObject(LLViewerObject* objectp)
//-----------------------------------------------------------------------------
void LLHUDEffectLookAt::render()
{
static const LLCachedControl<bool> private_look_at("PrivateLookAt",false);
static const LLCachedControl<bool> show_look_at("AscentShowLookAt", false);
if (private_look_at && (gAgentAvatarp == ((LLVOAvatar*)(LLViewerObject*)mSourceObject)))
return;
if (show_look_at && mSourceObject.notNull())
// <alchemy>
if (mDebugLookAt && 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);
@@ -534,7 +538,8 @@ void LLHUDEffectLookAt::render()
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)
{
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.end();
}
gGL.end();
gGL.popMatrix();
// <edit>
static const LLCachedControl<S32> lookAtNames("LookAtNameSystem");
if (lookAtNames < 0) return;
std::string text;
if (!LLAvatarNameCache::getNSName(static_cast<LLVOAvatar*>(mSourceObject.get())->getID(), text, lookAtNames)) return;
if (text.length() > 9 && 0 == text.compare(text.length() - 9, 9, " Resident"))
text.erase(text.length() - 9);
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
text = RlvStrings::getAnonym(text);
LLVector3 offset = gAgentCamera.getCameraPositionAgent() - target;
offset.normalize();
LLVector3 shadow_offset = offset * 0.49f;
offset *= 0.5f;
const LLFontGL* font = LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF);
LLGLEnable gl_blend(GL_BLEND);
gGL.pushMatrix();
gViewerWindow->setup2DViewport();
hud_render_utf8text(text,
target + shadow_offset,
*font,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
-0.5f * font->getWidthF32(text) + 2.0f,
-2.0f,
LLColor4::black,
FALSE);
hud_render_utf8text(text,
target + offset,
*font,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
-0.5f * font->getWidthF32(text),
0.0f,
(*mAttentions)[mTargetType].mColor,
FALSE);
gGL.popMatrix();
// </edit>
static LLCachedControl<S32> lookAtNames(gSavedSettings, "LookAtNameSystem", 0);
if (lookAtNames >= 0)
{
std::string text;
if (!LLAvatarNameCache::getNSName(static_cast<LLVOAvatar*>(mSourceObject.get())->getID(), text, lookAtNames)) return;
if (text.length() > 9 && 0 == text.compare(text.length() - 9, 9, " Resident"))
text.erase(text.length() - 9);
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
text = RlvStrings::getAnonym(text);
LLVector3 offset = gAgentCamera.getCameraPositionAgent() - target;
offset.normalize();
LLVector3 shadow_offset = offset * 0.49f;
offset *= 0.5f;
LLGLEnable gl_blend(GL_BLEND);
const LLFontGL* fontp = LLFontGL::getFontSansSerif();
gGL.pushMatrix();
hud_render_utf8text(
text,
target + shadow_offset,
*fontp,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
-0.5f * fontp->getWidthF32(text) + 2.0f,
-2.0f,
LLColor4::black,
FALSE
);
hud_render_utf8text(
text,
target + offset,
*fontp,
LLFontGL::NORMAL,
LLFontGL::NO_SHADOW,
-0.5f * fontp->getWidthF32(text),
0.0f,
(*mAttentions)[mTargetType].mColor,
FALSE
);
gGL.popMatrix();
}
}
// </alchemy>
}
//-----------------------------------------------------------------------------
@@ -592,8 +605,6 @@ void LLHUDEffectLookAt::render()
//-----------------------------------------------------------------------------
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 (!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
// it was never displayed before and is not something users exect: turning it off for now
#if 0
if (show_look_at)
if (mDebugLookAt) // <alchemy/>
{
((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()
{
if (gNoRender)
{
return false;
}
LLViewerObject *target_obj = (LLViewerObject *)mTargetObject;
LLVector3 local_offset;

View File

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