From 03da2bc1a1c7674514c967b0e7408258dba25d77 Mon Sep 17 00:00:00 2001
From: Rider Linden <rider@lindenlab.com>
Date: Wed, 2 May 2018 17:07:06 -0700
Subject: [PATCH] Fixed sky editing floater.

---
 indra/llinventory/llsettingssky.h             |  20 +
 indra/newview/CMakeLists.txt                  |   2 +
 indra/newview/llfloaterfixedenvironment.cpp   |  91 ++++
 indra/newview/llfloaterfixedenvironment.h     |  22 +
 indra/newview/llpaneleditsky.cpp              | 388 ++++++++++++++++++
 indra/newview/llpaneleditsky.h                | 124 ++++++
 indra/newview/llviewerfloaterreg.cpp          |   1 +
 indra/newview/llviewermenu.cpp                |  10 +-
 .../xui/en/floater_fixedenvironment.xml       |   7 +-
 .../xui/en/panel_settings_sky_atmos.xml       | 240 +++++++++++
 .../xui/en/panel_settings_sky_clouds.xml      | 255 ++++++++++++
 .../xui/en/panel_settings_sky_sunmoon.xml     | 234 +++++++++++
 12 files changed, 1386 insertions(+), 8 deletions(-)
 create mode 100644 indra/newview/llpaneleditsky.cpp
 create mode 100644 indra/newview/llpaneleditsky.h
 create mode 100644 indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
 create mode 100644 indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml
 create mode 100644 indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml

diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index d08e2bbd03c..14511627441 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -189,6 +189,11 @@ class LLSettingsSky: public LLSettingsBase
         return mSettings[SETTING_CLOUD_TEXTUREID].asUUID();
     }
 
+    void setCloudNoiseTextureId(const LLUUID &id)
+    {
+        setValue(SETTING_CLOUD_TEXTUREID, id);
+    }
+
     LLColor3 getCloudPosDensity1() const
     {
         return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]);
@@ -300,6 +305,11 @@ class LLSettingsSky: public LLSettingsBase
         return mSettings[SETTING_MAX_Y].asReal();
     }
 
+    void setMaxY(F32 val) 
+    {
+        setValue(SETTING_MAX_Y, val);
+    }
+
     LLQuaternion getMoonRotation() const
     {
         return LLQuaternion(mSettings[SETTING_MOON_ROTATION]);
@@ -324,6 +334,11 @@ class LLSettingsSky: public LLSettingsBase
         return mSettings[SETTING_MOON_TEXTUREID].asUUID();
     }
 
+    void setMoonTextureId(LLUUID id)
+    {
+        setValue(SETTING_MOON_TEXTUREID, id);
+    }
+
     F32 getStarBrightness() const
     {
         return mSettings[SETTING_STAR_BRIGHTNESS].asReal();
@@ -368,6 +383,11 @@ class LLSettingsSky: public LLSettingsBase
         return mSettings[SETTING_SUN_TEXTUREID].asUUID();
     }
 
+    void setSunTextureId(LLUUID id) 
+    {
+        setValue(SETTING_SUN_TEXTUREID, id);
+    }
+
     // Internal/calculated settings
     LLVector3 getLightDirection() const
     {
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 109001f82ec..654487b8fb5 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -421,6 +421,7 @@ set(viewer_SOURCE_FILES
     llpanelblockedlist.cpp
     llpanelclassified.cpp
     llpanelcontents.cpp
+    llpaneleditsky.cpp
     llpaneleditwater.cpp
     llpaneleditwearable.cpp
     llpanelenvironment.cpp
@@ -1031,6 +1032,7 @@ set(viewer_HEADER_FILES
     llpanelblockedlist.h
     llpanelclassified.h
     llpanelcontents.h
+    llpaneleditsky.h
     llpaneleditwater.h
     llpaneleditwearable.h
     llpanelenvironment.h
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 6c883b25349..ec8e2c8965a 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -40,6 +40,7 @@
 
 // newview
 #include "llpaneleditwater.h"
+#include "llpaneleditsky.h"
 
 #include "llsettingssky.h"
 #include "llsettingswater.h"
@@ -246,6 +247,96 @@ void LLFloaterFixedEnvironmentWater::doApplyFixedSettings()
 
 }
 
+//=========================================================================
+LLFloaterFixedEnvironmentSky::LLFloaterFixedEnvironmentSky(const LLSD &key) :
+    LLFloaterFixedEnvironment(key)
+{}
+
+BOOL LLFloaterFixedEnvironmentSky::postBuild()
+{
+    if (!LLFloaterFixedEnvironment::postBuild())
+        return FALSE;
+
+    LLPanelSettingsSky * panel;
+    panel = new LLPanelSettingsSkyAtmosTab;
+    panel->buildFromFile("panel_settings_sky_atmos.xml");
+    panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings));
+    mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true));
+
+    panel = new LLPanelSettingsSkyCloudTab;
+    panel->buildFromFile("panel_settings_sky_clouds.xml");
+    panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings));
+    mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false));
+
+    panel = new LLPanelSettingsSkySunMoonTab;
+    panel->buildFromFile("panel_settings_sky_sunmoon.xml");
+    panel->setSky(std::static_pointer_cast<LLSettingsSky>(mSettings));
+    mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false));
+
+    return TRUE;
+}
+
+void LLFloaterFixedEnvironmentSky::updateEditEnvironment(void)
+{
+    LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, 
+        std::static_pointer_cast<LLSettingsSky>(mSettings));
+}
+
+void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key)
+{
+    if (!mSettings)
+    {
+        // Initialize the settings, take a snapshot of the current water. 
+        mSettings = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_CURRENT)->buildClone();
+        mSettings->setName("Snapshot sky (new)");
+
+        // TODO: Should we grab sky and keep it around for reference?
+    }
+
+    updateEditEnvironment();
+    syncronizeTabs();
+    refresh();
+    LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST);
+}
+
+void LLFloaterFixedEnvironmentSky::onClose(bool app_quitting)
+{
+    mSettings.reset();
+    syncronizeTabs();
+}
+
+void LLFloaterFixedEnvironmentSky::doLoadFromInventory()
+{
+
+}
+
+void LLFloaterFixedEnvironmentSky::doImportFromDisk()
+{   // Load a a legacy Windlight XML from disk.
+
+    LLFilePicker& picker = LLFilePicker::instance();
+    if (picker.getOpenFile(LLFilePicker::FFLOAD_XML))
+    {
+        std::string filename = picker.getFirstFile();
+
+        LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL;
+        LLSettingsSky::ptr_t legacysky = LLEnvironment::createSkyFromLegacyPreset(filename);
+
+        if (!legacysky)
+        {   // *TODO* Put up error dialog here.  Could not create water from filename
+            return;
+        }
+
+        LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacysky);
+        this->setEditSettings(legacysky);
+        LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST, true);
+    }
+}
+
+void LLFloaterFixedEnvironmentSky::doApplyFixedSettings() 
+{
+    LLSettingsVOBase::createInventoryItem(mSettings);
+}
+
 //=========================================================================
 
 #if 0
diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h
index be1ba4a58b9..590be081699 100644
--- a/indra/newview/llfloaterfixedenvironment.h
+++ b/indra/newview/llfloaterfixedenvironment.h
@@ -171,6 +171,28 @@ class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment
 private:
 };
 
+class LLFloaterFixedEnvironmentSky : public LLFloaterFixedEnvironment
+{
+    LOG_CLASS(LLFloaterFixedEnvironmentSky);
+
+public:
+    LLFloaterFixedEnvironmentSky(const LLSD &key);
+
+    BOOL	                postBuild()                 override;
+
+    virtual void            onOpen(const LLSD& key)     override;
+    virtual void            onClose(bool app_quitting)  override;
+
+protected:
+    virtual void            updateEditEnvironment()     override;
+
+    virtual void            doLoadFromInventory()       override;
+    virtual void            doImportFromDisk()          override;
+    virtual void            doApplyFixedSettings()      override;
+
+private:
+};
+
 class LLSettingsEditPanel : public LLPanel
 {
 public:
diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp
new file mode 100644
index 00000000000..e10af29e825
--- /dev/null
+++ b/indra/newview/llpaneleditsky.cpp
@@ -0,0 +1,388 @@
+/**
+* @file llpaneleditsky.cpp
+* @brief Floaters to create and edit fixed settings for sky and water.
+*
+* $LicenseInfo:firstyear=2011&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2011, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* $/LicenseInfo$
+*/
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llpaneleditsky.h"
+
+#include "llslider.h"
+#include "lltexturectrl.h"
+#include "llcolorswatch.h"
+#include "lljoystickbutton.h"
+
+namespace
+{   
+    // Atmosphere Tab
+    const std::string   FIELD_SKY_AMBIENT_LIGHT("ambient_light");
+    const std::string   FIELD_SKY_BLUE_HORIZON("blue_horizon");
+    const std::string   FIELD_SKY_BLUE_DENSITY("blue_density");
+    const std::string   FIELD_SKY_HAZE_HORIZON("haze_horizon");
+    const std::string   FIELD_SKY_HAZE_DENSITY("haze_density");
+    const std::string   FIELD_SKY_SCENE_GAMMA("scene_gamma");
+    const std::string   FIELD_SKY_DENSITY_MULTIP("density_multip");
+    const std::string   FIELD_SKY_DISTANCE_MULTIP("distance_multip");
+    const std::string   FIELD_SKY_MAX_ALT("max_alt");
+
+    const std::string   FIELD_SKY_CLOUD_COLOR("cloud_color");
+    const std::string   FIELD_SKY_CLOUD_COVERAGE("cloud_coverage");
+    const std::string   FIELD_SKY_CLOUD_SCALE("cloud_scale");
+    const std::string   FIELD_SKY_CLOUD_SCROLL_X("cloud_scroll_x");
+    const std::string   FIELD_SKY_CLOUD_SCROLL_Y("cloud_scroll_y");
+    const std::string   FIELD_SKY_CLOUD_MAP("cloud_map");
+    const std::string   FIELD_SKY_CLOUD_DENSITY_X("cloud_density_x");
+    const std::string   FIELD_SKY_CLOUD_DENSITY_Y("cloud_density_y");
+    const std::string   FIELD_SKY_CLOUD_DENSITY_D("cloud_density_d");
+    const std::string   FIELD_SKY_CLOUD_DETAIL_X("cloud_detail_x");
+    const std::string   FIELD_SKY_CLOUD_DETAIL_Y("cloud_detail_y");
+    const std::string   FIELD_SKY_CLOUD_DETAIL_D("cloud_detail_d");
+
+    const std::string   FIELD_SKY_SUN_MOON_COLOR("sun_moon_color");
+    const std::string   FIELD_SKY_GLOW_FOCUS("glow_focus");
+    const std::string   FIELD_SKY_GLOW_SIZE("glow_size");
+    const std::string   FIELD_SKY_STAR_BRIGHTNESS("star_brightness");
+    const std::string   FIELD_SKY_SUN_ROTATION("sun_rotation");
+    const std::string   FIELD_SKY_SUN_IMAGE("sun_image");
+    const std::string   FIELD_SKY_MOON_ROTATION("moon_rotation");
+    const std::string   FIELD_SKY_MOON_IMAGE("moon_image");
+
+    const F32 SLIDER_SCALE_SUN_AMBIENT(3.0f);
+    const F32 SLIDER_SCALE_BLUE_HORIZON_DENSITY(2.0f);
+    const F32 SLIDER_SCALE_GLOW_R(20.0f);
+    const F32 SLIDER_SCALE_GLOW_B(-5.0f);
+}
+
+//==========================================================================
+LLPanelSettingsSky::LLPanelSettingsSky() :
+    LLSettingsEditPanel(),
+    mSkySettings()
+{
+
+}
+
+
+//==========================================================================
+LLPanelSettingsSkyAtmosTab::LLPanelSettingsSkyAtmosTab() :
+    LLPanelSettingsSky()
+{
+}
+
+
+BOOL LLPanelSettingsSkyAtmosTab::postBuild()
+{
+    getChild<LLUICtrl>(FIELD_SKY_AMBIENT_LIGHT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAmbientLightChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_BLUE_HORIZON)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onBlueHorizonChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_BLUE_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onBlueDensityChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_HAZE_HORIZON)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onHazeHorizonChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_HAZE_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onHazeDensityChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSceneGammaChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MULTIP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onDensityMultipChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_DISTANCE_MULTIP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onDistanceMultipChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_MAX_ALT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMaxAltChanged(); });
+
+    refresh();
+
+    return TRUE;
+}
+
+void LLPanelSettingsSkyAtmosTab::refresh()
+{
+    if (!mSkySettings)
+    {
+        setAllChildrenEnabled(FALSE);
+        setEnabled(FALSE);
+        return;
+    }
+
+    setEnabled(TRUE);
+    setAllChildrenEnabled(TRUE);
+
+    getChild<LLColorSwatchCtrl>(FIELD_SKY_AMBIENT_LIGHT)->set(mSkySettings->getAmbientColor() / SLIDER_SCALE_SUN_AMBIENT);
+    getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_HORIZON)->set(mSkySettings->getBlueHorizon() / SLIDER_SCALE_BLUE_HORIZON_DENSITY);
+    getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_DENSITY)->set(mSkySettings->getBlueDensity() / SLIDER_SCALE_BLUE_HORIZON_DENSITY);
+
+    getChild<LLUICtrl>(FIELD_SKY_HAZE_HORIZON)->setValue(mSkySettings->getHazeHorizon());
+    getChild<LLUICtrl>(FIELD_SKY_HAZE_DENSITY)->setValue(mSkySettings->getHazeDensity());
+    getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->setValue(mSkySettings->getGamma());
+    getChild<LLUICtrl>(FIELD_SKY_DENSITY_MULTIP)->setValue(mSkySettings->getDensityMultiplier());
+    getChild<LLUICtrl>(FIELD_SKY_DISTANCE_MULTIP)->setValue(mSkySettings->getDistanceMultiplier());
+    getChild<LLUICtrl>(FIELD_SKY_MAX_ALT)->setValue(mSkySettings->getMaxY());
+
+}
+
+//-------------------------------------------------------------------------
+void LLPanelSettingsSkyAtmosTab::onAmbientLightChanged()
+{
+    mSkySettings->setAmbientColor(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_AMBIENT_LIGHT)->get() * SLIDER_SCALE_SUN_AMBIENT));
+}
+
+void LLPanelSettingsSkyAtmosTab::onBlueHorizonChanged()
+{
+    mSkySettings->setBlueHorizon(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_HORIZON)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY));
+}
+
+void LLPanelSettingsSkyAtmosTab::onBlueDensityChanged()
+{
+    mSkySettings->setBlueDensity(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_DENSITY)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY));
+}
+
+void LLPanelSettingsSkyAtmosTab::onHazeHorizonChanged()
+{
+    mSkySettings->setHazeHorizon(getChild<LLUICtrl>(FIELD_SKY_HAZE_HORIZON)->getValue().asReal());
+}
+
+void LLPanelSettingsSkyAtmosTab::onHazeDensityChanged()
+{
+    mSkySettings->setHazeDensity(getChild<LLUICtrl>(FIELD_SKY_HAZE_DENSITY)->getValue().asReal());
+}
+
+void LLPanelSettingsSkyAtmosTab::onSceneGammaChanged()
+{
+    mSkySettings->setGamma(getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->getValue().asReal());
+}
+
+void LLPanelSettingsSkyAtmosTab::onDensityMultipChanged()
+{
+    mSkySettings->setDensityMultiplier(getChild<LLUICtrl>(FIELD_SKY_DENSITY_MULTIP)->getValue().asReal());
+}
+
+void LLPanelSettingsSkyAtmosTab::onDistanceMultipChanged()
+{
+    mSkySettings->setDistanceMultiplier(getChild<LLUICtrl>(FIELD_SKY_DISTANCE_MULTIP)->getValue().asReal());
+}
+
+void LLPanelSettingsSkyAtmosTab::onMaxAltChanged()
+{
+    mSkySettings->setMaxY(getChild<LLUICtrl>(FIELD_SKY_MAX_ALT)->getValue().asReal());
+}
+
+//==========================================================================
+LLPanelSettingsSkyCloudTab::LLPanelSettingsSkyCloudTab() :
+    LLPanelSettingsSky()
+{
+}
+
+
+BOOL LLPanelSettingsSkyCloudTab::postBuild()
+{
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_COLOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudColorChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_COVERAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudCoverageChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudScaleChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudScrollChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudScrollChanged(); });
+    getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudMapChanged(); });
+//    getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setDefaultImageAssetID(LLSettingsSky::DEFAULT_CLOUD_TEXTURE_ID);
+
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_D)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDetailChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDetailChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_D)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDetailChanged(); });
+
+    refresh();
+
+    return TRUE;
+}
+
+void LLPanelSettingsSkyCloudTab::refresh()
+{
+    if (!mSkySettings)
+    {
+        setAllChildrenEnabled(FALSE);
+        setEnabled(FALSE);
+        return;
+    }
+
+    setEnabled(TRUE);
+    setAllChildrenEnabled(TRUE);
+
+    getChild<LLColorSwatchCtrl>(FIELD_SKY_CLOUD_COLOR)->set(mSkySettings->getCloudColor());
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_COVERAGE)->setValue(mSkySettings->getCloudShadow());
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCALE)->setValue(mSkySettings->getCloudScale());
+
+    LLVector2 cloudScroll(mSkySettings->getCloudScrollRate());
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_X)->setValue(cloudScroll[0]);
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_Y)->setValue(cloudScroll[1]);
+
+    getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setValue(mSkySettings->getCloudNoiseTextureId());
+
+    LLVector3 cloudDensity(mSkySettings->getCloudPosDensity1().getValue());
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->setValue(cloudDensity[0]);
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->setValue(cloudDensity[1]);
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_D)->setValue(cloudDensity[2]);
+
+    LLVector3 cloudDetail(mSkySettings->getCloudPosDensity1().getValue());
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_X)->setValue(cloudDetail[0]);
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_Y)->setValue(cloudDetail[1]);
+    getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_D)->setValue(cloudDetail[2]);
+}
+
+//-------------------------------------------------------------------------
+void LLPanelSettingsSkyCloudTab::onCloudColorChanged()
+{
+    mSkySettings->setCloudColor(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_CLOUD_COLOR)->get()));
+}
+
+void LLPanelSettingsSkyCloudTab::onCloudCoverageChanged()
+{
+    mSkySettings->setCloudShadow(getChild<LLUICtrl>(FIELD_SKY_CLOUD_COVERAGE)->getValue().asReal());
+}
+
+void LLPanelSettingsSkyCloudTab::onCloudScaleChanged()
+{
+    mSkySettings->setCloudScale(getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCALE)->getValue().asReal());
+}
+
+void LLPanelSettingsSkyCloudTab::onCloudScrollChanged()
+{
+    LLVector2 scroll(getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_X)->getValue().asReal(), 
+        getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCROLL_Y)->getValue().asReal());
+
+    mSkySettings->setCloudScrollRate(scroll);
+}
+
+void LLPanelSettingsSkyCloudTab::onCloudMapChanged()
+{
+    mSkySettings->setCloudNoiseTextureId(getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->getValue().asUUID());
+}
+
+void LLPanelSettingsSkyCloudTab::onCloudDensityChanged()
+{
+    LLColor3 density(getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_X)->getValue().asReal(), 
+        getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_Y)->getValue().asReal(), 
+        getChild<LLUICtrl>(FIELD_SKY_CLOUD_DENSITY_D)->getValue().asReal());
+
+    mSkySettings->setCloudPosDensity1(density);
+}
+
+void LLPanelSettingsSkyCloudTab::onCloudDetailChanged()
+{
+    LLColor3 detail(getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_X)->getValue().asReal(),
+        getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_Y)->getValue().asReal(),
+        getChild<LLUICtrl>(FIELD_SKY_CLOUD_DETAIL_D)->getValue().asReal());
+
+    mSkySettings->setCloudPosDensity2(detail);
+}
+
+//==========================================================================
+LLPanelSettingsSkySunMoonTab::LLPanelSettingsSkySunMoonTab() :
+    LLPanelSettingsSky()
+{
+}
+
+
+BOOL LLPanelSettingsSkySunMoonTab::postBuild()
+{
+    getChild<LLUICtrl>(FIELD_SKY_SUN_MOON_COLOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunMoonColorChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onGlowChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onGlowChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onStarBrightnessChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_SUN_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunRotationChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_SUN_IMAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunImageChanged(); });
+//    getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setDefaultImageAssetID(LLSettingsSky:: );
+    getChild<LLUICtrl>(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); });
+    getChild<LLUICtrl>(FIELD_SKY_MOON_IMAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonImageChanged(); });
+//    getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setDefaultImageAssetID(LLSettingsSky:: );
+
+    refresh();
+
+    return TRUE;
+}
+
+void LLPanelSettingsSkySunMoonTab::refresh()
+{
+    if (!mSkySettings)
+    {
+        setAllChildrenEnabled(FALSE);
+        setEnabled(FALSE);
+        return;
+    }
+
+    setEnabled(TRUE);
+    setAllChildrenEnabled(TRUE);
+
+    getChild<LLColorSwatchCtrl>(FIELD_SKY_SUN_MOON_COLOR)->set(mSkySettings->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT);
+
+    LLColor3 glow(mSkySettings->getGlow());
+
+    glow.mV[0] = 2 - (glow.mV[0] / SLIDER_SCALE_GLOW_R);
+    glow.mV[2] /= SLIDER_SCALE_GLOW_B;
+
+    getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setValue(glow.mV[0]);
+    getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setValue(glow.mV[2]);
+
+    getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setValue(mSkySettings->getStarBrightness());
+    getChild<LLJoystickQuaternion>(FIELD_SKY_SUN_ROTATION)->setRotation(mSkySettings->getSunRotation());
+    getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setValue(mSkySettings->getSunTextureId());
+    getChild<LLJoystickQuaternion>(FIELD_SKY_MOON_ROTATION)->setRotation(mSkySettings->getMoonRotation());
+    getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setValue(mSkySettings->getMoonTextureId());
+}
+
+//-------------------------------------------------------------------------
+void LLPanelSettingsSkySunMoonTab::onSunMoonColorChanged()
+{
+    LLColor3 color(getChild<LLColorSwatchCtrl>(FIELD_SKY_SUN_MOON_COLOR)->get());
+
+    color *= SLIDER_SCALE_SUN_AMBIENT;
+
+    mSkySettings->setSunlightColor(color);
+}
+
+void LLPanelSettingsSkySunMoonTab::onGlowChanged()
+{
+    LLColor3 glow(getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->getValue().asReal(), 0.0f, 
+        getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->getValue().asReal());
+
+    glow.mV[0] = (2 - glow.mV[0]) * SLIDER_SCALE_GLOW_R; 
+    glow.mV[2] *= SLIDER_SCALE_GLOW_B;
+
+    mSkySettings->setGlow(glow);
+}
+
+void LLPanelSettingsSkySunMoonTab::onStarBrightnessChanged()
+{
+    mSkySettings->setStarBrightness(getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->getValue().asReal());
+}
+
+void LLPanelSettingsSkySunMoonTab::onSunRotationChanged()
+{
+    mSkySettings->setSunRotation(getChild<LLJoystickQuaternion>(FIELD_SKY_SUN_ROTATION)->getRotation());
+}
+
+void LLPanelSettingsSkySunMoonTab::onSunImageChanged()
+{
+    mSkySettings->setSunTextureId(getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->getValue().asUUID());
+}
+
+void LLPanelSettingsSkySunMoonTab::onMoonRotationChanged()
+{
+    mSkySettings->setMoonRotation(getChild<LLJoystickQuaternion>(FIELD_SKY_MOON_ROTATION)->getRotation());
+}
+
+void LLPanelSettingsSkySunMoonTab::onMoonImageChanged()
+{
+    mSkySettings->setMoonTextureId(getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->getValue().asUUID());
+}
diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h
new file mode 100644
index 00000000000..497c98af1f5
--- /dev/null
+++ b/indra/newview/llpaneleditsky.h
@@ -0,0 +1,124 @@
+/**
+* @file llpaneleditsky.h
+* @brief Panels for sky settings
+*
+* $LicenseInfo:firstyear=2011&license=viewerlgpl$
+* Second Life Viewer Source Code
+* Copyright (C) 2011, Linden Research, Inc.
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation;
+* version 2.1 of the License only.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*
+* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+* $/LicenseInfo$
+*/
+
+#ifndef LLPANEL_EDIT_SKY_H
+#define LLPANEL_EDIT_SKY_H
+
+#include "llpanel.h"
+#include "llsettingssky.h"
+
+#include "llfloaterfixedenvironment.h"
+
+//=========================================================================
+class LLSlider;
+class LLColorSwatchCtrl;
+class LLTextureCtrl;
+
+//=========================================================================
+class LLPanelSettingsSky : public LLSettingsEditPanel
+{
+    LOG_CLASS(LLPanelSettingsSky);
+
+public:
+                            LLPanelSettingsSky();
+
+    virtual void            setSettings(LLSettingsBase::ptr_t &settings) override   { setSky(std::static_pointer_cast<LLSettingsSky>(settings)); }
+
+    LLSettingsSky::ptr_t    getSky() const                                          { return mSkySettings; }
+    void                    setSky(const LLSettingsSky::ptr_t &sky)                 { mSkySettings = sky; refresh(); }
+
+protected:
+    LLSettingsSky::ptr_t  mSkySettings;
+};
+
+class LLPanelSettingsSkyAtmosTab : public LLPanelSettingsSky
+{
+    LOG_CLASS(LLPanelSettingsSkyAtmosTab);
+
+public:
+                            LLPanelSettingsSkyAtmosTab();
+
+    virtual BOOL	        postBuild() override;
+
+protected:
+    virtual void            refresh() override;
+
+private:
+    void                    onAmbientLightChanged();
+    void                    onBlueHorizonChanged();
+    void                    onBlueDensityChanged();
+    void                    onHazeHorizonChanged();
+    void                    onHazeDensityChanged();
+    void                    onSceneGammaChanged();
+    void                    onDensityMultipChanged();
+    void                    onDistanceMultipChanged();
+    void                    onMaxAltChanged();
+};
+
+class LLPanelSettingsSkyCloudTab : public LLPanelSettingsSky
+{
+    LOG_CLASS(LLPanelSettingsSkyCloudTab);
+
+public:
+                            LLPanelSettingsSkyCloudTab();
+
+    virtual BOOL	        postBuild() override;
+
+protected:
+    virtual void            refresh() override;
+
+private:
+    void                    onCloudColorChanged();
+    void                    onCloudCoverageChanged();
+    void                    onCloudScaleChanged();
+    void                    onCloudScrollChanged();
+    void                    onCloudMapChanged();
+    void                    onCloudDensityChanged();
+    void                    onCloudDetailChanged();
+};
+
+class LLPanelSettingsSkySunMoonTab : public LLPanelSettingsSky
+{
+    LOG_CLASS(LLPanelSettingsSkySunMoonTab);
+
+public:
+                            LLPanelSettingsSkySunMoonTab();
+
+    virtual BOOL	        postBuild() override;
+
+protected:
+    virtual void            refresh() override;
+
+private:
+    void                    onSunMoonColorChanged();
+    void                    onGlowChanged();
+    void                    onStarBrightnessChanged();
+    void                    onSunRotationChanged();
+    void                    onSunImageChanged();
+    void                    onMoonRotationChanged();
+    void                    onMoonImageChanged();
+};
+#endif // LLPANEL_EDIT_SKY_H
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 1af6ecb8b65..7e0a3a5fd8b 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -228,6 +228,7 @@ void LLViewerFloaterReg::registerFloaters()
 	LLFloaterReg::add("env_edit_day_cycle", "floater_edit_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditDayCycle>);
 
     LLFloaterReg::add("env_fixed_environmentent_water", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentWater>);
+    LLFloaterReg::add("env_fixed_environmentent_sky", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironmentSky>);
     //LLFloaterReg::add("env_fixed_environmentent", "floater_fixedenvironment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFixedEnvironment>);
 
     LLFloaterReg::add("env_edit_extdaycycle", "floater_edit_ext_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditExtDayCycle>);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 9f258909179..6bc28ad2843 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8476,22 +8476,20 @@ class LLWorldEnvPreset : public view_listener_t
 
 		if (item == "new_water")
 		{
-			//LLFloaterReg::showInstance("env_edit_water", "new");
             LLFloaterReg::showInstance("env_fixed_environmentent_water", "new");
 		}
 		else if (item == "edit_water")
 		{
-			//LLFloaterReg::showInstance("env_edit_water", "edit");
             LLFloaterReg::showInstance("env_fixed_environmentent_water", "edit");
         }
 		else if (item == "new_sky")
 		{
-			LLFloaterReg::showInstance("env_edit_sky", "new");
-		}
+            LLFloaterReg::showInstance("env_fixed_environmentent_sky", "new");
+        }
 		else if (item == "edit_sky")
 		{
-			LLFloaterReg::showInstance("env_edit_sky", "edit");
-		}
+            LLFloaterReg::showInstance("env_fixed_environmentent_sky", "edit");
+        }
 		else if (item == "new_day_cycle")
 		{
 			LLFloaterReg::showInstance("env_edit_day_cycle", "new");
diff --git a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
index 03bbc05dadf..2590bb34105 100644
--- a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
+++ b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
@@ -26,7 +26,6 @@
         <layout_panel name="info_panel"
                 auto_resize="false"
                 user_resize="false"
-                bg_alpha_color="blue"
                 min_height="60">
             <text
                     follows="left|top"
@@ -81,7 +80,11 @@
                     tab_position="top"
                     tab_width="120"
                     tab_padding_right="3">
-                <!-- move to own file -->
+                <!-- Tabs inserted here in code -->
+                <!-- -->
+                <!-- -->
+                
+                <!-- -->
             </tab_container>
         </layout_panel>
         <layout_panel name="button_panel"
diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
new file mode 100644
index 00000000000..643994b6b1a
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+        border="true"
+        follows="all"
+        label="Atmosphere &amp; Lighting"
+        layout="topleft"
+        left="0"
+        name="panel_settings_sky_atmos"
+        top="0">
+    <layout_stack 
+            left="5"
+            top="5"
+            right="-5"
+            bottom="-5"
+            follows="left|top|right|bottom"
+            orientation="vertical">
+        <layout_panel
+                border="true"
+                bevel_style="in"
+                auto_resize="false"
+                user_resize="false"
+                visible="true"
+                height="75">
+
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="15"
+                    top_pad="15"
+                    width="80">
+                Ambient Color:
+            </text>
+            <color_swatch
+                    can_apply_immediately="true"
+                    follows="left|top"
+                    height="37"
+                    label_height="0"
+                    layout="topleft"
+                    left_delta="0"
+                    name="ambient_light"
+                    top_pad="5"
+                    width="60" />
+            <text
+                    follows="left"
+                    height="10"
+                    layout="topleft"
+                    left_delta="90"
+                    top_delta="-15"
+                    width="80">
+                Blue Horizon:
+            </text>
+            <color_swatch
+                    can_apply_immediately="true"
+                    follows="left|top"
+                    height="37"
+                    label_height="0"
+                    layout="topleft"
+                    left_delta="0"
+                    name="blue_horizon"
+                    top_pad="5"
+                    width="60" />
+            <text
+                    follows="left"
+                    height="10"
+                    layout="topleft"
+                    left_delta="90"
+                    top_delta="-15"
+                    width="80">
+                Blue Density:
+            </text>
+            <color_swatch
+                    can_apply_immediately="true"
+                    follows="left|top"
+                    height="37"
+                    label_height="0"
+                    layout="topleft"
+                    left_delta="0"
+                    name="blue_density"
+                    top_pad="5"
+                    width="60" />
+        </layout_panel>
+        <layout_panel
+                border="true"
+                bevel_style="in"
+                auto_resize="true"
+                user_resize="true"
+                visible="true">
+            <layout_stack name="atmosphere1"
+                    left="5"
+                    top="5"
+                    right="-5"
+                    bottom="-5"
+                    follows="left|top|right|bottom"
+                    orientation="hoizontal">
+                <layout_panel
+                        border="false"
+                        bevel_style="in"
+                        auto_resize="true"
+                        user_resize="true"
+                        visible="true"
+                        min_width="225">
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="15"
+                            top_pad="15"
+                            width="80">
+                        Haze Horizon:
+                    </text>
+                    <slider
+                            decimal_digits="2"
+                            follows="left|top"
+                            height="10"
+                            initial_value="0"
+                            layout="topleft"
+                            left_delta="5"
+                            min_val="0"
+                            max_val="1"
+                            name="haze_horizon"
+                            top_delta="20"
+                            width="200"/>
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="-5"
+                            top_delta="25"
+                            width="80">
+                        Haze Density:
+                    </text>
+                    <slider
+                            decimal_digits="2"
+                            follows="left|top"
+                            height="10"
+                            initial_value="0"
+                            layout="topleft"
+                            left_delta="5"
+                            min_val="0"
+                            max_val="1"
+                            name="haze_density"
+                            top_delta="20"
+                            width="200"/>
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="-5"
+                            top_delta="25"
+                            width="80">
+                        Scene Gamma:
+                    </text>
+                    <slider
+                            decimal_digits="2"
+                            follows="left|top"
+                            height="10"
+                            initial_value="0"
+                            layout="topleft"
+                            left_delta="5"
+                            max_val="10"
+                            name="scene_gamma"
+                            top_delta="20"
+                            width="207"/>
+                </layout_panel>            
+                <layout_panel
+                        border="false"
+                        bevel_style="in"
+                        auto_resize="true"
+                        user_resize="true"
+                        visible="true"
+                        min_width="225">
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="15"
+                            top_pad="15"
+                            width="200">
+                        Density Multiplier:
+                    </text>
+                    <slider
+                            decimal_digits="2"
+                            follows="left|top"
+                            height="10"
+                            initial_value="0"
+                            layout="topleft"
+                            left_delta="5"
+                            min_val="0"
+                            max_val="0.9"
+                            name="density_multip"
+                            top_delta="20"
+                            width="200"/>
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="-5"
+                            top_delta="25"
+                            width="200">
+                        Distance Multiplier:
+                    </text>
+                    <slider
+                            decimal_digits="2"
+                            follows="left|top"
+                            height="10"
+                            initial_value="0"
+                            layout="topleft"
+                            left_delta="5"
+                            min_val="0"
+                            max_val="100"
+                            name="distance_multip"
+                            top_delta="20"
+                            width="214"/>
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="-5"
+                            top_delta="25"
+                            width="200">
+                        Maximum Altitude:
+                    </text>
+                    <slider
+                            decimal_digits="1"
+                            follows="left|top"
+                            height="10"
+                            initial_value="0"
+                            layout="topleft"
+                            left_delta="5"
+                            min_val="0"
+                            max_val="4000"
+                            name="max_alt"
+                            top_delta="20"
+                            width="214"/>
+                </layout_panel>            
+            </layout_stack>                
+        </layout_panel>
+    </layout_stack>
+</panel>
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml
new file mode 100644
index 00000000000..2a52f1a96e9
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml
@@ -0,0 +1,255 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+        border="true"
+        follows="all"
+        label="Clouds"
+        layout="topleft"
+        left="0"
+        help_topic="land_general_tab"
+        name="panel_settings_sky_clouds"
+        top="0">
+    <layout_stack 
+            left="5"
+            top="5"
+            right="-5"
+            bottom="-5"
+            follows="left|top|right|bottom"
+            orientation="hoizontal">
+        <layout_panel
+                border="true"
+                bevel_style="in"
+                auto_resize="true"
+                user_resize="true"
+                visible="true"
+                height="75">
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="15"
+                    top_pad="15"
+                    width="80">
+                Cloud Color:
+            </text>
+            <color_swatch
+                    can_apply_immediately="true"
+                    follows="left|top"
+                    height="37"
+                    label_height="0"
+                    layout="topleft"
+                    left_delta="0"
+                    name="cloud_color"
+                    top_pad="5"
+                    width="60" />
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="0"
+                    top_delta="47"
+                    width="200">
+                Cloud Coverage:
+            </text>
+            <slider
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="5"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_coverage"
+                    top_delta="20"
+                    width="214"/>
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="-5"
+                    top_delta="25"
+                    width="200">
+                Cloud Scale:
+            </text>
+            <slider
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="5"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_scale"
+                    top_delta="20"
+                    width="214"/>
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="-5"
+                    top_delta="25"
+                    width="200">
+                Cloud Scroll:
+            </text>
+            <panel
+                    follows="left|top"
+                    border="true"
+                    bg_alpha_color="red"
+                    background_visible="true"
+                    width="100"
+                    height="100"
+                    left_delta="5"
+                    top_delta="21">
+                <text>
+                    placeholder
+                </text>
+                <slider
+                        decimal_digits="1"
+                        follows="left|top"
+                        initial_value="0"
+                        layout="topleft"
+                        label="X:"
+                        left_delta="10"
+                        max_val="10"
+                        min_val="-10"
+                        name="cloud_scroll_x"
+                        top_pad="5"
+                        width="100"/>
+                <slider
+                        decimal_digits="1"
+                        follows="left|top"
+                        initial_value="0"
+                        layout="topleft"
+                        label="Y:"
+                        left_delta="0"
+                        max_val="10"
+                        min_val="-10"
+                        name="cloud_scroll_y"
+                        top_pad="5"
+                        orientation="vertical" 
+                        height="70"/>
+            </panel>
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="115"
+                    top_delta="-20"
+                    width="200">
+                Cloud Image:
+            </text>
+            <texture_picker
+                    height="100"
+                    layout="topleft"
+                    left_delta="5"
+                    name="cloud_map"
+                    top_pad="10"
+                    width="100"/>
+        </layout_panel>
+        <layout_panel
+                border="true"
+                bevel_style="in"
+                auto_resize="true"
+                user_resize="true"
+                visible="true"
+                height="75">
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="15"
+                    top_pad="15"
+                    width="200">
+                Cloud Density:
+            </text>
+            <slider
+                    label="X"
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="5"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_density_x"
+                    top_delta="20"
+                    width="200"/>
+            <slider
+                    label="Y"
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="0"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_density_y"
+                    top_delta="20"
+                    width="200"/>
+            <slider
+                    label="D"
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="0"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_density_d"
+                    top_delta="20"
+                    width="200"/>
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="-5"
+                    top_delta="35"
+                    width="200">
+                Cloud Detail:
+            </text>
+            <slider
+                    label="X"
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="5"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_detail_x"
+                    top_delta="20"
+                    width="200"/>
+            <slider
+                    label="Y"
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="0"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_detail_y"
+                    top_delta="20"
+                    width="200"/>
+            <slider
+                    label="D"
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="0"
+                    min_val="0"
+                    max_val="1"
+                    name="cloud_detail_d"
+                    top_delta="20"
+                    width="200"/>
+        </layout_panel>
+    </layout_stack>
+</panel>                
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml
new file mode 100644
index 00000000000..c0bd123fbcb
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+        border="true"
+        follows="all"
+        label="Sun &amp; Moon"
+        layout="topleft"
+        left="0"
+        name="panel_settings_sky_hbodies"
+        top="0">
+    <layout_stack 
+            left="5"
+            top="5"
+            right="-5"
+            bottom="-5"
+            follows="left|top|right|bottom"
+            orientation="hoizontal">
+        <layout_panel
+                border="true"
+                bevel_style="in"
+                auto_resize="true"
+                user_resize="true"
+                visible="true"
+                height="75">
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="15"
+                    top_pad="15"
+                    width="80">
+                Sun Color:
+            </text>
+            <color_swatch
+                    can_apply_immediately="true"
+                    follows="left|top"
+                    height="37"
+                    label_height="0"
+                    layout="topleft"
+                    left_delta="0"
+                    name="sun_moon_color"
+                    top_pad="5"
+                    width="60" />
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="0"
+                    top_delta="57"
+                    width="200">
+                Glow Focus:
+            </text>
+            <slider
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="5"
+                    min_val="0"
+                    max_val="0.5"
+                    name="glow_focus"
+                    top_delta="20"
+                    width="200"/>
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="-5"
+                    top_delta="20"
+                    width="200">
+                Glow Size:
+            </text>
+            <slider
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="5"
+                    min_val="1"
+                    max_val="1.99"
+                    name="glow_size"
+                    top_delta="20"
+                    width="200"/>
+            <text
+                    follows="left|top"
+                    height="10"
+                    layout="topleft"
+                    left_delta="-5"
+                    top_delta="30"
+                    width="200">
+                Star Brightness:
+            </text>
+            <slider
+                    decimal_digits="2"
+                    follows="left|top"
+                    height="10"
+                    initial_value="0"
+                    layout="topleft"
+                    left_delta="5"
+                    min_val="0"
+                    max_val="2"
+                    name="star_brightness"
+                    top_delta="20"
+                    width="200"/>
+        </layout_panel>
+        <layout_panel
+                border="false"
+                bevel_style="in"
+                auto_resize="true"
+                user_resize="true"
+                visible="true"
+                height="75">
+            <layout_stack 
+                    left="5"
+                    top="5"
+                    right="-5"
+                    bottom="-5"
+                    follows="left|top|right|bottom"
+                    orientation="vertical">
+                <layout_panel
+                        border="true"
+                        bevel_style="in"
+                        auto_resize="true"
+                        user_resize="true"
+                        visible="true"
+                        height="75">
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="15"
+                            top_pad="15"
+                            font="SansSerifBold"
+                            width="80">
+                        Sun
+                    </text>
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="10"
+                            top_delta="30"
+                            width="100">
+                        Position:
+                    </text>
+                    <joystick_quat
+                            follows="left|top"
+                            height="78"
+                            layout="topleft"
+                            left_delta="0"
+                            top_delta="20"
+                            name="sun_rotation"
+                            quadrant="left"
+                            sound_flags="3"
+                            visible="true"
+                            tool_tip="Move sun in sky"
+                            width="78" /> <!-- Should be 126x126 -->
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="100"
+                            top_delta="-20"
+                            width="200">
+                        Image:
+                    </text>
+                    <texture_picker
+                            height="100"
+                            layout="topleft"
+                            left_delta="5"
+                            name="sun_image"
+                            top_pad="10"
+                            width="100"/>
+                </layout_panel>
+                <layout_panel
+                        border="true"
+                        bevel_style="in"
+                        auto_resize="true"
+                        user_resize="true"
+                        visible="true"
+                        height="75">
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="15"
+                            top_pad="15"
+                            font="SansSerifBold"
+                            width="80">
+                        Moon
+                    </text>
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="10"
+                            top_delta="30"
+                            width="100">
+                        Position:
+                    </text>
+                    <joystick_quat
+                            follows="left|top"
+                            height="78"
+                            layout="topleft"
+                            left_delta="0"
+                            top_delta="20"
+                            name="moon_rotation"
+                            quadrant="left"
+                            sound_flags="3"
+                            visible="true"
+                            tool_tip="Move sun in sky"
+                            width="78" /> <!-- Should be 126x126 -->
+                    <text
+                            follows="left|top"
+                            height="10"
+                            layout="topleft"
+                            left_delta="100"
+                            top_delta="-20"
+                            width="200">
+                        Image:
+                    </text>
+                    <texture_picker
+                            height="100"
+                            layout="topleft"
+                            left_delta="5"
+                            name="moon_image"
+                            top_pad="10"
+                            width="100"/>
+                </layout_panel>
+            </layout_stack>
+        </layout_panel>
+    </layout_stack>
+</panel>                
-- 
GitLab