From 199f82786e1a19af519afa4713d2cced44c640d8 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Tue, 9 Feb 2021 19:02:22 +0200
Subject: [PATCH] SL-14675 Position changes shouldn't cause additional blends
 when environment isn't ready

---
 indra/newview/llenvironment.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index d828bbf59ba..b6f120e6444 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -2380,6 +2380,15 @@ void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos)
         return;
 
     mCurrentTrack = trackno;
+
+    LLViewerRegion* cur_region = gAgent.getRegion();
+    if (!cur_region || !cur_region->capabilitiesReceived())
+    {
+        // Environment not ready, environment will be updated later, don't cause 'blend' yet.
+        // But keep mCurrentTrack updated in case we won't get new altitudes for some reason
+        return;
+    }
+
     for (S32 env = ENV_LOCAL; env < ENV_DEFAULT; ++env)
     {
         if (mEnvironments[env])
-- 
GitLab