SL-11279 [EEP] Automatically toggle the beacon checkboxes
parent
9f2fc2b433
commit
fdf0d49614
|
|
@ -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()),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue