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/newview/llenvironment.cpp | |
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/newview/llenvironment.cpp')
-rw-r--r-- | indra/newview/llenvironment.cpp | 89 |
1 files changed, 52 insertions, 37 deletions
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); + } } } |