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 18a7c1d242..8e29e4cf32 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -62,6 +62,8 @@ #include "llenvironment.h" #include "lltrans.h" +#pragma optimize("", off) + extern LLControlGroup gSavedSettings; //========================================================================= @@ -198,9 +200,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); }); } @@ -813,7 +839,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")); @@ -831,6 +857,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() |