From ab55c61dc3e7394529a8af825a634e5c926e4976 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 23 Jan 2014 19:35:17 -0500 Subject: [PATCH] Feature Request: Add option to reset angles/offsets adjustments made to current camera preset. Adds "Reset Camera Preset Angle to Default" to view menu Wasn't quite sure where to hook this up, menu seemed the best for the moment, but really it's more of a preferences button function. --- indra/newview/llagentcamera.cpp | 9 +++++++++ indra/newview/llagentcamera.h | 3 +++ indra/newview/llviewermenu.cpp | 10 ++++++++++ indra/newview/skins/default/xui/en-us/menu_viewer.xml | 3 +++ 4 files changed, 25 insertions(+) diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 5f979de31..d08bd8a36 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -2106,6 +2106,15 @@ void LLAgentCamera::handleScrollWheel(S32 clicks) } } +//----------------------------------------------------------------------------- +// resetPresetOffsets() - Sets the current preset back to its default state +//----------------------------------------------------------------------------- +void LLAgentCamera::resetPresetOffsets() +{ + mFocusOffsetInitial[mCameraPreset]->resetToDefault(); + mCameraOffsetInitial[mCameraPreset]->resetToDefault(); +} + //----------------------------------------------------------------------------- // getCameraMinOffGround() diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 3a2ced058..8ba8a4f70 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -113,6 +113,9 @@ private: //-------------------------------------------------------------------- public: void switchCameraPreset(ECameraPreset preset); + + /** Sets the current preset back to its default state */ + void resetPresetOffsets(); private: /** Determines default camera offset depending on the current camera preset */ LLVector3 getCameraOffsetInitial(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 272b17937..4e881c87e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4160,6 +4160,15 @@ void reset_view_final( BOOL proceed ) } +class LLViewResetPresetAngles : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gAgentCamera.resetPresetOffsets(); + return true; + } +}; + class LLViewLookAtLastChatter : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9634,6 +9643,7 @@ void initialize_menus() addMenu(new LLViewJoystickFlycam(), "View.JoystickFlycam"); addMenu(new LLViewCommunicate(), "View.Communicate"); addMenu(new LLViewResetView(), "View.ResetView"); + addMenu(new LLViewResetPresetAngles(), "View.ResetPresetAngles"); addMenu(new LLViewLookAtLastChatter(), "View.LookAtLastChatter"); addMenu(new LLViewShowHoverTips(), "View.ShowHoverTips"); addMenu(new LLViewHighlightTransparent(), "View.HighlightTransparent"); diff --git a/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/indra/newview/skins/default/xui/en-us/menu_viewer.xml index d72d44242..38744a6d3 100644 --- a/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -308,6 +308,9 @@ + + +