summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-09-19 15:31:23 -0700
committerRider Linden <rider@lindenlab.com>2018-09-19 15:31:23 -0700
commitcae08e0096f75827851a8c9447e163ddb0132f2d (patch)
tree512d05c8082a654569d9602a42e4f0874b39bac2 /indra/newview
parent1ef89151bda78b39f44071cfdbb28f1f0450b436 (diff)
SL-9661: Trigger an event when the settings on a parcel or region are changed. Environment panel montiors this event and updates itself when it occurs.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llenvironment.cpp10
-rw-r--r--indra/newview/llenvironment.h17
-rw-r--r--indra/newview/llpanelenvironment.cpp22
-rw-r--r--indra/newview/llpanelenvironment.h4
-rw-r--r--indra/newview/llviewerparcelmgr.cpp7
-rw-r--r--indra/newview/llviewerparcelmgr.h1
6 files changed, 51 insertions, 10 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index ec2577d053..3d8222a371 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -502,7 +502,9 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSe
environment->setDay(pday, daylength, dayoffset);
environment->setSkyTrack(mCurrentTrack);
environment->animate();
- /*TODO: readjust environment*/
+
+ if (!mSignalEnvChanged.empty())
+ mSignalEnvChanged(env);
}
@@ -519,6 +521,8 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, LLEnvironm
environment->clear();
environment->setSky((fixed.first) ? fixed.first : mEnvironments[ENV_DEFAULT]->getSky());
environment->setWater((fixed.second) ? fixed.second : mEnvironments[ENV_DEFAULT]->getWater());
+ if (!mSignalEnvChanged.empty())
+ mSignalEnvChanged(env);
/*TODO: readjust environment*/
}
@@ -605,6 +609,10 @@ void LLEnvironment::clearEnvironment(LLEnvironment::EnvSelection_t env)
}
mEnvironments[env].reset();
+
+ if (!mSignalEnvChanged.empty())
+ mSignalEnvChanged(env);
+
/*TODO: readjust environment*/
}
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index b5bd353066..32a99c4286 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -135,15 +135,12 @@ public:
};
typedef std::pair<LLSettingsSky::ptr_t, LLSettingsWater::ptr_t> fixedEnvironment_t;
+ typedef std::function<void(S32, EnvironmentInfo::ptr_t)> environment_apply_fn;
+ 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::function<void(S32, EnvironmentInfo::ptr_t)> environment_apply_fn;
-
- typedef boost::signals2::signal<void(EnvSelection_t, const LLSettingsBase::ptr_t &)> environment_changed_signal_t;
- typedef environment_changed_signal_t::slot_type environment_changed_fn;
-
- typedef std::array<F32, 4> altitude_list_t;
-
- virtual ~LLEnvironment();
+ virtual ~LLEnvironment();
void loadPreferences();
void updatePreferences();
@@ -229,7 +226,7 @@ public:
LLSettingsDay::ptr_t createDayCycleFromEnvironment(EnvSelection_t env, LLSettingsBase::ptr_t settings);
//-------------------------------------------
- connection_t setEnvironmentChanged(environment_changed_fn cb);
+ 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());
@@ -350,6 +347,8 @@ private:
LLSettingsBlender::ptr_t mBlenderSky;
LLSettingsBlender::ptr_t mBlenderWater;
+ env_changed_signal_t mSignalEnvChanged;
+
UserPrefs mUserPrefs;
S32 mCurrentTrack;
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index bc06bde138..1beba9db0c 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -125,6 +125,12 @@ LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
{
}
+LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo()
+{
+ if (mChangeMonitor.connected())
+ mChangeMonitor.disconnect();
+}
+
BOOL LLPanelEnvironmentInfo::postBuild()
{
getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onSwitchDefaultSelection(); });
@@ -138,6 +144,8 @@ BOOL LLPanelEnvironmentInfo::postBuild()
getChild<LLMultiSliderCtrl>(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); });
+ mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env) { onEnvironmentChanged(env); });
+
return TRUE;
}
@@ -151,7 +159,9 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key)
void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility)
{
if (new_visibility)
+ {
gIdleCallbacks.addFunction(onIdlePlay, this);
+ }
else
{
LLFloaterSettingsPicker *picker = getSettingsPicker(false);
@@ -164,6 +174,7 @@ void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility)
LLFloaterEditExtDayCycle *dayeditor = getEditFloater();
if (mCommitConnection.connected())
mCommitConnection.disconnect();
+
if (dayeditor)
{
if (dayeditor->isDirty())
@@ -674,6 +685,17 @@ 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())))
+ {
+ mCurrentEnvironment.reset();
+ refreshFromSource();
+ }
+}
+
+
void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t settings)
{
LLSettingsVODay::buildFromOtherSetting(settings, [this](LLSettingsDay::ptr_t pday)
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index a632acfd03..2753e766ac 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -43,6 +43,7 @@ class LLPanelEnvironmentInfo : public LLPanel
{
public:
LLPanelEnvironmentInfo();
+ virtual ~LLPanelEnvironmentInfo();
virtual BOOL postBuild() override;
virtual void onOpen(const LLSD& key) override;
@@ -137,6 +138,8 @@ protected:
LLEnvironment::EnvironmentInfo::ptr_t mCurrentEnvironment;
+ void onEnvironmentChanged(LLEnvironment::EnvSelection_t env);
+
class AltitudeData
{
public:
@@ -162,6 +165,7 @@ private:
typedef boost::signals2::connection connection_t;
connection_t mCommitConnection;
+ connection_t mChangeMonitor;
LLHandle<LLFloater> mSettingsFloater;
LLHandle<LLFloater> mEditFloater;
S32 mDirtyFlag;
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 5a393220c3..c83e27ceed 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1312,6 +1312,13 @@ const std::string& LLViewerParcelMgr::getAgentParcelName() const
}
+const S32 LLViewerParcelMgr::getAgentParcelId() const
+{
+ if (mAgentParcel)
+ return mAgentParcel->getLocalID();
+ return INVALID_PARCEL_ID;
+}
+
void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_agent_region)
{
if(!parcel)
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index 06dae6e57e..336a3ea228 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -263,6 +263,7 @@ public:
// accessors for mAgentParcel
const std::string& getAgentParcelName() const;
+ const S32 getAgentParcelId() const;
// Create a landmark at the "appropriate" location for the
// currently selected parcel.