diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llenvironment.cpp | 205 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 35 | ||||
-rw-r--r-- | indra/newview/llfloaterland.cpp | 80 | ||||
-rw-r--r-- | indra/newview/llfloaterland.h | 5 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 84 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 156 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_environment.xml | 32 |
7 files changed, 440 insertions, 157 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index b05c9ee871..3451b0efef 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -52,7 +52,7 @@ #include <boost/make_shared.hpp> -#define EXPORT_PRESETS 1 +//define EXPORT_PRESETS 1 //========================================================================= namespace { @@ -154,12 +154,12 @@ void LLEnvironment::onRegionChange() void LLEnvironment::onParcelChange() { - LLUUID parcel_id; + S32 parcel_id(INVALID_PARCEL_ID); LLParcel* parcel = LLViewerParcelMgr::instance().getAgentParcel(); if (parcel) { - parcel_id = parcel->getID(); + parcel_id = parcel->getLocalID(); } requestParcel(parcel_id); @@ -167,7 +167,6 @@ void LLEnvironment::onParcelChange() void LLEnvironment::requestRegionEnvironment() { -// LLEnvironmentRequest::initiate(); requestRegion(); } @@ -243,7 +242,6 @@ void LLEnvironment::update(const LLViewerCamera * cam) if (mCurrentWater) mCurrentWater->update(); - F32 camYaw = cam->getYaw(); stop_glerror(); @@ -485,7 +483,7 @@ void LLEnvironment::selectDayCycle(const std::string &name, F32Seconds transitio void LLEnvironment::selectDayCycle(const LLSettingsDay::ptr_t &daycycle, F32Seconds transition) { - if (!daycycle) + if (!daycycle || (daycycle == mCurrentDay)) { return; } @@ -779,30 +777,81 @@ LLSettingsDay::ptr_t LLEnvironment::findDayCycleByName(std::string name) const } -void LLEnvironment::applyEnvironment(LLSD environment) +void LLEnvironment::selectAgentEnvironment() { - LL_WARNS("ENVIRONMENT") << "Have environment" << LL_ENDL; + S64Seconds day_length(LLSettingsDay::DEFAULT_DAYLENGTH); + S64Seconds day_offset(LLSettingsDay::DEFAULT_DAYOFFSET); + LLSettingsDay::ptr_t pday; - S32 daylength(LLSettingsDay::DEFAULT_DAYLENGTH); - S32 dayoffset(LLSettingsDay::DEFAULT_DAYOFFSET); + // TODO: First test if agent has local environment set. - if (environment.has("day_length")) - daylength = environment["day_length"].asInteger(); - if (environment.has("day_offset")) - dayoffset = environment["day_cycle"].asInteger(); + LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); + LLViewerRegion *pRegion = gAgent.getRegion(); - setDayLength(S64Seconds(daylength)); - setDayOffset(S64Seconds(dayoffset)); + if (!parcel || parcel->getUsesDefaultDayCycle() || !parcel->getParcelDayCycle()) + { + day_length = pRegion->getDayLength(); + day_offset = pRegion->getDayOffset(); + pday = pRegion->getRegionDayCycle(); + } + else + { + day_length = parcel->getDayLength(); + day_offset = parcel->getDayOffset(); + pday = parcel->getParcelDayCycle(); + } - if (environment.has("day_cycle")) + if (getDayLength() != day_length) + setDayLength(day_length); + + if (getDayOffset() != day_offset) + setDayOffset(day_offset); + + 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(environment["day_cycle"]); + LLViewerRegion *pRegion = gAgent.getRegion(); + + if (pRegion) + { + pRegion->setDayLength(envinfo->mDayLength); + pRegion->setDayOffset(envinfo->mDayOffset); + pRegion->setIsDefaultDayCycle(envinfo->mIsDefault); + pRegion->setRegionDayCycle(LLSettingsVODay::buildFromEnvironmentMessage(envinfo->mDaycycleData)); + + /*TODO: track_altitudes*/ + } + } + else + { + LLParcel *parcel = LLViewerParcelMgr::instance().getAgentParcel(); + + if (parcel->getLocalID() == parcel_id) + { + parcel->setDayLength(envinfo->mDayLength); + parcel->setDayOffset(envinfo->mDayOffset); + parcel->setUsesDefaultDayCycle(envinfo->mIsDefault); + + LLSettingsDay::ptr_t pday; + if (!envinfo->mIsDefault) + { + pday = LLSettingsVODay::buildFromEnvironmentMessage(envinfo->mDaycycleData); + } + parcel->setParcelDayCycle(pday); - if (pday) - selectDayCycle(pday); + // select parcel day + } } - /*TODO: track_altitudes*/ + selectAgentEnvironment(); } //========================================================================= @@ -814,7 +863,7 @@ void LLEnvironment::requestRegion() return; } - requestParcel(LLUUID::null); + requestParcel(INVALID_PARCEL_ID); } void LLEnvironment::updateRegion(LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset) @@ -825,42 +874,45 @@ void LLEnvironment::updateRegion(LLSettingsDay::ptr_t &pday, S32 day_length, S32 return; } - updateParcel(LLUUID::null, pday, day_length, day_offset); + updateParcel(INVALID_PARCEL_ID, pday, day_length, day_offset); } void LLEnvironment::resetRegion() { - resetParcel(LLUUID::null); + resetParcel(INVALID_PARCEL_ID); } -void LLEnvironment::requestParcel(const LLUUID &parcel_id) +void LLEnvironment::requestParcel(S32 parcel_id) { + environment_apply_fn apply = boost::bind(&LLEnvironment::recordEnvironment, this, _1, _2); + std::string coroname = LLCoros::instance().launch("LLEnvironment::coroRequestEnvironment", - boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id, - boost::bind(&LLEnvironment::applyEnvironment, this, _1))); + boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id, apply)); } -void LLEnvironment::updateParcel(const LLUUID &parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset) +void LLEnvironment::updateParcel(S32 parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset) { + environment_apply_fn apply = boost::bind(&LLEnvironment::recordEnvironment, this, _1, _2); + std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", boost::bind(&LLEnvironment::coroUpdateEnvironment, this, parcel_id, - pday, day_length, day_offset, - boost::bind(&LLEnvironment::applyEnvironment, this, _1))); + pday, day_length, day_offset, apply)); } -void LLEnvironment::resetParcel(const LLUUID &parcel_id) +void LLEnvironment::resetParcel(S32 parcel_id) { + environment_apply_fn apply = boost::bind(&LLEnvironment::recordEnvironment, this, _1, _2); + std::string coroname = LLCoros::instance().launch("LLEnvironment::coroResetEnvironment", - boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id, - boost::bind(&LLEnvironment::applyEnvironment, this, _1))); + boost::bind(&LLEnvironment::coroResetEnvironment, this, parcel_id, apply)); } -void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id, environment_apply_fn apply) +void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -871,8 +923,17 @@ void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id, environment_apply_f if (url.empty()) return; - if (!parcel_id.isNull()) - url += "?parcelid=" + parcel_id.asString(); + LL_WARNS("LAPRAS") << "Requesting for parcel_id=" << parcel_id << LL_ENDL; + + if (parcel_id != INVALID_PARCEL_ID) + { + std::stringstream query; + + query << "?parcelid=" << parcel_id; + url += query.str(); + } + + LL_WARNS("LAPRAS") << "url=" << url << LL_ENDL; LLSD result = httpAdapter->getAndSuspend(httpRequest, url); // results that come back may contain the new settings @@ -883,7 +944,7 @@ void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id, environment_apply_f LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { - LL_WARNS("WindlightCaps") << "Couldn't retrieve Windlight settings for " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL; + LL_WARNS("WindlightCaps") << "Couldn't retrieve Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; std::stringstream msg; msg << status.toString() << " (Code " << status.toTerseString() << ")"; @@ -896,7 +957,8 @@ void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id, environment_apply_f LLSD environment = result["environment"]; if (environment.isDefined() && !apply.empty()) { - apply(environment); + EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); + apply(parcel_id, envinfo); } } @@ -907,7 +969,7 @@ void LLEnvironment::coroRequestEnvironment(LLUUID parcel_id, environment_apply_f } } -void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset, environment_apply_fn apply) +void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset, LLEnvironment::environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -928,9 +990,17 @@ void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t if (pday) body["environment"]["day_cycle"] = pday->getSettings(); + LL_WARNS("LAPRAS") << "Body = " << body << LL_ENDL; - if (!parcel_id.isNull()) - url += "?parcelid=" + parcel_id.asString(); + if (parcel_id != INVALID_PARCEL_ID) + { + std::stringstream query; + + query << "?parcelid=" << parcel_id; + 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 @@ -941,7 +1011,7 @@ void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { - LL_WARNS("WindlightCaps") << "Couldn't update Windlight settings for " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL; + LL_WARNS("WindlightCaps") << "Couldn't update Windlight settings for " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; std::stringstream msg; msg << status.toString() << " (Code " << status.toTerseString() << ")"; @@ -953,7 +1023,8 @@ void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t LLSD environment = result["environment"]; if (environment.isDefined() && !apply.empty()) { - apply(environment); + EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); + apply(parcel_id, envinfo); } } @@ -964,7 +1035,7 @@ void LLEnvironment::coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t } } -void LLEnvironment::coroResetEnvironment(LLUUID parcel_id, environment_apply_fn apply) +void LLEnvironment::coroResetEnvironment(S32 parcel_id, environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -975,8 +1046,15 @@ void LLEnvironment::coroResetEnvironment(LLUUID parcel_id, environment_apply_fn if (url.empty()) return; - if (!parcel_id.isNull()) - url += "?parcelid=" + parcel_id.asString(); + if (parcel_id != INVALID_PARCEL_ID) + { + std::stringstream query; + + query << "?parcelid=" << parcel_id; + 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 @@ -987,7 +1065,7 @@ void LLEnvironment::coroResetEnvironment(LLUUID parcel_id, environment_apply_fn LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { - LL_WARNS("WindlightCaps") << "Couldn't reset Windlight settings in " << (parcel_id.isNull() ? ("region!") : ("parcel!")) << LL_ENDL; + LL_WARNS("WindlightCaps") << "Couldn't reset Windlight settings in " << ((parcel_id == INVALID_PARCEL_ID) ? ("region!") : ("parcel!")) << LL_ENDL; std::stringstream msg; msg << status.toString() << " (Code " << status.toTerseString() << ")"; @@ -1000,7 +1078,8 @@ void LLEnvironment::coroResetEnvironment(LLUUID parcel_id, environment_apply_fn LLSD environment = result["environment"]; if (environment.isDefined() && !apply.empty()) { - apply(environment); + EnvironmentInfo::ptr_t envinfo = LLEnvironment::EnvironmentInfo::extract(environment); + apply(parcel_id, envinfo); } } @@ -1050,6 +1129,36 @@ void LLEnvironment::UserPrefs::store() } } +LLEnvironment::EnvironmentInfo::EnvironmentInfo(): + mParcelId(), + mDayLength(LLSettingsDay::DEFAULT_DAYLENGTH), + mDayOffset(LLSettingsDay::DEFAULT_DAYOFFSET), + mDaycycleData(), + mAltitudes(), + mIsDefault(false) +{ +} + +LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LLSD environment) +{ + ptr_t pinfo = boost::make_shared<EnvironmentInfo>(); + + if (environment.has("parcel_id")) + pinfo->mParcelId = environment["parcel_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_cycle")) + pinfo->mDaycycleData = environment["day_cycle"]; + if (environment.has("is_default")) + pinfo->mIsDefault = environment["is_default"].asBoolean(); + if (environment.has("track_altitudes")) + pinfo->mAltitudes = environment["track_altitudes"]; + + return pinfo; +} + //========================================================================= // Transitional Code. // static diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 4f8850683e..f5bd9be870 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -54,6 +54,23 @@ public: static const F32Seconds TRANSITION_DEFAULT; static const F32Seconds TRANSITION_SLOW; + struct EnvironmentInfo + { + EnvironmentInfo(); + + typedef boost::shared_ptr<EnvironmentInfo> ptr_t; + + LLUUID mParcelId; + S64Seconds mDayLength; + S64Seconds mDayOffset; + LLSD mDaycycleData; + LLSD mAltitudes; + bool mIsDefault; + + static ptr_t extract(LLSD); + + }; + enum EnvSelection_t { ENV_LOCAL, @@ -99,7 +116,7 @@ public: typedef std::pair<std::string, LLUUID> name_id_t; typedef std::vector<name_id_t> list_name_id_t; typedef boost::signals2::signal<void()> change_signal_t; - typedef boost::function<void(const LLSD &)> environment_apply_fn; + typedef boost::function<void(S32, EnvironmentInfo::ptr_t)> environment_apply_fn; virtual ~LLEnvironment(); @@ -198,9 +215,11 @@ public: void requestRegion(); void updateRegion(LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset); void resetRegion(); - void requestParcel(const LLUUID &parcel_id); - void updateParcel(const LLUUID &parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset); - void resetParcel(const LLUUID &parcel_id); + void requestParcel(S32 parcel_id); + void updateParcel(S32 parcel_id, LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset); + void resetParcel(S32 parcel_id); + + void selectAgentEnvironment(); protected: virtual void initSingleton(); @@ -280,11 +299,11 @@ private: void onRegionChange(); void onParcelChange(); - void coroRequestEnvironment(LLUUID parcel_id, environment_apply_fn apply); - void coroUpdateEnvironment(LLUUID parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset, environment_apply_fn apply); - void coroResetEnvironment(LLUUID parcel_id, environment_apply_fn apply); + void coroRequestEnvironment(S32 parcel_id, environment_apply_fn apply); + void coroUpdateEnvironment(S32 parcel_id, LLSettingsDay::ptr_t pday, S32 day_length, S32 day_offset, environment_apply_fn apply); + void coroResetEnvironment(S32 parcel_id, environment_apply_fn apply); - void applyEnvironment(LLSD environment); + void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment); //========================================================================= void legacyLoadAllPresets(); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index fc4ab0a7a7..5d6e8885de 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -139,31 +139,21 @@ protected: LLPanelExperienceListEditor* mBlocked; }; -#if 0 + class LLPanelLandEnvironment - : public LLPanel + : public LLPanelEnvironmentInfo { public: LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp); - // TODO: LAPRAS -#if 0 + virtual BOOL postBuild(); void refresh(); - void experienceAdded(const LLUUID& id, U32 xp_type, U32 access_type); - void experienceRemoved(const LLUUID& id, U32 access_type); protected: - LLPanelExperienceListEditor* setupList(const char* control_name, U32 xp_type, U32 access_type); - void refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type); LLSafeHandle<LLParcelSelection>& mParcel; - - LLPanelExperienceListEditor* mAllowed; - LLPanelExperienceListEditor* mBlocked; -#endif }; -#endif // inserts maturity info(icon and text) into target textbox // names_floater - pointer to floater which contains strings with maturity icons filenames @@ -346,6 +336,7 @@ void LLFloaterLand::refresh() mPanelAccess->refresh(); mPanelCovenant->refresh(); mPanelExperiences->refresh(); + mPanelEnvironment->refresh(); } @@ -418,7 +409,7 @@ void* LLFloaterLand::createPanelLandExperiences(void* data) void* LLFloaterLand::createPanelLandEnvironment(void* data) { LLFloaterLand* self = (LLFloaterLand*)data; - self->mPanelEnvironment = new LLPanelEnvironmentInfo(/*self->mParcel*/); + self->mPanelEnvironment = new LLPanelLandEnvironment(self->mParcel); return self->mPanelEnvironment; } @@ -3247,3 +3238,64 @@ void LLPanelLandExperiences::refresh() refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED); refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED); } + +//========================================================================= + +LLPanelLandEnvironment::LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp): + LLPanelEnvironmentInfo(), + mParcel(parcelp) +{ +} + +BOOL LLPanelLandEnvironment::postBuild() +{ + if (!LLPanelEnvironmentInfo::postBuild()) + return FALSE; + + mAllowOverRide->setVisible(FALSE); + return TRUE; +} + +void LLPanelLandEnvironment::refresh() +{ + LLParcel* parcel = mParcel->getParcel(); + if (!parcel) + { + mRegionSettingsRadioGroup->setEnabled(FALSE); + mDayLengthSlider->setEnabled(FALSE); + mDayOffsetSlider->setEnabled(FALSE); + mAllowOverRide->setEnabled(FALSE); + + return; + } + + //BOOL owner_or_god = gAgent.isGodlike() || (parcel owner or group) + BOOL owner_or_god = true; + //BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); + + F64Hours daylength; + F64Hours dayoffset; + + daylength = parcel->getDayLength(); + dayoffset = parcel->getDayOffset(); + + if (dayoffset.value() > 12.0) + dayoffset = dayoffset - F32Hours(24.0f); + + mDayLengthSlider->setValue(daylength.value()); + mDayOffsetSlider->setValue(dayoffset.value()); + + mRegionSettingsRadioGroup->setSelectedIndex(parcel->getUsesDefaultDayCycle() ? 0 : 1); + + setControlsEnabled(owner_or_god); + + if (!parcel->getUsesDefaultDayCycle()) + mEditingDayCycle = parcel->getParcelDayCycle()->buildClone(); + else + { + LLViewerRegion* regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion(); + if (regionp) + mEditingDayCycle = regionp->getRegionDayCycle()->buildClone(); + } + +} diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index e5837b5a08..0eea46bc5a 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -67,8 +67,7 @@ class LLPanelLandRenters; class LLPanelLandCovenant; class LLParcel; class LLPanelLandExperiences; -//class LLPanelLandEnvironment; -class LLPanelEnvironmentInfo; +class LLPanelLandEnvironment; class LLFloaterLand : public LLFloater @@ -122,7 +121,7 @@ protected: LLPanelLandAccess* mPanelAccess; LLPanelLandCovenant* mPanelCovenant; LLPanelLandExperiences* mPanelExperiences; - LLPanelEnvironmentInfo *mPanelEnvironment; + LLPanelLandEnvironment *mPanelEnvironment; LLSafeHandle<LLParcelSelection> mParcel; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 5ce682fe8c..578c85470e 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -95,6 +95,7 @@ #include "llexperiencecache.h" #include "llpanelexperiences.h" #include "llcorehttputil.h" +#include "llenvironment.h" const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; @@ -175,6 +176,24 @@ void unpack_request_params( } */ +class LLPanelRegionEnvironment : public LLPanelEnvironmentInfo +{ +public: + LLPanelRegionEnvironment(); + + void refresh(); + + bool refreshFromRegion(LLViewerRegion* region); + + virtual BOOL postBuild(); + +protected: + virtual void doApply(); + +private: + LLViewerRegion * mLastRegion; +}; + bool estate_dispatch_initialized = false; @@ -3345,25 +3364,22 @@ void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id ) } //========================================================================= -class LLPanelRegionEnvironment : public LLPanelEnvironmentInfo -{ -public: - LLPanelRegionEnvironment(); - - void refresh(); - - bool refreshFromRegion(LLViewerRegion* region); - -private: - LLViewerRegion * mLastRegion; -}; - LLPanelRegionEnvironment::LLPanelRegionEnvironment(): LLPanelEnvironmentInfo(), mLastRegion(NULL) { } + +BOOL LLPanelRegionEnvironment::postBuild() +{ + if (!LLPanelEnvironmentInfo::postBuild()) + return FALSE; + + return TRUE; +} + + void LLPanelRegionEnvironment::refresh() { refreshFromRegion(mLastRegion); @@ -3374,12 +3390,50 @@ bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region) BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); - mDayLengthSlider->setValue(region->getDayLength().value()); - mDayOffsetSlider->setValue(region->getDayOffset().value()); + F64Hours daylength; + F64Hours dayoffset; + daylength = region->getDayLength(); + dayoffset = region->getDayOffset(); + + if (dayoffset.value() > 12.0) + dayoffset = dayoffset - F32Hours(24.0f); + + mDayLengthSlider->setValue(daylength.value()); + mDayOffsetSlider->setValue(dayoffset.value()); + mRegionSettingsRadioGroup->setSelectedIndex(region->getIsDefaultDayCycle() ? 0 : 1); setControlsEnabled(owner_or_god_or_manager); mLastRegion = region; + + if (region->getRegionDayCycle()) + mEditingDayCycle = region->getRegionDayCycle()->buildClone(); + return true; } + +void LLPanelRegionEnvironment::doApply() +{ + if (mRegionSettingsRadioGroup->getSelectedIndex() == 0) + { + LLEnvironment::instance().resetRegion(); + } + else + { + S64Seconds daylength; + F32Hours dayoffset_h; + + daylength = F32Hours(mDayLengthSlider->getValueF32()); + dayoffset_h = F32Hours(mDayOffsetSlider->getValueF32()); + + if (dayoffset_h.value() < 0) + { + dayoffset_h = F32Hours(24.0f) + dayoffset_h; + } + + S64Seconds dayoffset_s = dayoffset_h; + + LLEnvironment::instance().updateRegion(mEditingDayCycle, daylength.value(), dayoffset_s.value()); + } +} diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index cd32aa07a8..7756d28879 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -86,6 +86,14 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n newsettings[SETTING_NAME] = name; + LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); + LLSD results = LLSettingsSky::settingValidation(newsettings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL; + LLSettingsSky::ptr_t(); + } + LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsVOSky>(newsettings); #ifdef VERIFY_LEGACY_CONVERSION @@ -100,10 +108,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPreset(const std::string &n #endif - if (skyp->validate()) - return skyp; - - return LLSettingsSky::ptr_t(); + return skyp; } LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky() @@ -111,24 +116,32 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky() LLSD settings = LLSettingsSky::defaults(); settings[SETTING_NAME] = std::string("_default_"); + LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); + LLSD results = LLSettingsSky::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL; + LLSettingsSky::ptr_t(); + } LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsVOSky>(settings); - if (skyp->validate()) - return skyp; - - return LLSettingsSky::ptr_t(); + return skyp; } LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() { LLSD settings = cloneSettings(); - LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsVOSky>(settings); - - if (skyp->validate()) - return skyp; + LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList(); + LLSD results = LLSettingsSky::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Sky setting validation failed!\n" << results << LL_ENDL; + LLSettingsSky::ptr_t(); + } - return LLSettingsSky::ptr_t(); + LLSettingsSky::ptr_t skyp = boost::make_shared<LLSettingsVOSky>(settings); + return skyp; } LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky) @@ -246,6 +259,13 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin LLSD newsettings(LLSettingsWater::translateLegacySettings(legacy)); newsettings[SETTING_NAME] = name; + LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList(); + LLSD results = LLSettingsWater::settingValidation(newsettings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; + LLSettingsWater::ptr_t(); + } LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(newsettings); @@ -260,12 +280,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPreset(const std::strin } #endif - - - if (waterp->validate()) - return waterp; - - return LLSettingsWater::ptr_t(); + return waterp; } LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater() @@ -273,24 +288,33 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater() LLSD settings = LLSettingsWater::defaults(); settings[SETTING_NAME] = std::string("_default_"); - LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(settings); + LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList(); + LLSD results = LLSettingsWater::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; + LLSettingsWater::ptr_t(); + } - if (waterp->validate()) - return waterp; + LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(settings); - return LLSettingsWater::ptr_t(); + return waterp; } LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() { LLSD settings = cloneSettings(); + LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList(); + LLSD results = LLSettingsWater::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; + LLSettingsWater::ptr_t(); + } LLSettingsWater::ptr_t waterp = boost::make_shared<LLSettingsVOWater>(settings); - if (waterp->validate()) - return waterp; - - return LLSettingsWater::ptr_t(); + return waterp; } LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater) @@ -409,6 +433,15 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n newsettings[SETTING_TRACKS] = LLSDArray(watertrack)(skytrack); + LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList(); + LLSD results = LLSettingsDay::settingValidation(newsettings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL; + LLSettingsDay::ptr_t(); + } + + LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(newsettings); #ifdef VERIFY_LEGACY_CONVERSION @@ -423,20 +456,21 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n #endif - if (dayp->validate()) - { - dayp->initialize(); - return dayp; - } + dayp->initialize(); - - - return LLSettingsDay::ptr_t(); + return dayp; } LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®ionId, LLSD daycycle, LLSD skydefs, LLSD waterdef) { LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset("Region", waterdef); + + if (!water) + { + LL_WARNS("WindlightCaps") << "Water construction failed." << LL_ENDL; + return LLSettingsDay::ptr_t(); + } + LLEnvironment::namedSettingMap_t skys; for (LLSD::map_iterator itm = skydefs.beginMap(); itm != skydefs.endMap(); ++itm) @@ -444,6 +478,12 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io std::string name = (*itm).first; LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, (*itm).second); + if (!sky) + { + LL_WARNS("WindlightCaps") << "Sky construction failed." << LL_ENDL; + return LLSettingsDay::ptr_t(); + } + skys[name] = sky; LL_WARNS("WindlightCaps") << "created region sky '" << name << "'" << LL_ENDL; } @@ -468,12 +508,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io dayp->setInitialized(); - if (dayp->validate()) - { - return dayp; - } - - return LLSettingsDay::ptr_t(); + return dayp; } LLSettingsDay::ptr_t LLSettingsVODay::buildDefaultDayCycle() @@ -481,28 +516,34 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDefaultDayCycle() LLSD settings = LLSettingsDay::defaults(); settings[SETTING_NAME] = std::string("_default_"); - LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings); - - if (dayp->validate()) + LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList(); + LLSD results = LLSettingsDay::settingValidation(settings, validations); + if (!results["success"].asBoolean()) { - dayp->initialize(); - return dayp; + LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL; + LLSettingsDay::ptr_t(); } - return LLSettingsDay::ptr_t(); + LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings); + + dayp->initialize(); + return dayp; } LLSettingsDay::ptr_t LLSettingsVODay::buildFromEnvironmentMessage(LLSD settings) { - LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings); - - if (dayp->validate()) + LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList(); + LLSD results = LLSettingsDay::settingValidation(settings, validations); + if (!results["success"].asBoolean()) { - dayp->initialize(); - return dayp; + LL_WARNS("SETTINGS") << "Day setting validation failed!\n" << results << LL_ENDL; + LLSettingsDay::ptr_t(); } - return LLSettingsDay::ptr_t(); + LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings); + + dayp->initialize(); + return dayp; } @@ -510,6 +551,15 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() { LLSD settings = cloneSettings(); + LLSettingsDay::validation_list_t validations = LLSettingsDay::validationList(); + LLSD results = LLSettingsDay::settingValidation(settings, validations); + if (!results["success"].asBoolean()) + { + LL_WARNS("SETTINGS") << "Water setting validation failed!\n" << results << LL_ENDL; + LLSettingsDay::ptr_t(); + } + + LLSettingsDay::ptr_t dayp = boost::make_shared<LLSettingsVODay>(settings); return dayp; diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index a11b9b2d8b..21518338ff 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -10,8 +10,8 @@ name="panel_env_info" width="530"> <layout_stack - left="0" - top="0" + left_offset="0" + top_offset="0" width="420" height="250" follows="left|right|top|bottom" @@ -23,9 +23,9 @@ min_height="130" background_visible="false"> <layout_stack - left="5" - top="5" - right="-5" + left_offset="5" + top_offset="5" + right_offset="-5" follows="left|right|top|bottom" orientation="horizontal"> <layout_panel @@ -59,11 +59,11 @@ name="use_custom_setting"/> </radio_group> <button - follows="top|left" + follows="top|right" height="23" label="Edit Custom" - left_delta="30" - bottom_delta="30" + right_offset="30" + bottom_offset="30" width="100" name="edit_btn"/> @@ -143,10 +143,10 @@ </layout_panel> </layout_stack> </layout_panel> - <layout_panel name="flex" + <layout_panel auto_resize="true" user_resize="true" - height="11" + height="21" min_height="0" background_visible="false"> <check_box @@ -154,20 +154,20 @@ height="16" label="Parcel Owners May Override" layout="topleft" - left="10" - top="10" + left_offset="10" + top_offset="10" name="allow_override_chk" width="200" /> <button - follows="bottom|left" + follows="top|left" height="23" label="Apply" - right="-160" - bottom="-30" + left_offset="160" + top_offset="60" name="apply_btn" width="100" /> <button - follows="bottom|left" + follows="top|left" height="23" label="Cancel" layout="topleft" |