diff options
-rw-r--r-- | indra/newview/llenvironment.cpp | 40 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 13 |
2 files changed, 42 insertions, 11 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 3d8222a371..1b38fceef7 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -976,10 +976,28 @@ void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader) void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envinfo) { if (envinfo->mParcelId == INVALID_PARCEL_ID) - { // the returned info applies to an entire region. - LL_WARNS("LAPRAS") << "Setting Region environment" << LL_ENDL; - setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset); - mTrackAltitudes = envinfo->mAltitudes; + { + // the returned info applies to an entire region. + if (!envinfo->mDayCycle) + { + clearEnvironment(ENV_PARCEL); + setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); + updateEnvironment(); + } + else if (envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_WATER) + || envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_GROUND_LEVEL)) + { + LL_WARNS("LAPRAS") << "Invalid day cycle for region" << LL_ENDL; + clearEnvironment(ENV_PARCEL); + setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); + updateEnvironment(); + } + else + { + LL_INFOS("LAPRAS") << "Setting Region environment" << LL_ENDL; + setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset); + mTrackAltitudes = envinfo->mAltitudes; + } LL_WARNS("LAPRAS") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; } @@ -998,6 +1016,12 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI LL_WARNS("LAPRAS") << "Clearing environment on parcel #" << parcel_id << LL_ENDL; clearEnvironment(ENV_PARCEL); } + else if (envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_WATER) + || envinfo->mDayCycle->isTrackEmpty(LLSettingsDay::TRACK_GROUND_LEVEL)) + { + LL_WARNS("LAPRAS") << "Invalid day cycle for parcel #" << parcel_id << LL_ENDL; + clearEnvironment(ENV_PARCEL); + } else { setEnvironment(ENV_PARCEL, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset); @@ -1056,13 +1080,7 @@ void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb) { cb = [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { - if (envinfo->mDayCycle) recordEnvironment(pid, envinfo); - else - { - clearEnvironment(ENV_PARCEL); - setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET); - updateEnvironment(); - } + recordEnvironment(pid, envinfo); }; } diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 3531e9c4e8..5b083e8503 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -437,6 +437,19 @@ void LLFloaterEditExtDayCycle::refresh() void LLFloaterEditExtDayCycle::setEditDayCycle(const LLSettingsDay::ptr_t &pday) { mEditDay = pday->buildDeepCloneAndUncompress(); + + if (mEditDay->isTrackEmpty(LLSettingsDay::TRACK_WATER)) + { + LL_WARNS("ENVDAYEDIT") << "No water frames found, generating replacement" << LL_ENDL; + mEditDay->setWaterAtKeyframe(LLSettingsVOWater::buildDefaultWater(), .5f); + } + + if (mEditDay->isTrackEmpty(LLSettingsDay::TRACK_GROUND_LEVEL)) + { + LL_WARNS("ENVDAYEDIT") << "No sky frames found, generating replacement" << LL_ENDL; + mEditDay->setSkyAtKeyframe(LLSettingsVOSky::buildDefaultSky(), .5f, LLSettingsDay::TRACK_GROUND_LEVEL); + } + updateEditEnvironment(); LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT); LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT); |