diff options
author | maxim_productengine <mnikolenko@productengine.com> | 2019-05-28 18:06:08 +0300 |
---|---|---|
committer | maxim_productengine <mnikolenko@productengine.com> | 2019-05-28 18:06:08 +0300 |
commit | fdf0d49614b820ffa85d2aa9258e4592bc0e45f3 (patch) | |
tree | 4b99bbed2cbb9e9dd2acced4e4c889090e37c9ac /indra/newview | |
parent | 9f2fc2b433f1c67b85786467ab17ff0b662b90f7 (diff) |
SL-11279 [EEP] Automatically toggle the beacon checkboxes
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llenvironment.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 7 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llfloaterenvironmentadjust.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.h | 1 |
6 files changed, 50 insertions, 2 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 57e6ab7159..a67ba709b0 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -811,7 +811,10 @@ LLEnvironment::LLEnvironment(): mSelectedWater(), mSelectedDay(), mSelectedEnvironment(LLEnvironment::ENV_LOCAL), - mCurrentTrack(1) + mCurrentTrack(1), + mEditorCounter(0), + mShowSunBeacon(false), + mShowMoonBeacon(false) { } @@ -2692,6 +2695,25 @@ void LLEnvironment::DayTransition::animate() }); } +void LLEnvironment::saveBeaconsState() +{ + if (mEditorCounter == 0) + { + mShowSunBeacon = gSavedSettings.getBOOL("sunbeacon"); + mShowMoonBeacon = gSavedSettings.getBOOL("moonbeacon"); + } + ++mEditorCounter; +} +void LLEnvironment::revertBeaconsState() +{ + --mEditorCounter; + if (mEditorCounter == 0) + { + gSavedSettings.setBOOL("sunbeacon", mShowSunBeacon && gSavedSettings.getBOOL("sunbeacon")); + gSavedSettings.setBOOL("moonbeacon", mShowMoonBeacon && gSavedSettings.getBOOL("moonbeacon")); + } +} + //========================================================================= LLTrackBlenderLoopingManual::LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno) : LLSettingsBlender(target, LLSettingsBase::ptr_t(), LLSettingsBase::ptr_t()), diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 327e34d856..0e23693c86 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -169,6 +169,9 @@ public: bool getIsSunUp() const; bool getIsMoonUp() const; + void saveBeaconsState(); + void revertBeaconsState(); + // Returns either sun or moon direction (depending on which is up and stronger) // Light direction in +x right, +z up, +y at internal coord sys LLVector3 getLightDirection() const; // returns sun or moon depending on which is up @@ -382,6 +385,10 @@ private: void onRegionChange(); void onParcelChange(); + bool mShowSunBeacon; + bool mShowMoonBeacon; + S32 mEditorCounter; + struct UpdateInfo { typedef std::shared_ptr<UpdateInfo> ptr_t; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 89c3ca90f0..3870794c63 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -271,6 +271,10 @@ BOOL LLFloaterEditExtDayCycle::postBuild() void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) { + if (!mEditDay) + { + LLEnvironment::instance().saveBeaconsState(); + } mEditDay.reset(); mEditContext = CONTEXT_UNKNOWN; if (key.has(KEY_EDIT_CONTEXT)) @@ -410,10 +414,12 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting) // there's no point to change environment if we're quitting // or if we already restored environment stopPlay(); + LLEnvironment::instance().revertBeaconsState(); if (!app_quitting) { LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_FAST); LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); + mEditDay.reset(); } } diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp index 3d19d560d6..4eb5e03603 100644 --- a/indra/newview/llfloaterenvironmentadjust.cpp +++ b/indra/newview/llfloaterenvironmentadjust.cpp @@ -115,6 +115,10 @@ BOOL LLFloaterEnvironmentAdjust::postBuild() void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key) { + if (!mLiveSky) + { + LLEnvironment::instance().saveBeaconsState(); + } captureCurrentEnvironment(); mEventConnection = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version){ onEnvironmentUpdated(env, version); }); @@ -125,6 +129,7 @@ void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key) void LLFloaterEnvironmentAdjust::onClose(bool app_quitting) { + LLEnvironment::instance().revertBeaconsState(); mEventConnection.disconnect(); mLiveSky.reset(); mLiveWater.reset(); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index f852cc7395..b1fdc2d2a5 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -814,13 +814,20 @@ void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key) // Initialize the settings, take a snapshot of the current water. mSettings = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_CURRENT)->buildClone(); mSettings->setName("Snapshot sky (new)"); - + LLEnvironment::instance().saveBeaconsState(); // TODO: Should we grab water and keep it around for reference? } LLFloaterFixedEnvironment::onOpen(key); } +void LLFloaterFixedEnvironmentSky::onClose(bool app_quitting) +{ + LLEnvironment::instance().revertBeaconsState(); + + LLFloaterFixedEnvironment::onClose(app_quitting); +} + void LLFloaterFixedEnvironmentSky::doImportFromDisk() { // Load a a legacy Windlight XML from disk. (new LLFilePickerReplyThread(boost::bind(&LLFloaterFixedEnvironmentSky::loadSkySettingFromFile, this, _1), LLFilePicker::FFLOAD_XML, false))->getFile(); diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index b27ec4b8e6..84feaa1a20 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -161,6 +161,7 @@ public: BOOL postBuild() override; virtual void onOpen(const LLSD& key) override; + virtual void onClose(bool app_quitting) override; protected: virtual void updateEditEnvironment() override; |