commit
ee229e0f0b
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1613,8 +1619,8 @@ void LLFloaterEditExtDayCycle::setTabsData(LLTabContainer * tabcontainer, const
|
|||
LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabcontainer->getPanelByIndex(idx));
|
||||
if (panel)
|
||||
{
|
||||
panel->setSettings(settings);
|
||||
panel->setCanChangeSettings(editable & mCanMod);
|
||||
panel->setSettings(settings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -214,8 +214,8 @@ void LLFloaterFixedEnvironment::refresh()
|
|||
LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(mTab->getPanelByIndex(idx));
|
||||
if (panel)
|
||||
{
|
||||
panel->refresh();
|
||||
panel->setCanChangeSettings(mCanMod);
|
||||
panel->refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
|
|
@ -851,9 +858,3 @@ void LLFloaterFixedEnvironmentSky::loadSkySettingFromFile(const std::vector<std:
|
|||
}
|
||||
|
||||
//=========================================================================
|
||||
|
||||
void LLSettingsEditPanel::setCanChangeSettings(bool enabled)
|
||||
{
|
||||
setEnabled(enabled);
|
||||
setAllChildrenEnabled(enabled);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -183,7 +184,8 @@ public:
|
|||
inline void setIsDirty() { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
|
||||
inline void clearIsDirty() { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
|
||||
|
||||
virtual void setCanChangeSettings(bool flag);
|
||||
inline bool getCanChangeSettings() const { return mCanEdit; }
|
||||
inline void setCanChangeSettings(bool flag) { mCanEdit = flag; }
|
||||
|
||||
inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb) { return mOnDirtyChanged.connect(cb); }
|
||||
|
||||
|
|
@ -197,6 +199,7 @@ protected:
|
|||
|
||||
private:
|
||||
bool mIsDirty;
|
||||
bool mCanEdit;
|
||||
|
||||
on_dirty_charged_sg mOnDirtyChanged;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -71,11 +71,16 @@ namespace
|
|||
const std::string FIELD_SKY_SUN_ROTATION("sun_rotation");
|
||||
const std::string FIELD_SKY_SUN_IMAGE("sun_image");
|
||||
const std::string FIELD_SKY_SUN_SCALE("sun_scale");
|
||||
const std::string FIELD_SKY_SUN_BEACON("sunbeacon");
|
||||
const std::string FIELD_SKY_MOON_BEACON("moonbeacon");
|
||||
const std::string FIELD_SKY_MOON_ROTATION("moon_rotation");
|
||||
const std::string FIELD_SKY_MOON_IMAGE("moon_image");
|
||||
const std::string FIELD_SKY_MOON_SCALE("moon_scale");
|
||||
const std::string FIELD_SKY_MOON_BRIGHTNESS("moon_brightness");
|
||||
|
||||
const std::string PANEL_SKY_SUN_LAYOUT("sun_layout");
|
||||
const std::string PANEL_SKY_MOON_LAYOUT("moon_layout");
|
||||
|
||||
const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL("rayleigh_exponential");
|
||||
const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE("rayleigh_exponential_scale");
|
||||
const std::string FIELD_SKY_DENSITY_RAYLEIGH_LINEAR("rayleigh_linear");
|
||||
|
|
@ -168,7 +173,7 @@ void LLPanelSettingsSkyAtmosTab::setEnabled(BOOL enabled)
|
|||
|
||||
void LLPanelSettingsSkyAtmosTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
@ -342,7 +347,7 @@ void LLPanelSettingsSkyCloudTab::setEnabled(BOOL enabled)
|
|||
|
||||
void LLPanelSettingsSkyCloudTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
@ -480,15 +485,19 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled)
|
|||
getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setEnabled(enabled);
|
||||
getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setEnabled(enabled);
|
||||
getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setEnabled(enabled);
|
||||
getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(TRUE);
|
||||
getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanelSettingsSkySunMoonTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(FALSE);
|
||||
getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(FALSE);
|
||||
getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(TRUE);
|
||||
getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -654,7 +663,7 @@ void LLPanelSettingsSkyDensityTab::setEnabled(BOOL enabled)
|
|||
|
||||
void LLPanelSettingsSkyDensityTab::refresh()
|
||||
{
|
||||
if (!mSkySettings)
|
||||
if (!mSkySettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void LLPanelSettingsWaterMainTab::setEnabled(BOOL enabled)
|
|||
//==========================================================================
|
||||
void LLPanelSettingsWaterMainTab::refresh()
|
||||
{
|
||||
if (!mWaterSettings)
|
||||
if (!mWaterSettings || !getCanChangeSettings())
|
||||
{
|
||||
setAllChildrenEnabled(FALSE);
|
||||
setEnabled(FALSE);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
auto_resize="true"
|
||||
user_resize="false"
|
||||
visible="true"
|
||||
name="sun_layout"
|
||||
height="400">
|
||||
<text
|
||||
follows="left|top"
|
||||
|
|
@ -209,6 +210,7 @@
|
|||
auto_resize="true"
|
||||
user_resize="false"
|
||||
visible="true"
|
||||
name="moon_layout"
|
||||
height="220">
|
||||
<text
|
||||
follows="left|top"
|
||||
|
|
|
|||
Loading…
Reference in New Issue