diff options
Diffstat (limited to 'indra/newview/llfloatereditextdaycycle.cpp')
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 166d53fc74..4cab1160c0 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -62,6 +62,8 @@ #include "llenvironment.h" #include "lltrans.h" +extern LLControlGroup gSavedSettings; + //========================================================================= namespace { const std::string track_tabs[] = { @@ -197,9 +199,33 @@ BOOL LLFloaterEditExtDayCycle::postBuild() LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs"); S32 tab_count = tab_container->getTabCount(); + LLSettingsEditPanel *panel = nullptr; + + // Add or remove density tab as necessary + // Must be before operation on all tabs below + if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) + { + panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density")); + if (!panel) + { + panel = new LLPanelSettingsSkyDensityTab; + panel->buildFromFile("panel_settings_sky_density.xml"); + tab_container->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); + } + } + else + { + panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density")); + if (panel) + { + tab_container->removeTabPanel(panel); + } + delete panel; + } + for (S32 idx = 0; idx < tab_count; ++idx) { - LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx)); + panel = static_cast<LLSettingsEditPanel *>(tab_container->getPanelByIndex(idx)); if (panel) panel->setOnDirtyFlagChanged([this](LLPanel *, bool val) { onPanelDirtyFlagChanged(val); }); } @@ -817,7 +843,7 @@ void LLFloaterEditExtDayCycle::updateWaterTabs(const LLSettingsWaterPtr_t &p_wat void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky) { - LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple' + LLTabContainer* tab_container = mSkyTabLayoutContainer->getChild<LLTabContainer>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple' LLPanelSettingsSky* panel; panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel")); @@ -835,6 +861,29 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky) { panel->setSky(p_sky); } + + if (gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics")) + { + panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density")); + if (!panel) + { + panel = new LLPanelSettingsSkyDensityTab; + panel->buildFromFile("panel_settings_sky_density.xml"); + panel->setOnDirtyFlagChanged([this](LLPanel *, bool value) { onPanelDirtyFlagChanged(value); }); + tab_container->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(false)); + } + panel->setSky(std::static_pointer_cast<LLSettingsSky>(p_sky)); + } + else + { + panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("panel_settings_sky_density")); + if (panel) + { + tab_container->removeTabPanel(panel); + } + delete panel; + } + } void LLFloaterEditExtDayCycle::updateButtons() |