SL-9667, SL-9669: Do not attempt to request environment for non-eep parcels, use handle to panel passed to static for callbacks.

master
Rider Linden 2018-09-17 14:21:38 -07:00
parent 53a93d3e73
commit 17fb7d0bf4
5 changed files with 40 additions and 9 deletions

View File

@ -586,7 +586,7 @@ void LLFloaterFixedEnvironmentWater::doImportFromDisk()
void LLFloaterFixedEnvironmentWater::loadWaterSettingFromFile(const std::vector<std::string>& filenames)
{
if (filenames.size() < 1) return;
if (filenames.size() < 1) return;
std::string filename = filenames[0];
LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL;
LLSettingsWater::ptr_t legacywater = LLEnvironment::createWaterFromLegacyPreset(filename);
@ -673,7 +673,7 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk()
void LLFloaterFixedEnvironmentSky::loadSkySettingFromFile(const std::vector<std::string>& filenames)
{
if (filenames.size() < 1) return;
if (filenames.size() < 1) return;
std::string filename = filenames[0];
LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL;

View File

@ -3304,6 +3304,14 @@ void LLPanelLandEnvironment::refreshFromSource()
{
LLParcel *parcel = getParcel();
if (!LLEnvironment::instance().isExtendedEnvironmentEnabled())
{
setNoEnvironmentSupport(true);
setControlsEnabled(false);
return;
}
setNoEnvironmentSupport(false);
if (!parcel)
{
setNoSelection(true);
@ -3316,8 +3324,16 @@ void LLPanelLandEnvironment::refreshFromSource()
{
setCrossRegion(false);
LLHandle<LLPanel> that_h = getHandle();
LLEnvironment::instance().requestParcel(parcel->getLocalID(),
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { mLastParcelId = parcel_id; onEnvironmentReceived(parcel_id, envifo); });
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
{
LLPanelLandEnvironment *that = (LLPanelLandEnvironment*)that_h.get();
if (!that) return;
that->mLastParcelId = parcel_id;
that->onEnvironmentReceived(parcel_id, envifo);
});
}
else
{

View File

@ -3447,8 +3447,10 @@ void LLPanelRegionEnvironment::refreshFromEstate()
void LLPanelRegionEnvironment::refreshFromSource()
{
LLHandle<LLPanel> that_h = getHandle();
LLEnvironment::instance().requestRegion(
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
}
void LLPanelRegionEnvironment::doApply()

View File

@ -119,6 +119,7 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
mDirtyFlag(0),
mCrossRegion(false),
mNoSelection(false),
mNoEnvironment(false),
mSettingsFloater(),
mEditFloater()
{
@ -330,7 +331,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
bool is_unavailable(false);
bool is_legacy = (mCurrentEnvironment) ? mCurrentEnvironment->mIsLegacy : true;
if (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion())
if (mNoEnvironment || (!LLEnvironment::instance().isExtendedEnvironmentEnabled() && !isRegion()))
{
is_unavailable = true;
getChild<LLTextBox>(TXT_DISABLED)->setText(getString(STR_LEGACY));
@ -574,24 +575,26 @@ void LLPanelEnvironmentInfo::doApply()
if (getIsDirtyFlag(DIRTY_FLAG_MASK))
{
LLHandle<LLPanel> that_h = getHandle();
S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex();
if (rdo_selection == 0)
{
LLEnvironment::instance().resetParcel(parcel_id,
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
}
else if (rdo_selection == 1)
{
LLEnvironment::instance().updateParcel(parcel_id,
mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(),
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
[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(),
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
}
// Todo: save altitudes once LLEnvironment::setRegionAltitudes() gets implemented
@ -695,3 +698,11 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment:
clearDirtyFlag(DIRTY_FLAG_MASK);
refresh();
}
void LLPanelEnvironmentInfo::_onEnvironmentReceived(LLHandle<LLPanel> that_h, S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
{
LLPanelEnvironmentInfo *that = (LLPanelEnvironmentInfo *)that_h.get();
if (!that)
return;
that->onEnvironmentReceived(parcel_id, envifo);
}

View File

@ -121,6 +121,7 @@ protected:
void onEditCommitted(LLSettingsDay::ptr_t newday);
void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings);
void onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo);
static void _onEnvironmentReceived(LLHandle<LLPanel> that_h, S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo);
virtual void refreshFromSource() = 0;
@ -132,6 +133,7 @@ protected:
void setCrossRegion(bool val) { mCrossRegion = val; }
void setNoSelection(bool val) { mNoSelection = val; }
void setNoEnvironmentSupport(bool val) { mNoEnvironment = val; }
LLEnvironment::EnvironmentInfo::ptr_t mCurrentEnvironment;
@ -165,6 +167,6 @@ private:
S32 mDirtyFlag;
bool mCrossRegion;
bool mNoSelection;
bool mNoEnvironment;
};
#endif // LL_LLPANELEXPERIENCES_H