From 4fc2313314dfac1ba7262470ad2e98ebf95fbb58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 27 Feb 2014 14:15:10 +0100 Subject: [PATCH] FIRE-11267: Persist stored camera position in camera tools across relogs on per account basis --- .../app_settings/settings_per_account.xml | 41 +++++++++++++++++++ indra/newview/llagentcamera.cpp | 27 ++++++------ indra/newview/llagentcamera.h | 6 --- 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 742e6a2ac9..39f09d2b55 100755 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -701,6 +701,47 @@ + FSStoredCameraPos + + Comment + Stored camera position in camera tools + Persist + 1 + Type + Vector3D + Value + + 0.0 + 0.0 + 0.0 + + + FSStoredCameraFocus + + Comment + Stored camera focus position in camera tools + Persist + 1 + Type + Vector3D + Value + + 0.0 + 0.0 + 0.0 + + + FSStoredCameraFocusObjectId + + Comment + Stored object ID of camera focus in camera tools + Persist + 1 + Type + String + Value + + diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 93bbe945d2..4cb90042ac 100755 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -182,13 +182,6 @@ LLAgentCamera::LLAgentCamera() : mPanInKey(0.f), mPanOutKey(0.f), - // FIRE-7758: Save/load camera position - mStoredCameraPos(), - mStoredCameraFocus(), - mStoredCameraFocusObjectId(), - mHasStoredCameraPos(false), - // - mPointAtObject(NULL) { mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT ); @@ -2902,35 +2895,39 @@ S32 LLAgentCamera::directionToKey(S32 direction) // FIRE-7758: Save/load camera position feature void LLAgentCamera::storeCameraPosition() { - mStoredCameraPos = getCameraPositionGlobal(); - mStoredCameraFocus = getFocusTargetGlobal(); - mStoredCameraFocusObjectId = LLUUID::null; + gSavedPerAccountSettings.setVector3d("FSStoredCameraPos", getCameraPositionGlobal()); + gSavedPerAccountSettings.setVector3d("FSStoredCameraFocus", getFocusTargetGlobal()); + LLUUID stored_camera_focus_object_id = LLUUID::null; if (mFocusObject) { - mStoredCameraFocusObjectId = mFocusObject->getID(); + stored_camera_focus_object_id = mFocusObject->getID(); } - mHasStoredCameraPos = true; + gSavedPerAccountSettings.setString("FSStoredCameraFocusObjectId", stored_camera_focus_object_id.asString()); } void LLAgentCamera::loadCameraPosition() { + LLVector3d stored_camera_pos = gSavedPerAccountSettings.getVector3d("FSStoredCameraPos"); + LLVector3d stored_camera_focus = gSavedPerAccountSettings.getVector3d("FSStoredCameraFocus"); + LLUUID stored_camera_focus_object_id = LLUUID(gSavedPerAccountSettings.getString("FSStoredCameraFocusObjectId")); + F32 renderFarClip = gSavedSettings.getF32("RenderFarClip"); F32 far_clip_squared = renderFarClip * renderFarClip; - if (!mHasStoredCameraPos) + if (stored_camera_pos.isNull()) { reportToNearbyChat(LLTrans::getString("LoadCameraPositionNoneSaved")); return; } - if (dist_vec_squared(gAgent.getPositionGlobal(), mStoredCameraPos) > far_clip_squared) + if (dist_vec_squared(gAgent.getPositionGlobal(), stored_camera_pos) > far_clip_squared) { reportToNearbyChat(LLTrans::getString("LoadCameraPositionOutsideDrawDistance")); return; } unlockView(); - setCameraPosAndFocusGlobal(mStoredCameraPos, mStoredCameraFocus, mStoredCameraFocusObjectId); + setCameraPosAndFocusGlobal(stored_camera_pos, stored_camera_focus, stored_camera_focus_object_id); } // FIRE-7758: Save/load camera position feature diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index ba4fc13223..bedda95e1c 100755 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -396,12 +396,6 @@ private: public: void storeCameraPosition(); void loadCameraPosition(); - -private: - LLVector3d mStoredCameraPos; - LLVector3d mStoredCameraFocus; - LLUUID mStoredCameraFocusObjectId; - bool mHasStoredCameraPos; // FIRE-7758: Save/load camera position feature };