diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llenvironment.cpp | 83 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 7 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerregion.h | 19 |
4 files changed, 71 insertions, 44 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index e64d71e228..25c7fb89db 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -50,6 +50,8 @@ #include "llsettingsvo.h" #include "llnotificationsutil.h" +#include "llregioninfomodel.h" + #include <boost/make_shared.hpp> //define EXPORT_PRESETS 1 @@ -108,8 +110,12 @@ void LLEnvironment::initSingleton() legacyLoadAllPresets(); requestRegionEnvironment(); - gAgent.addRegionChangedCallback(boost::bind(&LLEnvironment::onRegionChange, this)); + + LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLEnvironment::onParcelChange, this)); gAgent.addParcelChangedCallback(boost::bind(&LLEnvironment::onParcelChange, this)); + + //TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer. + gAgent.addRegionChangedCallback(boost::bind(&LLEnvironment::requestRegionEnvironment, this)); } LLEnvironment::~LLEnvironment() @@ -147,11 +153,6 @@ LLEnvironment::connection_t LLEnvironment::setDayCycleListChange(const LLEnviron return mDayCycleListChange.connect(cb); } -void LLEnvironment::onRegionChange() -{ - requestRegionEnvironment(); -} - void LLEnvironment::onParcelChange() { S32 parcel_id(INVALID_PARCEL_ID); @@ -783,7 +784,9 @@ void LLEnvironment::selectAgentEnvironment() S64Seconds day_offset(LLSettingsDay::DEFAULT_DAYOFFSET); LLSettingsDay::ptr_t pday; - // TODO: First test if agent has local environment set. + // TODO: Test if editing environment has been set. + + // TODO: Test if agent has local environment set. LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); LLViewerRegion *pRegion = gAgent.getRegion(); @@ -809,25 +812,38 @@ void LLEnvironment::selectAgentEnvironment() if (pday) selectDayCycle(pday); - } void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envinfo) { LL_WARNS("ENVIRONMENT") << "Have environment" << LL_ENDL; - if (parcel_id == INVALID_PARCEL_ID) - { + LLSettingsDay::ptr_t pday = LLSettingsVODay::buildFromEnvironmentMessage(envinfo->mDaycycleData); + + LL_WARNS("ENVIRONMENT") << "serverhash=" << envinfo->mDayHash << " viewerhash=" << pday->getHash() << LL_ENDL; + + if (envinfo->mParcelId == INVALID_PARCEL_ID) + { // the returned info applies to an entire region. LLViewerRegion *pRegion = gAgent.getRegion(); - if (pRegion) + pRegion->setDayLength(envinfo->mDayLength); + pRegion->setDayOffset(envinfo->mDayOffset); + pRegion->setIsDefaultDayCycle(envinfo->mIsDefault); + if (pRegion->getRegionDayCycleHash() != envinfo->mDayHash) { - pRegion->setDayLength(envinfo->mDayLength); - pRegion->setDayOffset(envinfo->mDayOffset); - pRegion->setIsDefaultDayCycle(envinfo->mIsDefault); - pRegion->setRegionDayCycle(LLSettingsVODay::buildFromEnvironmentMessage(envinfo->mDaycycleData)); + pRegion->setRegionDayCycle(pday); + pRegion->setRegionDayCycleHash(envinfo->mDayHash); + } + + if (parcel_id != INVALID_PARCEL_ID) + { // We requested a parcel environment but got back the region's. If this is the parcel we are in + // clear it out. + LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); - /*TODO: track_altitudes*/ + if (parcel->getLocalID() == parcel_id) + { + parcel->clearParcelDayCycleInfo(); + } } } else @@ -839,18 +855,16 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI parcel->setDayLength(envinfo->mDayLength); parcel->setDayOffset(envinfo->mDayOffset); parcel->setUsesDefaultDayCycle(envinfo->mIsDefault); - - LLSettingsDay::ptr_t pday; - if (!envinfo->mIsDefault) + if (parcel->getParcelDayCycleHash() != envinfo->mDayHash) { - pday = LLSettingsVODay::buildFromEnvironmentMessage(envinfo->mDaycycleData); + parcel->setParcelDayCycle(pday); + parcel->setParcelDayCycleHash(envinfo->mDayHash); } - parcel->setParcelDayCycle(pday); - // select parcel day } } - + + /*TODO: track_altitudes*/ selectAgentEnvironment(); } @@ -1000,8 +1014,6 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pd url += query.str(); } - LL_WARNS("LAPRAS") << "url=" << url << LL_ENDL; - LLSD result = httpAdapter->putAndSuspend(httpRequest, url, body); // results that come back may contain the new settings @@ -1009,6 +1021,7 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pd LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + LL_WARNS("LAPRAS") << "success=" << result["success"] << LL_ENDL; if ((!status) || !result["success"].asBoolean()) { LL_WARNS("WindlightCaps") << "Couldn't update Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; @@ -1052,8 +1065,6 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, environment_apply_fn app url += query.str(); } - LL_WARNS("LAPRAS") << "url=" << url << LL_ENDL; - LLSD result = httpAdapter->deleteAndSuspend(httpRequest, url); // results that come back may contain the new settings @@ -1061,6 +1072,7 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, environment_apply_fn app LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + LL_WARNS("LAPRAS") << "success=" << result["success"] << LL_ENDL; if ((!status) || !result["success"].asBoolean()) { LL_WARNS("WindlightCaps") << "Couldn't reset Windlight settings in " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; @@ -1125,12 +1137,15 @@ void LLEnvironment::UserPrefs::store() } LLEnvironment::EnvironmentInfo::EnvironmentInfo(): - mParcelId(), - mDayLength(LLSettingsDay::DEFAULT_DAYLENGTH), - mDayOffset(LLSettingsDay::DEFAULT_DAYOFFSET), + mParcelId(INVALID_PARCEL_ID), + mRegionId(), + mDayLength(0), + mDayOffset(0), + mDayHash(0), mDaycycleData(), mAltitudes(), - mIsDefault(false) + mIsDefault(false), + mIsRegion(false) { } @@ -1139,11 +1154,15 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL ptr_t pinfo = boost::make_shared<EnvironmentInfo>(); if (environment.has("parcel_id")) - pinfo->mParcelId = environment["parcel_id"].asUUID(); + pinfo->mParcelId = environment["parcel_id"].asInteger(); + if (environment.has("region_id")) + pinfo->mRegionId = environment["region_id"].asUUID(); if (environment.has("day_length")) pinfo->mDayLength = S64Seconds(environment["day_length"].asInteger()); if (environment.has("day_offset")) pinfo->mDayOffset = S64Seconds(environment["day_offset"].asInteger()); + if (environment.has("day_hash")) + pinfo->mDayHash = environment["day_hash"].asInteger(); if (environment.has("day_cycle")) pinfo->mDaycycleData = environment["day_cycle"]; if (environment.has("is_default")) diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index f5bd9be870..451bab5f9e 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -60,12 +60,16 @@ public: typedef boost::shared_ptr<EnvironmentInfo> ptr_t; - LLUUID mParcelId; + S32 mParcelId; + LLUUID mRegionId; S64Seconds mDayLength; S64Seconds mDayOffset; + size_t mDayHash; LLSD mDaycycleData; LLSD mAltitudes; bool mIsDefault; + bool mIsRegion; + static ptr_t extract(LLSD); @@ -296,7 +300,6 @@ private: void updateCloudScroll(); - void onRegionChange(); void onParcelChange(); void coroRequestEnvironment(S32 parcel_id, environment_apply_fn apply); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 8ba6b2354a..eadc035b3b 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -515,7 +515,9 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io ( SETTING_TRACKS, LLSDArray(watertrack)(skytrack)) ( SETTING_FRAMES, frames ); - LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); + LL_WARNS("LAPRAS") << "newsettings=" << newsettings << LL_ENDL; + + LLSettingsSky::validation_list_t validations = LLSettingsDay::validationList(); LLSD results = LLSettingsDay::settingValidation(newsettings, validations); if (!results["success"].asBoolean()) { @@ -527,7 +529,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io if (dayp) { - dayp->setInitialized(); + dayp->initialize(); } return dayp; } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index fef78e29a9..71d4d85ade 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -390,14 +390,16 @@ public: static BOOL isNewObjectCreationThrottleDisabled() { return sNewObjectCreationThrottle < 0; } - S64Seconds getDayLength() const { return mDayLength; } - void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } - S64Seconds getDayOffset() const { return mDayOffset; } - void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } - bool getIsDefaultDayCycle() const { return mIsDefaultDayCycle; } - void setIsDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } - LLSettingsDay::ptr_t getRegionDayCycle() const { return mDayCycle; } - void setRegionDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } + S64Seconds getDayLength() const { return mDayLength; } + void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; } + S64Seconds getDayOffset() const { return mDayOffset; } + void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; } + bool getIsDefaultDayCycle() const { return mIsDefaultDayCycle; } + void setIsDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; } + LLSettingsDay::ptr_t getRegionDayCycle() const { return mDayCycle; } + void setRegionDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; } + size_t getRegionDayCycleHash() const { return mDayCycleHash; } + void setRegionDayCycleHash(size_t hash) { mDayCycleHash = hash; } private: void addToVOCacheTree(LLVOCacheEntry* entry); @@ -542,6 +544,7 @@ private: S64Seconds mDayOffset; bool mIsDefaultDayCycle; LLSettingsDay::ptr_t mDayCycle; + size_t mDayCycleHash; class CacheMissItem { |