summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llinventory/llparcel.cpp10
-rw-r--r--indra/llinventory/llparcel.h20
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp3
-rw-r--r--indra/newview/llenvironment.cpp83
-rw-r--r--indra/newview/llenvironment.h7
-rw-r--r--indra/newview/llsettingsvo.cpp6
-rw-r--r--indra/newview/llviewerregion.h19
7 files changed, 94 insertions, 54 deletions
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index f53ef5e0ff..411c35ed6b 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -236,6 +236,7 @@ void LLParcel::init(const LLUUID &owner_id,
mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET);
mIsDefaultDayCycle = true;
mDayCycle.reset();
+ mDayCycleHash = 0;
}
void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned)
@@ -1272,3 +1273,12 @@ U32 LLParcel::countExperienceKeyType( U32 type )
boost::end(mExperienceKeys | boost::adaptors::map_values),
std::bind2nd(std::equal_to<U32>(), type));
}
+
+void LLParcel::clearParcelDayCycleInfo()
+{
+ mDayLength = S64Seconds(LLSettingsDay::DEFAULT_DAYLENGTH);
+ mDayOffset = S64Seconds(LLSettingsDay::DEFAULT_DAYOFFSET);
+ mIsDefaultDayCycle = true;
+ mDayCycle.reset();
+ mDayCycleHash = 0;
+}
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 7b4647cc5f..6bbd5a949d 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -591,14 +591,17 @@ public:
BOOL getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; }
BOOL getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? TRUE : FALSE; }
- S64Seconds getDayLength() const { return mDayLength; }
- void setDayLength(S64SecondsImplicit seconds) { mDayLength = seconds; }
- S64Seconds getDayOffset() const { return mDayOffset; }
- void setDayOffset(S64SecondsImplicit seconds) { mDayOffset = seconds; }
- bool getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; }
- void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; }
- LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; }
- void setParcelDayCycle(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 getUsesDefaultDayCycle() const { return mIsDefaultDayCycle; }
+ void setUsesDefaultDayCycle(bool isdefault) { mIsDefaultDayCycle = isdefault; }
+ LLSettingsDay::ptr_t getParcelDayCycle() const { return mDayCycle; }
+ void setParcelDayCycle(const LLSettingsDay::ptr_t &pday) { mDayCycle = pday; }
+ size_t getParcelDayCycleHash() const { return mDayCycleHash; }
+ void setParcelDayCycleHash(size_t hash) { mDayCycleHash = hash; }
+ void clearParcelDayCycleInfo();
protected:
LLUUID mID;
@@ -678,6 +681,7 @@ protected:
S64Seconds mDayOffset;
bool mIsDefaultDayCycle;
LLSettingsDay::ptr_t mDayCycle;
+ size_t mDayCycleHash;
public:
// HACK, make private
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index c7d5c35c60..1b992ff313 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -376,12 +376,12 @@ namespace
LLSD frame = (*itf).second;
std::string ftype = frame[LLSettingsBase::SETTING_TYPE];
+ LL_WARNS("LAPRAS") << "Validating frame: " << frame << LL_ENDL;
if (ftype == "sky")
{
LLSettingsSky::validation_list_t valid_sky = LLSettingsSky::validationList();
LLSD res_sky = LLSettingsSky::settingValidation(frame, valid_sky);
LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_sky << LL_ENDL;
- //_WARNS("SETTINGS") << "success=" << res_sky["success"].asBoolean() << "(" << res_sky["success"].asInteger() << ") res=" << res_sky << LL_ENDL;
if (res_sky["success"].asInteger() == 0)
{
@@ -396,7 +396,6 @@ namespace
LLSettingsWater::validation_list_t valid_h2o = LLSettingsWater::validationList();
LLSD res_h2o = LLSettingsWater::settingValidation(frame, valid_h2o);
LL_WARNS("SETTINGS") << "'" << (*itf).first << "' res=" << res_h2o << LL_ENDL;
- //_WARNS("SETTINGS") << "success=" << res_h2o["success"].asBoolean() << LL_ENDL;
if (res_h2o["success"].asInteger() == 0)
{
LL_WARNS("SETTINGS") << "Water setting named '" << (*itf).first << "' validation failed!: " << res_h2o << LL_ENDL;
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 &regio
( 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 &regio
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
{