From 04a5080b670781d1f26e0878971013f37b1592d2 Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Thu, 18 Dec 2014 12:10:40 +0200
Subject: [PATCH] MAINT-4726 FIXED Strange camera roll when using freeze frame
 in snapshot floater

---
 indra/newview/llfloatersnapshot.cpp     |  2 +-
 indra/newview/llsnapshotlivepreview.cpp | 13 ++++++++-----
 indra/newview/llsnapshotlivepreview.h   |  1 +
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 5cea096a445..1d0ddc2ced3 100755
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -553,7 +553,7 @@ void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data)
 	{
 		view->impl.setStatus(Impl::STATUS_READY);
 		LL_DEBUGS() << "updating snapshot" << LL_ENDL;
-		previewp->updateSnapshot(TRUE);
+		previewp->mForceUpdateSnapshot = TRUE;
 	}
 }
 
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 600ebf59145..050b88413d3 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -116,6 +116,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param
 	mThumbnailUpdateLock = FALSE ;
 	mThumbnailUpToDate   = FALSE ;
 	mBigThumbnailUpToDate = FALSE ;
+
+	mForceUpdateSnapshot = FALSE;
 }
 
 LLSnapshotLivePreview::~LLSnapshotLivePreview()
@@ -671,18 +673,19 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
 	// If we're in freeze-frame mode and camera has moved, update snapshot.
 	LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin();
 	LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion();
-	if (gSavedSettings.getBOOL("FreezeTime") && previewp->mAllowFullScreenPreview &&
-		(new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f))
+	if (previewp->mForceUpdateSnapshot || (gSavedSettings.getBOOL("FreezeTime") && previewp->mAllowFullScreenPreview &&
+		(new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f)))
 	{
 		previewp->mCameraPos = new_camera_pos;
 		previewp->mCameraRot = new_camera_rot;
 		// request a new snapshot whenever the camera moves, with a time delay
-		BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot");
+		BOOL new_snapshot = gSavedSettings.getBOOL("AutoSnapshot") || previewp->mForceUpdateSnapshot;
 		LL_DEBUGS() << "camera moved, updating thumbnail" << LL_ENDL;
 		previewp->updateSnapshot(
-			autosnap, // whether a new snapshot is needed or merely invalidate the existing one
+			new_snapshot, // whether a new snapshot is needed or merely invalidate the existing one
 			FALSE, // or if 1st arg is false, whether to produce a new thumbnail image.
-			autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); // shutter delay if 1st arg is true.
+			new_snapshot ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); // shutter delay if 1st arg is true.
+		previewp->mForceUpdateSnapshot = FALSE;
 	}
 
 	// see if it's time yet to snap the shot and bomb out otherwise.
diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h
index e1937187a3d..fed33bf37c2 100644
--- a/indra/newview/llsnapshotlivepreview.h
+++ b/indra/newview/llsnapshotlivepreview.h
@@ -182,6 +182,7 @@ class LLSnapshotLivePreview : public LLView
 public:
 	static std::set<LLSnapshotLivePreview*> sList;
 	BOOL                        mKeepAspectRatio ;
+	BOOL						mForceUpdateSnapshot;
 };
 
 #endif // LL_LLSNAPSHOTLIVEPREVIEW_H
-- 
GitLab