diff options
| author | Rider Linden <rider@lindenlab.com> | 2019-04-03 14:52:59 -0700 | 
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2019-04-03 14:52:59 -0700 | 
| commit | e24237b6af504ff8faea02c8ab22344f2452364e (patch) | |
| tree | cda98ca00da4903919fabe14cef3e98fa943089b /indra | |
| parent | 47e3c3aa216f72cae9b940a8f308c7de7c7c695c (diff) | |
SL-10189, SL-10880: Mark the day instance so that it does not try to reanimate a day cycle when setting a fixed sky. Add new floater for setting the shared environment to local and allowing modifications.
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/newview/llenvironment.cpp | 89 | ||||
| -rw-r--r-- | indra/newview/llenvironment.h | 11 | ||||
| -rw-r--r-- | indra/newview/llfloaterenvironmentadjust.cpp | 329 | ||||
| -rw-r--r-- | indra/newview/llfloaterenvironmentadjust.h | 86 | ||||
| -rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 4 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_adjust_environment.xml | 365 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 7 | 
9 files changed, 859 insertions, 38 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 9933713911..7739feb419 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -235,6 +235,7 @@ set(viewer_SOURCE_FILES      llfloaterdeleteprefpreset.cpp      llfloaterdestinations.cpp      llfloatereditextdaycycle.cpp +    llfloaterenvironmentadjust.cpp      llfloaterevent.cpp      llfloaterexperiencepicker.cpp      llfloaterexperienceprofile.cpp @@ -858,6 +859,7 @@ set(viewer_HEADER_FILES      llfloaterdeleteprefpreset.h      llfloaterdestinations.h      llfloatereditextdaycycle.h +    llfloaterenvironmentadjust.h      llfloaterevent.h      llfloaterexperiencepicker.h      llfloaterexperienceprofile.h diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 3defe68a0e..57e6ab7159 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -798,6 +798,11 @@ const S32 LLEnvironment::VERSION_CLEANUP(-4); // for cleanups  const F32 LLEnvironment::SUN_DELTA_YAW(F_PI);   // 180deg  + +const U32 LLEnvironment::DayInstance::NO_ANIMATE_SKY(0x01); +const U32 LLEnvironment::DayInstance::NO_ANIMATE_WATER(0x02); + +  //-------------------------------------------------------------------------  LLEnvironment::LLEnvironment():      mCloudScrollDelta(), @@ -1110,28 +1115,28 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm      DayInstance::ptr_t environment = getEnvironmentInstance(env, true); -//     LLSettingsSky::ptr_t prev_sky = mEnvironments[ENV_DEFAULT]->getSky(); -//     LLSettingsWater::ptr_t prev_water = mEnvironments[ENV_DEFAULT]->getWater(); -//     if (mCurrentEnvironment && (ENV_EDIT == env)) -//     { -//         prev_sky = mCurrentEnvironment->getSky() ? mCurrentEnvironment->getSky() : prev_sky; -//         prev_water = mCurrentEnvironment->getWater() ? mCurrentEnvironment->getWater() : prev_water; -//     } -//     environment->clear(); -//     environment->setSky((fixed.first) ? fixed.first : prev_sky); -//     environment->setWater((fixed.second) ? fixed.second : prev_water);      if (fixed.first) +    {          environment->setSky(fixed.first); +        environment->setFlags(DayInstance::NO_ANIMATE_SKY); +    }      else if (!environment->getSky()) +    {          environment->setSky(mCurrentEnvironment->getSky()); +        environment->setFlags(DayInstance::NO_ANIMATE_SKY); +    }      if (fixed.second) +    {          environment->setWater(fixed.second); +        environment->setFlags(DayInstance::NO_ANIMATE_WATER); +    }      else if (!environment->getWater()) +    {          environment->setWater(mCurrentEnvironment->getWater()); -         - +        environment->setFlags(DayInstance::NO_ANIMATE_WATER); +    }      if (!mSignalEnvChanged.empty())          mSignalEnvChanged(env, env_version); @@ -2447,7 +2452,8 @@ LLEnvironment::DayInstance::DayInstance(EnvSelection_t env) :      mInitialized(false),      mType(TYPE_INVALID),      mSkyTrack(1), -    mEnv(env) +    mEnv(env), +    mAnimateFlags(0)  { } @@ -2465,6 +2471,7 @@ LLEnvironment::DayInstance::ptr_t LLEnvironment::DayInstance::clone() const      environment->mInitialized = mInitialized;      environment->mType = mType;      environment->mSkyTrack = mSkyTrack; +    environment->mAnimateFlags = mAnimateFlags;      return environment;  } @@ -2489,6 +2496,8 @@ void LLEnvironment::DayInstance::setDay(const LLSettingsDay::ptr_t &pday, LLSett      mType = TYPE_CYCLED;      mInitialized = false; +    mAnimateFlags = 0; +      mDayCycle = pday;      mDayLength = daylength;      mDayOffset = dayoffset; @@ -2596,34 +2605,40 @@ void LLEnvironment::DayInstance::animate()      if (!mDayCycle)          return; -    LLSettingsDay::CycleTrack_t &wtrack = mDayCycle->getCycleTrack(0); - -    if (wtrack.empty()) +    if (!(mAnimateFlags & NO_ANIMATE_WATER))      { -        mWater.reset(); -        mBlenderWater.reset(); -    } -    else -    { -        mWater = LLSettingsVOWater::buildDefaultWater(); -        mBlenderWater = std::make_shared<LLTrackBlenderLoopingTime>(mWater, mDayCycle, 0,  -            mDayLength, mDayOffset, DEFAULT_UPDATE_THRESHOLD); -    } - -    // sky, initialize to track 1 -    LLSettingsDay::CycleTrack_t &track = mDayCycle->getCycleTrack(1); +        LLSettingsDay::CycleTrack_t &wtrack = mDayCycle->getCycleTrack(0); -    if (track.empty()) -    { -        mSky.reset(); -        mBlenderSky.reset(); +        if (wtrack.empty()) +        { +            mWater.reset(); +            mBlenderWater.reset(); +        } +        else +        { +            mWater = LLSettingsVOWater::buildDefaultWater(); +            mBlenderWater = std::make_shared<LLTrackBlenderLoopingTime>(mWater, mDayCycle, 0, +                mDayLength, mDayOffset, DEFAULT_UPDATE_THRESHOLD); +        }      } -    else + +    if (!(mAnimateFlags & NO_ANIMATE_SKY))      { -        mSky = LLSettingsVOSky::buildDefaultSky(); -        mBlenderSky = std::make_shared<LLTrackBlenderLoopingTime>(mSky, mDayCycle, 1,  -            mDayLength, mDayOffset, DEFAULT_UPDATE_THRESHOLD); -        mBlenderSky->switchTrack(mSkyTrack, 0.0); +        // sky, initialize to track 1 +        LLSettingsDay::CycleTrack_t &track = mDayCycle->getCycleTrack(1); + +        if (track.empty()) +        { +            mSky.reset(); +            mBlenderSky.reset(); +        } +        else +        { +            mSky = LLSettingsVOSky::buildDefaultSky(); +            mBlenderSky = std::make_shared<LLTrackBlenderLoopingTime>(mSky, mDayCycle, 1, +                mDayLength, mDayOffset, DEFAULT_UPDATE_THRESHOLD); +            mBlenderSky->switchTrack(mSkyTrack, 0.0); +        }      }  } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 64350c42e8..327e34d856 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -235,8 +235,12 @@ public:              TYPE_FIXED,              TYPE_CYCLED          }; +          typedef std::shared_ptr<DayInstance> ptr_t; +        static const U32                NO_ANIMATE_SKY; +        static const U32                NO_ANIMATE_WATER; +                                          DayInstance(EnvSelection_t env);          virtual                         ~DayInstance() { }; @@ -273,7 +277,12 @@ public:          LLSettingsBase::TrackPosition   getProgress() const; +        void                            setFlags(U32 flag) { mAnimateFlags |= flag; } +        void                            clearFlags(U32 flag) { mAnimateFlags &= ~flag; } +      protected: + +          LLSettingsDay::ptr_t        mDayCycle;          LLSettingsSky::ptr_t        mSky;          LLSettingsWater::ptr_t      mWater; @@ -291,6 +300,8 @@ public:          EnvSelection_t              mEnv; +        U32                         mAnimateFlags; +          LLSettingsBase::TrackPosition secondsToKeyframe(LLSettingsDay::Seconds seconds);      }; diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp new file mode 100644 index 0000000000..9456780627 --- /dev/null +++ b/indra/newview/llfloaterenvironmentadjust.cpp @@ -0,0 +1,329 @@ +/**  + * @file llfloaterfixedenvironment.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 "llfloaterenvironmentadjust.h" + +#include "llslider.h" +#include "llsliderctrl.h" +#include "llcolorswatch.h" +#include "llvirtualtrackball.h" +#include "llenvironment.h" + +//========================================================================= +namespace +{ +    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_SUN_COLOR("sun_color"); +    const std::string FIELD_SKY_CLOUD_COLOR("cloud_color"); +    const std::string FIELD_SKY_HAZE_HORIZON("haze_horizon"); +    const std::string FIELD_SKY_HAZE_DENSITY("haze_density"); +    const std::string FIELD_SKY_CLOUD_COVERAGE("cloud_coverage"); +    const std::string FIELD_SKY_CLOUD_SCALE("cloud_scale"); +    const std::string FIELD_SKY_SCENE_GAMMA("scene_gamma"); +    const std::string FIELD_SKY_SUN_ROTATION("sun_rotation"); +    const std::string FIELD_SKY_SUN_SCALE("sun_scale"); +    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_MOON_ROTATION("moon_rotation"); + +    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); +    const F32 SLIDER_SCALE_DENSITY_MULTIPLIER(0.001f); + +    const S32 FLOATER_ENVIRONMENT_UPDATE(-2); +} + +//========================================================================= +LLFloaterEnvironmentAdjust::LLFloaterEnvironmentAdjust(const LLSD &key): +    LLFloater(key) +{} + +LLFloaterEnvironmentAdjust::~LLFloaterEnvironmentAdjust() +{} + +//------------------------------------------------------------------------- +BOOL LLFloaterEnvironmentAdjust::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_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_SUN_COLOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunColorChanged(); }); + +    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_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSunScaleChanged(); }); + +    getChild<LLUICtrl>(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); }); + +    refresh(); +    return TRUE; +} + +void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key) +{ +    captureCurrentEnvironment(); + +    mEventConnection = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version){ onEnvironmentUpdated(env, version); }); + +    LLFloater::onOpen(key); +    refresh(); +} + +void LLFloaterEnvironmentAdjust::onClose(bool app_quitting) +{ +    mEventConnection.disconnect(); +    mLiveSky.reset(); +    LLFloater::onClose(app_quitting); +} + + +//------------------------------------------------------------------------- +void LLFloaterEnvironmentAdjust::refresh() +{ +    if (!mLiveSky) +    { +        setAllChildrenEnabled(FALSE); +        return; +    } + +    setEnabled(TRUE); +    setAllChildrenEnabled(TRUE); + +    getChild<LLColorSwatchCtrl>(FIELD_SKY_AMBIENT_LIGHT)->set(mLiveSky->getAmbientColor() / SLIDER_SCALE_SUN_AMBIENT); +    getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_HORIZON)->set(mLiveSky->getBlueHorizon() / SLIDER_SCALE_BLUE_HORIZON_DENSITY); +    getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_DENSITY)->set(mLiveSky->getBlueDensity() / SLIDER_SCALE_BLUE_HORIZON_DENSITY); +    getChild<LLUICtrl>(FIELD_SKY_HAZE_HORIZON)->setValue(mLiveSky->getHazeHorizon()); +    getChild<LLUICtrl>(FIELD_SKY_HAZE_DENSITY)->setValue(mLiveSky->getHazeDensity()); +    getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->setValue(mLiveSky->getGamma()); +    getChild<LLColorSwatchCtrl>(FIELD_SKY_CLOUD_COLOR)->set(mLiveSky->getCloudColor()); +    getChild<LLUICtrl>(FIELD_SKY_CLOUD_COVERAGE)->setValue(mLiveSky->getCloudShadow()); +    getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCALE)->setValue(mLiveSky->getCloudScale()); +    getChild<LLColorSwatchCtrl>(FIELD_SKY_SUN_COLOR)->set(mLiveSky->getSunlightColor() / SLIDER_SCALE_SUN_AMBIENT); + +    LLColor3 glow(mLiveSky->getGlow()); + +    // takes 40 - 0.2 range -> 0 - 1.99 UI range +    getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setValue(2.0 - (glow.mV[0] / SLIDER_SCALE_GLOW_R)); +    getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setValue(glow.mV[2] / SLIDER_SCALE_GLOW_B); +    getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setValue(mLiveSky->getStarBrightness()); +    getChild<LLVirtualTrackball>(FIELD_SKY_SUN_ROTATION)->setRotation(mLiveSky->getSunRotation()); +    getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setValue(mLiveSky->getSunScale()); +    getChild<LLVirtualTrackball>(FIELD_SKY_MOON_ROTATION)->setRotation(mLiveSky->getMoonRotation()); + +} + + +void LLFloaterEnvironmentAdjust::captureCurrentEnvironment() +{ +    LLEnvironment &environment(LLEnvironment::instance()); +    bool updatelocal(false); + +    if (environment.hasEnvironment(LLEnvironment::ENV_LOCAL)) +    { +        if (environment.getEnvironmentDay(LLEnvironment::ENV_LOCAL)) +        {   // We have a full day cycle in the local environment.  Freeze the sky +            mLiveSky = environment.getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL)->buildClone(); +            updatelocal = true; +        } +        else +        {   // otherwise we can just use the sky. +            mLiveSky = environment.getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL); +        } +    } +    else +    { +        mLiveSky = environment.getEnvironmentFixedSky(LLEnvironment::ENV_PARCEL, true)->buildClone(); +        updatelocal = true; +    } + +    if (updatelocal) +    { +        environment.setEnvironment(LLEnvironment::ENV_LOCAL, mLiveSky, FLOATER_ENVIRONMENT_UPDATE); +    } +    environment.setSelectedEnvironment(LLEnvironment::ENV_LOCAL); +    environment.updateEnvironment(LLEnvironment::TRANSITION_INSTANT); + +} + +//------------------------------------------------------------------------- +void LLFloaterEnvironmentAdjust::onAmbientLightChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setAmbientColor(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_AMBIENT_LIGHT)->get() * SLIDER_SCALE_SUN_AMBIENT)); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onBlueHorizonChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setBlueHorizon(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_HORIZON)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY)); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onBlueDensityChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setBlueDensity(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_BLUE_DENSITY)->get() * SLIDER_SCALE_BLUE_HORIZON_DENSITY)); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onHazeHorizonChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setHazeHorizon(getChild<LLUICtrl>(FIELD_SKY_HAZE_HORIZON)->getValue().asReal()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onHazeDensityChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setHazeDensity(getChild<LLUICtrl>(FIELD_SKY_HAZE_DENSITY)->getValue().asReal()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onSceneGammaChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setGamma(getChild<LLUICtrl>(FIELD_SKY_SCENE_GAMMA)->getValue().asReal()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onCloudColorChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setCloudColor(LLColor3(getChild<LLColorSwatchCtrl>(FIELD_SKY_CLOUD_COLOR)->get())); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onCloudCoverageChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setCloudShadow(getChild<LLUICtrl>(FIELD_SKY_CLOUD_COVERAGE)->getValue().asReal()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onCloudScaleChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setCloudScale(getChild<LLUICtrl>(FIELD_SKY_CLOUD_SCALE)->getValue().asReal()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onGlowChanged() +{ +    if (!mLiveSky) +        return; +    LLColor3 glow(getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->getValue().asReal(), 0.0f, getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->getValue().asReal()); + +    // takes 0 - 1.99 UI range -> 40 -> 0.2 range +    glow.mV[0] = (2.0f - glow.mV[0]) * SLIDER_SCALE_GLOW_R; +    glow.mV[2] *= SLIDER_SCALE_GLOW_B; + +    mLiveSky->setGlow(glow); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onStarBrightnessChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setStarBrightness(getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->getValue().asReal()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onSunRotationChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setSunRotation(getChild<LLVirtualTrackball>(FIELD_SKY_SUN_ROTATION)->getRotation()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onSunScaleChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setSunScale((getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->getValue().asReal())); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onMoonRotationChanged() +{ +    if (!mLiveSky) +        return; +    mLiveSky->setMoonRotation(getChild<LLVirtualTrackball>(FIELD_SKY_MOON_ROTATION)->getRotation()); +    mLiveSky->update(); +} + +void LLFloaterEnvironmentAdjust::onSunColorChanged() +{ +    if (!mLiveSky) +        return; +    LLColor3 color(getChild<LLColorSwatchCtrl>(FIELD_SKY_SUN_COLOR)->get()); + +    color *= SLIDER_SCALE_SUN_AMBIENT; + +    mLiveSky->setSunlightColor(color); +    mLiveSky->update(); +} + + +void LLFloaterEnvironmentAdjust::onEnvironmentUpdated(LLEnvironment::EnvSelection_t env, S32 version) +{ +    if (env == LLEnvironment::ENV_LOCAL) +    {   // a new local environment has been applied +        if (version != FLOATER_ENVIRONMENT_UPDATE) +        {   // not by this floater +            captureCurrentEnvironment(); +            refresh(); +        } +    } +} diff --git a/indra/newview/llfloaterenvironmentadjust.h b/indra/newview/llfloaterenvironmentadjust.h new file mode 100644 index 0000000000..5bd91b0c43 --- /dev/null +++ b/indra/newview/llfloaterenvironmentadjust.h @@ -0,0 +1,86 @@ +/**  + * @file llfloaterenvironmentadjust.h + * @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$ + */ + +#ifndef LL_FLOATERENVIRONMENTADJUST_H +#define LL_FLOATERENVIRONMENTADJUST_H + +#include "llfloater.h" +#include "llsettingsbase.h" +#include "llsettingssky.h" +#include "llenvironment.h" + +#include "boost/signals2.hpp" + +class LLButton; +class LLLineEditor; + +/** + * Floater container for taking a snapshot of the current environment and making minor adjustments. + */ +class LLFloaterEnvironmentAdjust : public LLFloater +{ +    LOG_CLASS(LLFloaterEnvironmentAdjust); + +public: +                                LLFloaterEnvironmentAdjust(const LLSD &key); +    virtual                     ~LLFloaterEnvironmentAdjust(); + + +    virtual BOOL                postBuild() override; +    virtual void                onOpen(const LLSD& key) override; +    virtual void                onClose(bool app_quitting) override; + +    virtual void                refresh() override; + +private: +    void                        captureCurrentEnvironment(); + +    void                        onAmbientLightChanged(); +    void                        onBlueHorizonChanged(); +    void                        onBlueDensityChanged(); +    void                        onHazeHorizonChanged(); +    void                        onHazeDensityChanged(); +    void                        onSceneGammaChanged(); + +    void                        onCloudColorChanged(); +    void                        onCloudCoverageChanged(); +    void                        onCloudScaleChanged(); +    void                        onSunColorChanged(); + +    void                        onGlowChanged(); +    void                        onStarBrightnessChanged(); +    void                        onSunRotationChanged(); +    void                        onSunScaleChanged(); + +    void                        onMoonRotationChanged(); + +    void                        onEnvironmentUpdated(LLEnvironment::EnvSelection_t env, S32 version); + +    LLSettingsSky::ptr_t        mLiveSky; +    LLEnvironment::connection_t mEventConnection; +}; + +#endif // LL_FLOATERFIXEDENVIRONMENT_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 6ad4ea76af..756dafe270 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -58,6 +58,7 @@  #include "llfloaterdeleteprefpreset.h"  #include "llfloaterdestinations.h"  #include "llfloatereditextdaycycle.h" +#include "llfloaterenvironmentadjust.h"  #include "llfloaterexperienceprofile.h"  #include "llfloaterexperiences.h"  #include "llfloaterexperiencepicker.h" @@ -222,7 +223,8 @@ void LLViewerFloaterReg::registerFloaters()      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_adjust_snapshot", "floater_adjust_environment.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvironmentAdjust>);      LLFloaterReg::add("env_edit_extdaycycle", "floater_edit_ext_day_cycle.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEditExtDayCycle>);      LLFloaterReg::add("my_environments", "floater_my_environments.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyEnvironment>); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 68a91968ea..f03eb48573 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8542,6 +8542,10 @@ class LLWorldEnvSettings : public view_listener_t              else                  LLEnvironment::instance().pauseCloudScroll();          } +        else if (event_name == "adjust_tool") +        { +            LLFloaterReg::showInstance("env_adjust_snapshot"); +        }          else if (event_name == "my_environs")          {              LLFloaterReg::showInstance("my_environments"); diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml new file mode 100644 index 0000000000..e2cf809c9c --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml @@ -0,0 +1,365 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater layout="topleft" +         name="env_adjust_snapshot" +         help_topic="day_presets" +         save_rect="false" +         title="Personal Lighting" +         width="845" +         height="225" +         min_width="500" +         min_height="225" +         single_instance="true" +         can_resize="false"> +    <layout_stack name="outer_stack" +                  width="845" +                  height="212" +                  follows="all" +                  animate="false" +                  top="0" +                  orientation="vertical"> +        <!-- If I put in a timeline it would go here --> +        <layout_panel name="env_controls" +                      border="false" +                      bevel_style="in" +                      auto_resize="true" +                      user_resize="true" +                      height="150" +                      min_height="0" +                      visible="true"> +            <layout_stack name="settings_stack" +                          width="855" +                          height="150" +                          follows="all" +                          animate="false" +                          orientation="horizontal"> +                <layout_panel border="false" +                              bevel_style="in" +                              auto_resize="false" +                              user_resize="false" +                              visible="true" +                              width="160" +                              height="150"> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left="10" +                          top="5" +                          width="80">Ambient:</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|top" +                          height="10" +                          layout="topleft" +                          left_delta="0" +                          top_pad="10" +                          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|top" +                          height="10" +                          layout="topleft" +                          left_delta="0" +                          top_pad="10" +                          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"/> +                    <text follows="right|top" +                          height="10" +                          layout="topleft" +                          right="-10" +                          top="5" +                          width="60">Sun Color:</text> +                    <color_swatch can_apply_immediately="true" +                                  follows="left|top" +                                  height="37" +                                  label_height="0" +                                  layout="topleft" +                                  left_delta="0" +                                  name="sun_color" +                                  top_pad="5" +                                  width="60"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="0" +                          top_pad="10" +                          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"/> +                </layout_panel> +                <layout_panel border="false" +                              bevel_style="in" +                              auto_resize="false" +                              user_resize="false" +                              visible="true" +                              width="200" +                              height="150"> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="5" +                          top_pad="5" +                          width="80">Haze Horizon:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="0" +                            max_val="5" +                            name="haze_horizon" +                            top_pad="5" +                            width="185" +                            can_edit_text="true"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="-5" +                          top_pad="5" +                          width="80">Haze Density:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="0" +                            max_val="5" +                            name="haze_density" +                            top_pad="5" +                            width="185" +                            can_edit_text="true"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="-5" +                          top_pad="5" +                          width="185">Cloud Coverage:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="0" +                            max_val="1" +                            name="cloud_coverage" +                            top_pad="5" +                            width="185" +                            can_edit_text="true"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="-5" +                          top_pad="5" +                          width="185">Cloud Scale:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="0.01" +                            max_val="3" +                            name="cloud_scale" +                            top_pad="5" +                            width="185" +                            can_edit_text="true"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="-5" +                          top_pad="15" +                          width="80">Scene Gamma:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            max_val="20" +                            name="scene_gamma" +                            top_pad="5" +                            width="185" +                            can_edit_text="true"/> +                </layout_panel> +                <layout_panel border="false" +                              bevel_style="in" +                              auto_resize="false" +                              user_resize="false" +                              height="150" +                              width="310" +                              min_height="0" +                              visible="true"> +                    <text follows="top|left" +                          font="SansSerifBold" +                          height="10" +                          layout="topleft" +                          name="label" +                          left="5" +                          top="5" +                          width="105">Sun:</text> +                    <sun_moon_trackball name="sun_rotation" +                                        follows="left|top" +                                        left_delta="0" +                                        top_delta="20" +                                        height="150" +                                        width="150" +                                        thumb_mode="sun"/> +                    <check_box control_name="sunbeacon" +                               width="60" +                               height="16" +                               label="Show Beacon" +                               layout="topleft" +                               name="sunbeacon" +                               left_delta="55" +                               bottom="-10" +                               follows="bottom|right"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_pad="40" +                          top="25" +                          width="80">Scale:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="0.25" +                            max_val="20" +                            name="sun_scale" +                            top_delta="15" +                            width="130" +                            can_edit_text="true"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="-5" +                          top_pad="5" +                          width="100">Glow Focus:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="-2" +                            max_val="2" +                            name="glow_focus" +                            top_pad="5" +                            width="130" +                            can_edit_text="true"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="-5" +                          top_pad="5" +                          width="200">Glow Size:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="0" +                            max_val="1.99" +                            name="glow_size" +                            top_pad="5" +                            width="130" +                            can_edit_text="true"/> +                    <text follows="left|top" +                          height="10" +                          layout="topleft" +                          left_delta="-5" +                          top_pad="10" +                          width="200">Star Brightness:</text> +                    <slider decimal_digits="2" +                            follows="left|top" +                            height="16" +                            increment="0.01" +                            initial_value="0" +                            layout="topleft" +                            left_delta="5" +                            min_val="0" +                            max_val="500" +                            name="star_brightness" +                            top_pad="5" +                            width="130" +                            can_edit_text="true"/> +                </layout_panel> +                <layout_panel border="false" +                              bevel_style="in" +                              auto_resize="false" +                              user_resize="false" +                              height="150" +                              width="160" +                              min_height="0" +                              visible="true"> +                    <text follows="top|left" +                          font="SansSerifBold" +                          height="10" +                          layout="topleft" +                          name="label" +                          left="5" +                          top="5" +                          width="105">Moon:</text> +                    <sun_moon_trackball name="moon_rotation" +                                        follows="left|top" +                                        left_delta="0" +                                        top_delta="20" +                                        height="150" +                                        width="150" +                                        thumb_mode="moon"/> +                    <check_box control_name="moonbeacon" +                               width="60" +                               height="16" +                               label="Show Beacon" +                               layout="topleft" +                               name="moonbeacon" +                               right="-50" +                               bottom="-10" +                               follows="bottom|right"/> +                </layout_panel> +            </layout_stack> +        </layout_panel> +    </layout_stack> +</floater> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index f676df5e8b..2eab312ecd 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -715,6 +715,13 @@                   function="World.EnvSettings"                   parameter="my_environs" />              </menu_item_call> +            <menu_item_call +             label="Personal Lighting..." +             name="adjustment_tool"> +                <menu_item_call.on_click +                 function="World.EnvSettings" +                 parameter="adjust_tool" /> +            </menu_item_call>              <menu_item_separator/>              <menu_item_check               label="Pause Clouds"  | 
