From 44cdf00bff2669004d0259637eddb6d461cc1a3b Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Wed, 17 Oct 2018 21:17:00 +0300
Subject: [PATCH] SL-1476 EEP parcel transition inconsistencies

---
 indra/newview/llenvironment.cpp | 48 ++++++++++++++++++++++++++++++---
 1 file changed, 45 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 1bc35b44bb8..5e7e9937cd6 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -888,9 +888,6 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS
         bool found_in_settings = psetting->mSettings.has(it.first);
         bool found_in_legacy_settings = !found_in_settings && psetting->mSettings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE].has(it.first);
 
-        if (!found_in_settings && !found_in_legacy_settings)
-            continue;
-
         if (found_in_settings)
         {
             value = psetting->mSettings[it.first];
@@ -899,6 +896,51 @@ void LLEnvironment::updateGLVariablesForSettings(LLGLSLShader *shader, const LLS
         {
             value = psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE][it.first];
         }
+        else if (psetting->getSettingsType() == "sky")
+        {
+            // Legacy atmospherics is a special case,
+            // these values either have non zero defaults when they are not present
+            // in LLSD or need to be acounted for (reset) even if they are not present
+            // Todo: consider better options, for example make LLSettingsSky init these options
+            // Todo: we should reset shaders for all missing fields, not just these ones
+            LLSettingsSky::ptr_t skyp = std::static_pointer_cast<LLSettingsSky>(psetting);
+            if (it.first == LLSettingsSky::SETTING_BLUE_DENSITY)
+            {
+                value = skyp->getBlueDensity().getValue();
+            }
+            else if (it.first == LLSettingsSky::SETTING_BLUE_HORIZON)
+            {
+                value = skyp->getBlueHorizon().getValue();
+            }
+            else if (it.first == LLSettingsSky::SETTING_DENSITY_MULTIPLIER)
+            {
+                value = skyp->getDensityMultiplier();
+            }
+            else if (it.first == LLSettingsSky::SETTING_DISTANCE_MULTIPLIER)
+            {
+                value = skyp->getDistanceMultiplier();
+            }
+            else if (it.first == LLSettingsSky::SETTING_HAZE_DENSITY)
+            {
+                value = skyp->getHazeDensity();
+            }
+            else if (it.first == LLSettingsSky::SETTING_HAZE_HORIZON)
+            {
+                value = skyp->getHazeHorizon();
+            }
+            else if (it.first == LLSettingsSky::SETTING_AMBIENT)
+            {
+                value = skyp->getAmbientColor().getValue();
+            }
+            else
+            {
+                continue;
+            }
+        }
+        else
+        {
+            continue;
+        }
 
         LLSD::Type setting_type = value.type();
         stop_glerror();
-- 
GitLab