diff options
author | Rider Linden <rider@lindenlab.com> | 2018-10-01 16:10:19 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-10-01 16:10:19 -0700 |
commit | 6e7d794b01673c138a50859c0e513732cb89fc8b (patch) | |
tree | bcfb595114ef05e3902618ed63b66b6d7220e99f /indra/newview | |
parent | ee2720d0a1d9153547a6012d6b31c6bfff4e37a7 (diff) |
MAINT-9738: Wire the altitude slider to the protocol and send new altitudes to simulator.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llenvironment.cpp | 83 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 21 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 24 |
3 files changed, 70 insertions, 58 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 5abb1b2e55..d8bac46151 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -1037,12 +1037,12 @@ void LLEnvironment::requestRegion(environment_apply_fn cb) requestParcel(INVALID_PARCEL_ID, cb); } -void LLEnvironment::updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { - updateParcel(INVALID_PARCEL_ID, pday, day_length, day_offset, cb); + updateParcel(INVALID_PARCEL_ID, pday, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { if (!isExtendedEnvironmentEnabled()) { @@ -1051,17 +1051,17 @@ void LLEnvironment::updateRegion(const LLUUID &asset_id, S32 day_length, S32 day return; } - updateParcel(INVALID_PARCEL_ID, asset_id, day_length, day_offset, cb); + updateParcel(INVALID_PARCEL_ID, asset_id, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { - updateParcel(INVALID_PARCEL_ID, psky, day_length, day_offset, cb); + updateParcel(INVALID_PARCEL_ID, psky, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { - updateParcel(INVALID_PARCEL_ID, pwater, day_length, day_offset, cb); + updateParcel(INVALID_PARCEL_ID, pwater, day_length, day_offset, altitudes, cb); } @@ -1101,15 +1101,15 @@ void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb) [this, parcel_id, cb]() { coroRequestEnvironment(parcel_id, cb); }); } -void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", - [this, parcel_id, asset_id, day_length, day_offset, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK, - LLSettingsDay::ptr_t(), asset_id, day_length, day_offset, cb); }); + [this, parcel_id, asset_id, day_length, day_offset, altitudes, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK, + LLSettingsDay::ptr_t(), asset_id, day_length, day_offset, altitudes, cb); }); } -void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset) +void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes) { if (status) { @@ -1134,27 +1134,27 @@ void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::p return; } - updateParcel(parcel_id, pday, day_length, day_offset); + updateParcel(parcel_id, pday, day_length, day_offset, altitudes); } -void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { LLSettingsDay::ptr_t pday = createDayCycleFromEnvironment((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL, psky); - updateParcel(parcel_id, pday, day_length, day_offset, cb); + updateParcel(parcel_id, pday, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { LLSettingsDay::ptr_t pday = createDayCycleFromEnvironment((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL, pwater); - updateParcel(parcel_id, pday, day_length, day_offset, cb); + updateParcel(parcel_id, pday, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb) +void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", - [this, parcel_id, pday, day_length, day_offset, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK, - pday, LLUUID::null, day_length, day_offset, cb); }); + [this, parcel_id, pday, day_length, day_offset, altitudes, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK, + pday, LLUUID::null, day_length, day_offset, altitudes, cb); }); } @@ -1223,7 +1223,8 @@ void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environ // } } -void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSettingsDay::ptr_t pday, LLUUID settings_asset, S32 day_length, S32 day_offset, LLEnvironment::environment_apply_fn apply) +void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSettingsDay::ptr_t pday, + LLUUID settings_asset, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, LLEnvironment::environment_apply_fn apply) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1234,30 +1235,40 @@ void LLEnvironment::coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSetting if (url.empty()) return; - if (day_length < 1) - { - day_length = getEnvironmentDayLength((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL).value(); - if ((day_length < 1) && (parcel_id != INVALID_PARCEL_ID)) - day_length = getEnvironmentDayLength(ENV_REGION).value(); - } - - if (day_offset < 1) - { - day_offset = getEnvironmentDayOffset((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL).value(); - if ((day_offset < 1) && (parcel_id != INVALID_PARCEL_ID)) - day_offset = getEnvironmentDayOffset(ENV_REGION).value(); - } +// if (day_length < 1) +// { +// day_length = getEnvironmentDayLength((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL).value(); +// if ((day_length < 1) && (parcel_id != INVALID_PARCEL_ID)) +// day_length = getEnvironmentDayLength(ENV_REGION).value(); +// } +// +// if (day_offset < 1) +// { +// day_offset = getEnvironmentDayOffset((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL).value(); +// if ((day_offset < 1) && (parcel_id != INVALID_PARCEL_ID)) +// day_offset = getEnvironmentDayOffset(ENV_REGION).value(); +// } LLSD body(LLSD::emptyMap()); body[KEY_ENVIRONMENT] = LLSD::emptyMap(); if (track_no == NO_TRACK) { // day length and offset are only applicable if we are addressing the entire day cycle. - if (day_length >= 0) + if (day_length > 0) body[KEY_ENVIRONMENT][KEY_DAYLENGTH] = day_length; - if (day_offset >= 0) + if (day_offset > 0) body[KEY_ENVIRONMENT][KEY_DAYOFFSET] = day_offset; + + if ((parcel_id == INVALID_PARCEL_ID) && (altitudes.size() == 3)) + { // only test for altitude changes if we are changing the region. + body[KEY_ENVIRONMENT][KEY_TRACKALTS] = LLSD::emptyArray(); + for (S32 i = 0; i < 3; ++i) + { + body[KEY_ENVIRONMENT][KEY_TRACKALTS][i] = altitudes[i]; + } + } } + if (pday) body[KEY_ENVIRONMENT][KEY_DAYCYCLE] = pday->getSettings(); else if (!settings_asset.isNull()) diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 32a99c4286..a605f791a5 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -139,6 +139,7 @@ public: typedef boost::signals2::signal<void(EnvSelection_t)> env_changed_signal_t; typedef env_changed_signal_t::slot_type env_changed_fn; typedef std::array<F32, 4> altitude_list_t; + typedef std::vector<F32> altitudes_vect_t; virtual ~LLEnvironment(); @@ -229,16 +230,16 @@ public: connection_t setEnvironmentChanged(env_changed_fn cb) { return mSignalEnvChanged.connect(cb); } void requestRegion(environment_apply_fn cb = environment_apply_fn()); - void updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); - void updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); - void updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); - void updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); + void updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void resetRegion(environment_apply_fn cb = environment_apply_fn()); void requestParcel(S32 parcel_id, environment_apply_fn cb = environment_apply_fn()); - void updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); - void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); - void updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); - void updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn()); + void updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void resetParcel(S32 parcel_id, environment_apply_fn cb = environment_apply_fn()); void selectAgentEnvironment(); @@ -364,7 +365,7 @@ private: void onParcelChange(); void coroRequestEnvironment(S32 parcel_id, environment_apply_fn apply); - void coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSettingsDay::ptr_t pday, LLUUID settings_asset, S32 day_length, S32 day_offset, environment_apply_fn apply); + void coroUpdateEnvironment(S32 parcel_id, S32 track_no, LLSettingsDay::ptr_t pday, LLUUID settings_asset, S32 day_length, S32 day_offset, altitudes_vect_t altitudes, environment_apply_fn apply); void coroResetEnvironment(S32 parcel_id, S32 track_no, environment_apply_fn apply); void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment); @@ -372,7 +373,7 @@ private: void onAgentPositionHasChanged(const LLVector3 &localpos); void onSetEnvAssetLoaded(EnvSelection_t env, LLUUID asset_id, LLSettingsBase::ptr_t settings, LLSettingsDay::Seconds daylength, LLSettingsDay::Seconds dayoffset, S32 status); - void onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset); + void onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset, altitudes_vect_t altitudes); }; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 21b9c4edbd..ee27d28140 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -236,10 +236,6 @@ void LLPanelEnvironmentInfo::refresh() updateEditFloater(mCurrentEnvironment, canEdit()); -#if 1 - // hiding the controls until Rider can get the simulator code to adjust altitudes done. - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); -#else LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes(); if (altitudes.size() > 0) { @@ -252,7 +248,6 @@ void LLPanelEnvironmentInfo::refresh() } readjustAltLabels(); } -#endif } @@ -378,12 +373,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(true); getChild<LLUICtrl>(PNL_DISABLED)->setVisible(false); -#if 1 - // hiding the controls until Rider can get the simulator code to adjust altitudes done. - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); -#else getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion()); -#endif S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); @@ -636,9 +626,19 @@ void LLPanelEnvironmentInfo::doApply() if (getIsDirtyFlag(DIRTY_FLAG_MASK)) { LLHandle<LLPanel> that_h = getHandle(); + LLEnvironment::altitudes_vect_t alts; S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) + { + altitudes_data_t::iterator it; + for (auto alt : mAltitudes) + { + alts.push_back(alt.second.mAltitude); + } + } + if (rdo_selection == 0) { LLEnvironment::instance().resetParcel(parcel_id, @@ -647,13 +647,13 @@ void LLPanelEnvironmentInfo::doApply() else if (rdo_selection == 1) { LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } else { LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } |