diff options
Diffstat (limited to 'indra/newview/llpaneleditsky.cpp')
-rw-r--r-- | indra/newview/llpaneleditsky.cpp | 98 |
1 files changed, 94 insertions, 4 deletions
diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index cb303b7ee2..dfb803a0a3 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -29,10 +29,13 @@ #include "llpaneleditsky.h" #include "llslider.h" +#include "llsliderctrl.h" #include "lltexturectrl.h" #include "llcolorswatch.h" #include "llvirtualtrackball.h" +#include "llsettingssky.h" +static LLDefaultChildRegistry::Register<LLDensityCtrl> register_density_control("densityctrl"); namespace { @@ -81,6 +84,7 @@ namespace static LLPanelInjector<LLPanelSettingsSkyAtmosTab> t_settings_atmos("panel_settings_atmos"); static LLPanelInjector<LLPanelSettingsSkyCloudTab> t_settings_cloud("panel_settings_cloud"); static LLPanelInjector<LLPanelSettingsSkySunMoonTab> t_settings_sunmoon("panel_settings_sunmoon"); +static LLPanelInjector<LLPanelSettingsDensityTab> t_settings_density("panel_settings_density"); //========================================================================== LLPanelSettingsSky::LLPanelSettingsSky() : @@ -336,7 +340,6 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild() 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<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunScaleChanged(); }); getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setBlankImageAssetID(LLSettingsSky::GetBlankSunTextureId()); getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setDefaultImageAssetID(LLSettingsSky::GetBlankSunTextureId()); getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setAllowNoTexture(TRUE); @@ -347,7 +350,7 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild() getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setBlankImageAssetID(LLSettingsSky::GetBlankSunTextureId()); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(TRUE); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowLocalTexture(FALSE); - getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonScaleChanged(); }); + refresh(); @@ -384,10 +387,8 @@ void LLPanelSettingsSkySunMoonTab::refresh() getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setValue(mSkySettings->getStarBrightness()); getChild<LLVirtualTrackball>(FIELD_SKY_SUN_ROTATION)->setRotation(mSkySettings->getSunRotation()); getChild<LLTextureCtrl>(FIELD_SKY_SUN_IMAGE)->setValue(mSkySettings->getSunTextureId()); - getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setValue(mSkySettings->getSunScale()); getChild<LLVirtualTrackball>(FIELD_SKY_MOON_ROTATION)->setRotation(mSkySettings->getMoonRotation()); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setValue(mSkySettings->getMoonTextureId()); - getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setValue(mSkySettings->getMoonScale()); } //------------------------------------------------------------------------- @@ -452,3 +453,92 @@ void LLPanelSettingsSkySunMoonTab::onMoonScaleChanged() mSkySettings->setMoonScale((getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->getValue().asReal())); mSkySettings->update(); } + + +LLPanelSettingsDensityTab::LLPanelSettingsDensityTab() +{ +} + +BOOL LLPanelSettingsDensityTab::postBuild() +{ + mControlName = LLDensityCtrl::NameForDensityProfileType(mProfileType); + getChild<LLDensityCtrl>(mControlName)->setProfileType(mProfileType); + refresh(); + return TRUE; +} + +void LLPanelSettingsDensityTab::setEnabled(BOOL enabled) +{ + LLPanelSettingsSky::setEnabled(enabled); + getChild<LLDensityCtrl>(mControlName)->setEnabled(enabled); +} + +void LLPanelSettingsDensityTab::refresh() +{ + if (!mSkySettings) + { + setAllChildrenEnabled(FALSE); + setEnabled(FALSE); + return; + } + + setEnabled(TRUE); + setAllChildrenEnabled(TRUE); + getChild<LLDensityCtrl>(mControlName)->setSky(mSkySettings); + getChild<LLDensityCtrl>(mControlName)->refresh(); +} + +void LLPanelSettingsDensityTab::updateProfile() +{ + getChild<LLDensityCtrl>(mControlName)->setSky(mSkySettings); + getChild<LLDensityCtrl>(mControlName)->updateProfile(); + mSkySettings->update(); +} + +LLPanelSettingsDensity::LLPanelSettingsDensity() +{ +} + +BOOL LLPanelSettingsDensity::postBuild() +{ + //static_cast<LLPanelSettingsDensityTab*>(getChild<LLPanelSettingsDensityTab>(LLDensityCtrl::DENSITY_RAYLEIGH))->setProfileType(LLDensityCtrl::Rayleigh); + //static_cast<LLPanelSettingsDensityTab*>(getChild<LLPanelSettingsDensityTab>(LLDensityCtrl::DENSITY_MIE))->setProfileType(LLDensityCtrl::Mie); + //static_cast<LLPanelSettingsDensityTab*>(getChild<LLPanelSettingsDensityTab>(LLDensityCtrl::DENSITY_ABSORPTION))->setProfileType(LLDensityCtrl::Absorption); + refresh(); + return TRUE; +} + +void LLPanelSettingsDensity::setEnabled(BOOL enabled) +{ + LLPanelSettingsSky::setEnabled(enabled); + + //getChild<LLPanelSettingsDensityTab>(LLDensityCtrl::DENSITY_RAYLEIGH)->setEnabled(enabled); + //getChild<LLPanelSettingsDensityTab>(LLDensityCtrl::DENSITY_MIE)->setEnabled(enabled); + //getChild<LLPanelSettingsDensityTab>(LLDensityCtrl::DENSITY_ABSORPTION)->setEnabled(enabled); +} + +void LLPanelSettingsDensity::refresh() +{ + if (!mSkySettings) + { + setAllChildrenEnabled(FALSE); + setEnabled(FALSE); + return; + } + + setEnabled(TRUE); + setAllChildrenEnabled(TRUE); + + //getChild<LLDensityCtrl>(LLDensityCtrl::DENSITY_RAYLEIGH)->refresh(); + //getChild<LLDensityCtrl>(LLDensityCtrl::DENSITY_MIE)->refresh(); + //getChild<LLDensityCtrl>(LLDensityCtrl::DENSITY_ABSORPTION)->refresh(); +} + +void LLPanelSettingsDensity::updateProfile() +{ + //getChild<LLDensityCtrl>(LLDensityCtrl::DENSITY_RAYLEIGH)->updateProfile(); + //getChild<LLDensityCtrl>(LLDensityCtrl::DENSITY_MIE)->updateProfile(); + //getChild<LLDensityCtrl>(LLDensityCtrl::DENSITY_ABSORPTION)->updateProfile(); + mSkySettings->update(); +} + |