summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-11-13 09:25:32 -0800
committerGraham Linden <graham@lindenlab.com>2018-11-13 09:25:32 -0800
commit4662ba8a2693780198d555a49a00cfafba838d41 (patch)
tree8695606e3038ee5e5d31f2b7c0c8c1a63fc540d8
parenta49e2b604e6b505e083e24b10e39053196d917c1 (diff)
parentbda785e8b1bef35ecd9d45a7092b0ab66c17d1f4 (diff)
Merge
-rw-r--r--indra/llinventory/llparcel.cpp2
-rw-r--r--indra/llinventory/llparcel.h1
-rw-r--r--indra/newview/llenvironment.cpp14
-rw-r--r--indra/newview/llenvironment.h2
-rw-r--r--indra/newview/llfloaterland.cpp1
-rw-r--r--indra/newview/llfloaterregioninfo.cpp1
-rw-r--r--indra/newview/llpanelenvironment.cpp97
-rw-r--r--indra/newview/llpanelenvironment.h2
-rw-r--r--indra/newview/llviewerparcelmgr.cpp8
-rw-r--r--indra/newview/llviewerparcelmgr.h1
10 files changed, 99 insertions, 30 deletions
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index aff7f86fd4..e2469f3c7e 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -233,7 +233,7 @@ void LLParcel::init(const LLUUID &owner_id,
setHaveNewParcelLimitData(FALSE);
setRegionAllowEnvironmentOverride(FALSE);
- setParcelEnvironmentVersion(-1);
+ setParcelEnvironmentVersion(INVALID_PARCEL_ENVIRONMENT_VERSION);
}
void LLParcel::overrideOwner(const LLUUID& owner_id, BOOL is_group_owned)
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 2497a069d7..9ece9b58e5 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -102,6 +102,7 @@ const U32 RT_LIST = 0x1 << 4;
const U32 RT_SELL = 0x1 << 5;
const S32 INVALID_PARCEL_ID = -1;
+const S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -1;
// Timeouts for parcels
// default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 6bc7b8bf25..530dc79fe9 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -973,7 +973,7 @@ void LLEnvironment::updateShaderUniforms(LLGLSLShader *shader)
}
}
-void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envinfo)
+void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envinfo, LLSettingsBase::Seconds transition)
{
if (envinfo->mParcelId == INVALID_PARCEL_ID)
{
@@ -1027,8 +1027,8 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI
setEnvironment(ENV_PARCEL, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset);
}
}
-
- updateEnvironment();
+
+ updateEnvironment(transition);
}
//=========================================================================
@@ -1078,9 +1078,10 @@ void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb)
{
if (!cb)
{
- cb = [this](S32 pid, EnvironmentInfo::ptr_t envinfo)
+ LLSettingsBase::Seconds transition = LLViewerParcelMgr::getInstance()->getTeleportInProgress() ? TRANSITION_FAST : TRANSITION_DEFAULT;
+ cb = [this, transition](S32 pid, EnvironmentInfo::ptr_t envinfo)
{
- recordEnvironment(pid, envinfo);
+ recordEnvironment(pid, envinfo, transition);
};
}
@@ -1093,7 +1094,8 @@ void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb)
if (!cb)
{
- cb = [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); };
+ LLSettingsBase::Seconds transition = LLViewerParcelMgr::getInstance()->getTeleportInProgress() ? TRANSITION_FAST : TRANSITION_DEFAULT;
+ cb = [this, transition](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo, transition); };
}
std::string coroname =
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index 9e943cce00..a72a08c68e 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -360,7 +360,7 @@ private:
void coroUpdateEnvironment(S32 parcel_id, S32 track_no, UpdateInfo::ptr_t updates, 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);
+ void recordEnvironment(S32 parcel_id, EnvironmentInfo::ptr_t environment, LLSettingsBase::Seconds transition);
void onAgentPositionHasChanged(const LLVector3 &localpos);
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 0ff660fcad..25cbf2f576 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -3325,6 +3325,7 @@ void LLPanelLandEnvironment::refreshFromSource()
LLHandle<LLPanel> that_h = getHandle();
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
LLEnvironment::instance().requestParcel(parcel->getLocalID(),
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
{
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 4fd23252fa..671f5aca9d 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -3450,6 +3450,7 @@ void LLPanelRegionEnvironment::refreshFromSource()
{
LLHandle<LLPanel> that_h = getHandle();
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
LLEnvironment::instance().requestRegion(
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index e848c6eaf1..df595632f8 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -124,6 +124,7 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
mCrossRegion(false),
mNoSelection(false),
mNoEnvironment(false),
+ mCurEnvVersion(INVALID_PARCEL_ENVIRONMENT_VERSION),
mSettingsFloater(),
mEditFloater()
{
@@ -388,20 +389,21 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex();
- getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled);
- getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(enabled && !is_legacy);
+ bool can_enable = enabled && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION;
+ getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setEnabled(can_enable);
+ getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(can_enable && !is_legacy);
getChild<LLUICtrl>(RDO_USEINV)->setEnabled(false); // these two are selected automatically based on
getChild<LLUICtrl>(RDO_USECUSTOM)->setEnabled(false);
getChild<LLUICtrl>(EDT_INVNAME)->setEnabled(FALSE);
- getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(enabled && !is_legacy);
- getChild<LLUICtrl>(BTN_EDIT)->setEnabled(enabled);
- getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy);
- getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy);
- getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy);
- getChild<LLUICtrl>(ICN_GROUND)->setColor((enabled && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f);
- getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy);
- getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy);
- getChild<LLUICtrl>(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0));
+ getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy);
+ getChild<LLUICtrl>(BTN_EDIT)->setEnabled(can_enable);
+ getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy);
+ getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy);
+ getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy);
+ getChild<LLUICtrl>(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f);
+ getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy);
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy);
+ getChild<LLUICtrl>(BTN_APPLY)->setEnabled(can_enable && (mDirtyFlag != 0));
getChild<LLUICtrl>(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0));
getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy);
@@ -429,7 +431,7 @@ void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag)
{
bool can_edit = canEdit();
mDirtyFlag |= flag;
- getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit);
+ getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit);
getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit);
}
@@ -437,7 +439,7 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag)
{
bool can_edit = canEdit();
mDirtyFlag &= ~flag;
- getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit);
+ getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION && can_edit);
getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit);
}
@@ -661,11 +663,19 @@ void LLPanelEnvironmentInfo::doApply()
if (rdo_selection == 0)
{
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
LLEnvironment::instance().resetParcel(parcel_id,
[that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
}
else if (rdo_selection == 1)
{
+ if (!mCurrentEnvironment)
+ {
+ // Attempting to save mid update?
+ LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL;
+ return;
+ }
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
LLEnvironment::instance().updateParcel(parcel_id,
mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(),
mCurrentEnvironment->mDayOffset.value(), alts,
@@ -673,13 +683,18 @@ void LLPanelEnvironmentInfo::doApply()
}
else
{
+ if (!mCurrentEnvironment)
+ {
+ // Attempting to save mid update?
+ LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL;
+ return;
+ }
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
LLEnvironment::instance().updateParcel(parcel_id,
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); });
}
- // Todo: save altitudes once LLEnvironment::setRegionAltitudes() gets implemented
-
setControlsEnabled(false);
}
}
@@ -748,6 +763,12 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday)
LL_WARNS("ENVPANEL") << "Editor committed an empty day. Do nothing." << LL_ENDL;
return;
}
+ if (!mCurrentEnvironment)
+ {
+ // Attempting to save mid update?
+ LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " env version: " << mCurEnvVersion << LL_ENDL;
+ return;
+ }
size_t newhash(newday->getHash());
size_t oldhash((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getHash() : 0);
@@ -761,11 +782,32 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday)
void LLPanelEnvironmentInfo::onEnvironmentChanged(LLEnvironment::EnvSelection_t env)
{
- if ((isRegion() && (env == LLEnvironment::ENV_REGION)) ||
- ((env == LLEnvironment::ENV_PARCEL) && (getParcelId() == LLViewerParcelMgr::instance().getAgentParcelId())))
+ if (isRegion())
{
- mCurrentEnvironment.reset();
- refreshFromSource();
+ // Note: at the moment mCurEnvVersion is only applyable to parcels, we might need separate version control for regions
+ // but mCurEnvVersion still acts like indicator that update is pending
+ if (env == LLEnvironment::ENV_REGION)
+ {
+ mCurrentEnvironment.reset();
+ refreshFromSource();
+ }
+ }
+ else if ((env == LLEnvironment::ENV_PARCEL) && (getParcelId() == LLViewerParcelMgr::instance().getAgentParcelId()))
+ {
+ // Panel receives environment from different sources, from environment update callbacks,
+ // from hovers (causes callbacks on version change) and from personal requests
+ // filter out dupplicates and out of order packets by checking parcel environment version.
+ LL_DEBUGS("ENVPANEL") << "Received environment update " << mCurEnvVersion << " " << (getParcel() ? getParcel()->getParcelEnvironmentVersion() : (S32)-1) << LL_ENDL;
+ LLParcel *parcel = getParcel();
+ if (parcel && mCurEnvVersion < parcel->getParcelEnvironmentVersion())
+ {
+ mCurrentEnvironment.reset();
+ refreshFromSource();
+ }
+ else
+ {
+ refresh();
+ }
}
}
@@ -784,7 +826,7 @@ void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t setti
}
void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
-{
+{
if (parcel_id != getParcelId())
{
LL_WARNS("ENVPANEL") << "Have environment for parcel " << parcel_id << " expecting " << getParcelId() << ". Discarding." << LL_ENDL;
@@ -792,6 +834,21 @@ void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment:
}
mCurrentEnvironment = envifo;
clearDirtyFlag(DIRTY_FLAG_MASK);
+ if (parcel_id == INVALID_PARCEL_ID)
+ {
+ // region, no version
+ mCurEnvVersion = 1;
+ }
+ else
+ {
+ LLParcel* parcel = getParcel();
+ if (parcel)
+ {
+ // not always up to date, we will get onEnvironmentChanged() update in such case.
+ mCurEnvVersion = parcel->getParcelEnvironmentVersion();
+ }
+ LL_DEBUGS("ENVPANEL") << " Setting environment version: " << mCurEnvVersion << LL_ENDL;
+ }
refresh();
}
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index 2c070eb21f..bca7743145 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -160,7 +160,7 @@ protected:
};
typedef std::map<std::string, AltitudeData> altitudes_data_t;
altitudes_data_t mAltitudes;
-
+ S32 mCurEnvVersion;
private:
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 0d077161a6..cca02544ee 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1659,7 +1659,6 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
if (instance->mTeleportInProgress)
{
- instance->mTeleportInProgress = FALSE;
if(instance->mTeleportInProgressPosition.isNull())
{
//initial update
@@ -1674,6 +1673,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
LL_WARNS("LAPRAS") << "Parcel environment version is " << parcel->getParcelEnvironmentVersion() << LL_ENDL;
// Notify anything that wants to know when the agent changes parcels
gAgent.changeParcels();
+ instance->mTeleportInProgress = FALSE;
}
else if (agent_parcel_update)
{
@@ -2576,3 +2576,9 @@ void LLViewerParcelMgr::onTeleportFailed()
{
mTeleportFailedSignal();
}
+
+bool LLViewerParcelMgr::getTeleportInProgress()
+{
+ return mTeleportInProgress // case where parcel data arrives after teleport
+ || gAgent.getTeleportState() > LLAgent::TELEPORT_NONE; // For LOCAL, no mTeleportInProgress
+}
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index 336a3ea228..ec8dde7d40 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -287,6 +287,7 @@ public:
boost::signals2::connection setTeleportFailedCallback(teleport_failed_callback_t cb);
void onTeleportFinished(bool local, const LLVector3d& new_pos);
void onTeleportFailed();
+ bool getTeleportInProgress();
static BOOL isParcelOwnedByAgent(const LLParcel* parcelp, U64 group_proxy_power);
static BOOL isParcelModifiableByAgent(const LLParcel* parcelp, U64 group_proxy_power);