From 82477c484d5f605c44074c277230ea8d1a993fa2 Mon Sep 17 00:00:00 2001 From: Kyler Eastridge Date: Sun, 27 Jul 2025 18:14:52 +0100 Subject: Add ability to disable look at hints --- indra/newview/llhudeffectlookat.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llhudeffectlookat.cpp') diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index d0d2ee191a..845a003500 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -392,6 +392,12 @@ void LLHUDEffectLookAt::setTargetPosGlobal(const LLVector3d &target_pos_global) //----------------------------------------------------------------------------- bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { + static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtHints", true); + if (!enable_lookat_hints) + { + return false; + } + if (!mSourceObject) { return false; -- cgit v1.3 From eb9c83cda3fd4b8f1ffa12c2543336112afac7eb Mon Sep 17 00:00:00 2001 From: Kyler Eastridge Date: Mon, 28 Jul 2025 02:51:19 +0100 Subject: Initial limit look at distance code --- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ indra/newview/llhudeffectlookat.cpp | 26 +++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) (limited to 'indra/newview/llhudeffectlookat.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c416944a24..531aa9984c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16267,5 +16267,27 @@ Value 1 + LimitLookAtHints + + Comment + Whether or not to clamp the look at targets around the avatar head before sending + Persist + 1 + Type + Boolean + Value + 1 + + LimitLookAtHintsDistance + + Comment + Distance to limit look at target to + Persist + 1 + Type + F32 + Value + 4 + diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index 845a003500..f726ef1354 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -37,6 +37,7 @@ #include "lldrawable.h" #include "llviewerobjectlist.h" #include "llviewercontrol.h" +#include "llvoavatarself.h" #include "llrendersphere.h" #include "llselectmgr.h" #include "llglheaders.h" @@ -390,7 +391,7 @@ void LLHUDEffectLookAt::setTargetPosGlobal(const LLVector3d &target_pos_global) // setLookAt() // called by agent logic to set look at behavior locally, and propagate to sim //----------------------------------------------------------------------------- -bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) +bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject* object, LLVector3 position) { static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtHints", true); if (!enable_lookat_hints) @@ -415,6 +416,29 @@ bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec return false; } + static LLCachedControl limit_lookat_hints(gSavedSettings, "LimitLookAtHints", true); + // Don't affect the look at if object is gAgentAvatarp (cursor head follow) + if (limit_lookat_hints && object != gAgentAvatarp) + { + // If it is a object + if (object) + { + position += object->getRenderPosition(); + object = NULL; + } + + LLVector3 agentHeadPosition = gAgentAvatarp->mHeadp->getWorldPosition(); + float dist = (float)dist_vec(agentHeadPosition, position); + + static LLCachedControl limit_lookat_hints_distance(gSavedSettings, "LimitLookAtHintsDistance", 2.0f); + if (dist > limit_lookat_hints_distance) + { + LLVector3 headOffset = position - agentHeadPosition; + headOffset *= limit_lookat_hints_distance / dist; + position.setVec(agentHeadPosition + headOffset); + } + } + F32 current_time = mTimer.getElapsedTimeF32(); // type of lookat behavior or target object has changed -- cgit v1.3 From 5c8fdad01fdbc68af3c38cfe147c87e9b4d6df7b Mon Sep 17 00:00:00 2001 From: Kyler Eastridge Date: Mon, 28 Jul 2025 03:26:33 +0100 Subject: Fix formatting issue caused by VS again --- indra/newview/llhudeffectlookat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llhudeffectlookat.cpp') diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index f726ef1354..a8fde33a25 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -391,7 +391,7 @@ void LLHUDEffectLookAt::setTargetPosGlobal(const LLVector3d &target_pos_global) // setLookAt() // called by agent logic to set look at behavior locally, and propagate to sim //----------------------------------------------------------------------------- -bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject* object, LLVector3 position) +bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtHints", true); if (!enable_lookat_hints) -- cgit v1.3 From 5785bfdb700c618365ea22c4deb3e6330d31c3d2 Mon Sep 17 00:00:00 2001 From: Kyler Eastridge Date: Mon, 28 Jul 2025 04:33:34 +0100 Subject: Fix look at target privacy causing head to get stuck --- indra/newview/llhudeffectlookat.cpp | 14 +++++++++++--- indra/newview/llhudeffectpointat.cpp | 12 +++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'indra/newview/llhudeffectlookat.cpp') diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index a8fde33a25..e7894e6c84 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -393,14 +393,22 @@ void LLHUDEffectLookAt::setTargetPosGlobal(const LLVector3d &target_pos_global) //----------------------------------------------------------------------------- bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { - static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtHints", true); - if (!enable_lookat_hints) + if (!mSourceObject) { return false; } - if (!mSourceObject) + static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtHints", true); + if (!enable_lookat_hints) { + if (mTargetType != LOOKAT_TARGET_IDLE) + { + mTargetObject = gAgentAvatarp; + mTargetType = LOOKAT_TARGET_IDLE; + mTargetOffsetGlobal.set(2.f, 0.f, 0.f); + setDuration(3.f); + setNeedsSendToSim(true); + } return false; } diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 23ab0e873d..b6515df3e1 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -222,14 +222,20 @@ void LLHUDEffectPointAt::setTargetPosGlobal(const LLVector3d &target_pos_global) //----------------------------------------------------------------------------- bool LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *object, LLVector3 position) { - static LLCachedControl enable_selection_hints(gSavedSettings, "EnableSelectionHints", true); - if (!enable_selection_hints) + if (!mSourceObject) { return false; } - if (!mSourceObject) + static LLCachedControl enable_selection_hints(gSavedSettings, "EnableSelectionHints", true); + if (!enable_selection_hints) { + if (mTargetType != POINTAT_TARGET_NONE) + { + clearPointAtTarget(); + setDuration(1.f); + setNeedsSendToSim(true); + } return false; } -- cgit v1.3 From aae33e4ef236359722fc8f0bfe4040392eaa3420 Mon Sep 17 00:00:00 2001 From: Kyler Eastridge Date: Mon, 28 Jul 2025 04:46:05 +0100 Subject: It's a target, not a hint --- indra/newview/app_settings/settings.xml | 8 ++++---- indra/newview/llhudeffectlookat.cpp | 6 +++--- indra/newview/skins/default/xui/en/panel_preferences_privacy.xml | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/newview/llhudeffectlookat.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 28240f50c6..2241bb89a4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16256,10 +16256,10 @@ Value 1 - EnableLookAtHints + EnableLookAtTarget Comment - Whether or not to send animate the avatar head and send look at hints when moving the cursor or focusing on objects + Whether or not to send animate the avatar head and send look at targets when moving the cursor or focusing on objects Persist 1 Type @@ -16267,7 +16267,7 @@ Value 1 - LimitLookAtHints + LimitLookAtTarget Comment Whether or not to clamp the look at targets around the avatar head before sending @@ -16278,7 +16278,7 @@ Value 0 - LimitLookAtHintsDistance + LimitLookAtTargetDistance Comment Distance to limit look at target to diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index e7894e6c84..f995048210 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -398,7 +398,7 @@ bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec return false; } - static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtHints", true); + static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtTarget", true); if (!enable_lookat_hints) { if (mTargetType != LOOKAT_TARGET_IDLE) @@ -424,7 +424,7 @@ bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec return false; } - static LLCachedControl limit_lookat_hints(gSavedSettings, "LimitLookAtHints", true); + static LLCachedControl limit_lookat_hints(gSavedSettings, "LimitLookAtTarget", true); // Don't affect the look at if object is gAgentAvatarp (cursor head follow) if (limit_lookat_hints && object != gAgentAvatarp) { @@ -438,7 +438,7 @@ bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec LLVector3 agentHeadPosition = gAgentAvatarp->mHeadp->getWorldPosition(); float dist = (float)dist_vec(agentHeadPosition, position); - static LLCachedControl limit_lookat_hints_distance(gSavedSettings, "LimitLookAtHintsDistance", 2.0f); + static LLCachedControl limit_lookat_hints_distance(gSavedSettings, "LimitLookAtTargetDistance", 2.0f); if (dist > limit_lookat_hints_distance) { LLVector3 headOffset = position - agentHeadPosition; diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml index c651d58f3b..bbd2ac367e 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml @@ -75,17 +75,17 @@ top_pad="10" width="350" /> Date: Tue, 29 Jul 2025 13:51:17 +0100 Subject: Add explaination as to why we do clearing inside effect set* functions --- indra/newview/llhudeffectlookat.cpp | 1 + indra/newview/llhudeffectpointat.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/newview/llhudeffectlookat.cpp') diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index f995048210..776d2dd31e 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -401,6 +401,7 @@ bool LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec static LLCachedControl enable_lookat_hints(gSavedSettings, "EnableLookAtTarget", true); if (!enable_lookat_hints) { + // Clear the effect so it doesn't linger around if it gets disabled if (mTargetType != LOOKAT_TARGET_IDLE) { mTargetObject = gAgentAvatarp; diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index b6515df3e1..c600010f6b 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -230,6 +230,7 @@ bool LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob static LLCachedControl enable_selection_hints(gSavedSettings, "EnableSelectionHints", true); if (!enable_selection_hints) { + // Clear the effect so it doesn't linger around if it gets disabled if (mTargetType != POINTAT_TARGET_NONE) { clearPointAtTarget(); -- cgit v1.3