summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authormaxim_productengine <mnikolenko@productengine.com>2020-03-16 17:48:23 +0200
committermaxim_productengine <mnikolenko@productengine.com>2020-03-16 17:48:23 +0200
commit3e403ffb4f6d295b11c9842bed53df5d15848f0b (patch)
tree3d7578891875c01cac14210fccccc94942f4ec07 /indra/newview
parentafd45506c12c93ff4b705d72de249005b9c27944 (diff)
SL-4495 Add setting to ignore Hover height when setting Camera position
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llagentcamera.cpp10
-rw-r--r--indra/newview/llagentcamera.h2
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_hover_height.xml19
4 files changed, 34 insertions, 8 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index f35408f48e..cc86ba85c1 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -16406,6 +16406,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>HoverHeightAffectsCamera</key>
+ <map>
+ <key>Comment</key>
+ <string>Camera view is affected by Hover Height setting</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>CefVerboseLog</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 6b1dd4c3c3..a1920f0332 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1730,7 +1730,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
F32 camera_land_height;
LLVector3d frame_center_global = !isAgentAvatarValid() ?
gAgent.getPositionGlobal() :
- gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition());
+ gAgent.getPosGlobalFromAgent(getAvatarRootPosition());
BOOL isConstrained = FALSE;
LLVector3d head_offset;
@@ -1987,7 +1987,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
LLVector3 LLAgentCamera::getCurrentCameraOffset()
{
- LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - gAgentAvatarp->mRoot->getWorldPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion();
+ LLVector3 camera_offset = (LLViewerCamera::getInstance()->getOrigin() - getAvatarRootPosition() - mThirdPersonHeadOffset) * ~gAgent.getFrameAgent().getQuaternion();
return camera_offset / mCameraZoomFraction / gSavedSettings.getF32("CameraOffsetScale");
}
@@ -2019,6 +2019,12 @@ F32 LLAgentCamera::getCameraMaxZoomDistance()
LLWorld::getInstance()->getRegionWidthInMeters() - CAMERA_FUDGE_FROM_OBJECT);
}
+LLVector3 LLAgentCamera::getAvatarRootPosition()
+{
+ static LLCachedControl<bool> use_hover_height(gSavedSettings, "HoverHeightAffectsCamera");
+ return use_hover_height ? gAgentAvatarp->mRoot->getWorldPosition() : gAgentAvatarp->mRoot->getWorldPosition() - gAgentAvatarp->getHoverOffset();
+
+}
//-----------------------------------------------------------------------------
// handleScrollWheel()
//-----------------------------------------------------------------------------
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 128974666e..a9f57cf956 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -147,6 +147,8 @@ public:
F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); }
void clearCameraLag() { mCameraLag.clearVec(); }
private:
+ LLVector3 getAvatarRootPosition();
+
F32 mCurrentCameraDistance; // Current camera offset from avatar
F32 mTargetCameraDistance; // Target camera offset from avatar
F32 mCameraFOVZoomFactor; // Amount of fov zoom applied to camera when zeroing in on an object
diff --git a/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml b/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml
index 52084e5f8e..3570456b44 100644
--- a/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml
+++ b/indra/newview/skins/default/xui/en/floater_edit_hover_height.xml
@@ -4,18 +4,16 @@
legacy_header_height="225"
can_minimize="true"
can_close="true"
- can_resize="true"
- min_height="65"
- min_width="515"
- height="65"
+ can_resize="false"
+ height="80"
+ width="515"
layout="topleft"
name="HoverHeight"
single_instance="true"
help_topic="hover_height"
save_rect="true"
save_visibility="true"
- title="SET HOVER HEIGHT"
- width="515">
+ title="SET HOVER HEIGHT">
<slider
enabled="false"
control_name="HoverHeightSlider"
@@ -34,4 +32,13 @@
can_edit_text="true"
>
</slider>
+ <check_box
+ control_name="HoverHeightAffectsCamera"
+ follows="all"
+ height="15"
+ label="Bind Camera view"
+ layout="topleft"
+ name="BindCameraCheck"
+ top_pad="7"
+ width="237"/>
</floater>