From cf0e4f79f52b4fb24769aa6e355ec8c95c6d2afc Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 27 Apr 2018 17:12:13 -0700 Subject: Adding fixed water edit dialog. --- indra/newview/llpaneleditwater.cpp | 212 +++++++++++++++++++++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 indra/newview/llpaneleditwater.cpp (limited to 'indra/newview/llpaneleditwater.cpp') diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp new file mode 100644 index 0000000000..08ba198894 --- /dev/null +++ b/indra/newview/llpaneleditwater.cpp @@ -0,0 +1,212 @@ +/** +* @file llpaneleditwater.cpp +* @brief Floaters to create and edit fixed settings for sky and water. +* +* $LicenseInfo:firstyear=2011&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2011, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llpaneleditwater.h" + +#include "llslider.h" +#include "lltexturectrl.h" +#include "llcolorswatch.h" + +namespace +{ + const std::string FIELD_WATER_FOG_COLOR("water_fog_color"); + const std::string FIELD_WATER_FOG_DENSITY("water_fog_density"); + const std::string FIELD_WATER_UNDERWATER_MOD("water_underwater_mod"); + const std::string FIELD_WATER_NORMAL_MAP("water_normal_map"); + + const std::string FIELD_WATER_WAVE1_X("water_wave1_x"); + const std::string FIELD_WATER_WAVE1_Y("water_wave1_y"); + + const std::string FIELD_WATER_WAVE2_X("water_wave2_x"); + const std::string FIELD_WATER_WAVE2_Y("water_wave2_y"); + + const std::string FIELD_WATER_NORMAL_SCALE_X("water_normal_scale_x"); + const std::string FIELD_WATER_NORMAL_SCALE_Y("water_normal_scale_y"); + const std::string FIELD_WATER_NORMAL_SCALE_Z("water_normal_scale_z"); + + const std::string FIELD_WATER_FRESNEL_SCALE("water_fresnel_scale"); + const std::string FIELD_WATER_FRESNEL_OFFSET("water_fresnel_offset"); + + const std::string FIELD_WATER_SCALE_ABOVE("water_scale_above"); + const std::string FIELD_WATER_SCALE_BELOW("water_scale_below"); + const std::string FIELD_WATER_BLUR_MULTIP("water_blur_multip"); +} + +//========================================================================== +LLPanelSettingsWater::LLPanelSettingsWater() : + LLSettingsEditPanel(), + mWaterSettings() +{ + +} + + +//========================================================================== +LLPanelSettingsWaterMainTab::LLPanelSettingsWaterMainTab(): + LLPanelSettingsWater(), + mClrFogColor(nullptr), + mTxtNormalMap(nullptr) +{ +} + + +BOOL LLPanelSettingsWaterMainTab::postBuild() +{ + mClrFogColor = getChild(FIELD_WATER_FOG_COLOR); + mTxtNormalMap = getChild(FIELD_WATER_NORMAL_MAP); + + + mClrFogColor->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogColorChanged(); }); + getChild(FIELD_WATER_FOG_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogDensityChanged(); }); +// getChild(FIELD_WATER_FOG_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogDensityChanged(getChild(FIELD_WATER_FOG_DENSITY)->getValue().asReal()); }); + getChild(FIELD_WATER_UNDERWATER_MOD)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogUnderWaterChanged(); }); + mTxtNormalMap->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalMapChanged(); }); + + getChild(FIELD_WATER_WAVE1_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLargeWaveChanged(); }); + getChild(FIELD_WATER_WAVE1_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLargeWaveChanged(); }); + + getChild(FIELD_WATER_WAVE2_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSmallWaveChanged(); }); + getChild(FIELD_WATER_WAVE2_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSmallWaveChanged(); }); + + getChild(FIELD_WATER_NORMAL_SCALE_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalScaleChanged(); }); + getChild(FIELD_WATER_NORMAL_SCALE_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalScaleChanged(); }); + getChild(FIELD_WATER_NORMAL_SCALE_Z)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalScaleChanged(); }); + + getChild(FIELD_WATER_FRESNEL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFresnelScaleChanged(); }); + getChild(FIELD_WATER_FRESNEL_OFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFresnelOffsetChanged(); }); + getChild(FIELD_WATER_SCALE_ABOVE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onScaleAboveChanged(); }); + getChild(FIELD_WATER_SCALE_BELOW)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onScaleBelowChanged(); }); + getChild(FIELD_WATER_BLUR_MULTIP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onBlurMultipChanged(); }); + + refresh(); + + return TRUE; +} + +//========================================================================== +void LLPanelSettingsWaterMainTab::refresh() +{ + if (!mWaterSettings) + { + setAllChildrenEnabled(FALSE); + setEnabled(FALSE); + return; + } + + setEnabled(TRUE); + setAllChildrenEnabled(TRUE); + mClrFogColor->set(mWaterSettings->getFogColor()); + getChild(FIELD_WATER_FOG_DENSITY)->setValue(mWaterSettings->getFogDensity()); + getChild(FIELD_WATER_UNDERWATER_MOD)->setValue(mWaterSettings->getFogMod()); + mTxtNormalMap->setValue(mWaterSettings->getNormalMapID()); + LLVector2 vect2 = mWaterSettings->getWave1Dir(); + getChild(FIELD_WATER_WAVE1_X)->setValue(vect2[0]); + getChild(FIELD_WATER_WAVE1_Y)->setValue(vect2[1]); + vect2 = mWaterSettings->getWave2Dir(); + getChild(FIELD_WATER_WAVE2_X)->setValue(vect2[0]); + getChild(FIELD_WATER_WAVE2_Y)->setValue(vect2[1]); + LLVector3 vect3 = mWaterSettings->getNormalScale(); + getChild(FIELD_WATER_NORMAL_SCALE_X)->setValue(vect3[0]); + getChild(FIELD_WATER_NORMAL_SCALE_Y)->setValue(vect3[1]); + getChild(FIELD_WATER_NORMAL_SCALE_Z)->setValue(vect3[2]); + getChild(FIELD_WATER_FRESNEL_SCALE)->setValue(mWaterSettings->getFresnelOffset()); + getChild(FIELD_WATER_FRESNEL_OFFSET)->setValue(mWaterSettings->getFresnelOffset()); + getChild(FIELD_WATER_SCALE_ABOVE)->setValue(mWaterSettings->getScaleAbove()); + getChild(FIELD_WATER_SCALE_BELOW)->setValue(mWaterSettings->getScaleBelow()); + getChild(FIELD_WATER_BLUR_MULTIP)->setValue(mWaterSettings->getBlurMultiplier()); +} + +//========================================================================== + +void LLPanelSettingsWaterMainTab::onFogColorChanged() +{ + mWaterSettings->setFogColor(LLColor3(mClrFogColor->get())); +} + +void LLPanelSettingsWaterMainTab::onFogDensityChanged() +{ + mWaterSettings->setFogDensity(getChild(FIELD_WATER_FOG_DENSITY)->getValue().asReal()); +} + +void LLPanelSettingsWaterMainTab::onFogUnderWaterChanged() +{ + mWaterSettings->setFogMod(getChild(FIELD_WATER_UNDERWATER_MOD)->getValue().asReal()); +} + +void LLPanelSettingsWaterMainTab::onNormalMapChanged() +{ + mWaterSettings->setNormalMapID(mTxtNormalMap->getImageAssetID()); +} + + +void LLPanelSettingsWaterMainTab::onLargeWaveChanged() +{ + LLVector2 vect(getChild(FIELD_WATER_WAVE1_X)->getValue().asReal(), getChild(FIELD_WATER_WAVE1_Y)->getValue().asReal()); + LL_WARNS("LAPRAS") << "Changing Large Wave from " << mWaterSettings->getWave1Dir() << " -> " << vect << LL_ENDL; + mWaterSettings->setWave1Dir(vect); +} + +void LLPanelSettingsWaterMainTab::onSmallWaveChanged() +{ + LLVector2 vect(getChild(FIELD_WATER_WAVE2_X)->getValue().asReal(), getChild(FIELD_WATER_WAVE2_Y)->getValue().asReal()); + LL_WARNS("LAPRAS") << "Changing Small Wave from " << mWaterSettings->getWave2Dir() << " -> " << vect << LL_ENDL; + mWaterSettings->setWave2Dir(vect); +} + + +void LLPanelSettingsWaterMainTab::onNormalScaleChanged() +{ + LLVector3 vect(getChild(FIELD_WATER_NORMAL_SCALE_X)->getValue().asReal(), getChild(FIELD_WATER_NORMAL_SCALE_Y)->getValue().asReal(), getChild(FIELD_WATER_NORMAL_SCALE_Z)->getValue().asReal()); + LL_WARNS("LAPRAS") << "Changing normal scale from " << mWaterSettings->getNormalScale() << " -> " << vect << LL_ENDL; + mWaterSettings->setNormalScale(vect); +} + +void LLPanelSettingsWaterMainTab::onFresnelScaleChanged() +{ + mWaterSettings->setFresnelScale(getChild(FIELD_WATER_FRESNEL_SCALE)->getValue().asReal()); +} + +void LLPanelSettingsWaterMainTab::onFresnelOffsetChanged() +{ + mWaterSettings->setFresnelOffset(getChild(FIELD_WATER_FRESNEL_OFFSET)->getValue().asReal()); +} + +void LLPanelSettingsWaterMainTab::onScaleAboveChanged() +{ + mWaterSettings->setScaleAbove(getChild(FIELD_WATER_SCALE_ABOVE)->getValue().asReal()); +} + +void LLPanelSettingsWaterMainTab::onScaleBelowChanged() +{ + mWaterSettings->setScaleBelow(getChild(FIELD_WATER_SCALE_BELOW)->getValue().asReal()); +} + +void LLPanelSettingsWaterMainTab::onBlurMultipChanged() +{ + mWaterSettings->setBlurMultiplier(getChild(FIELD_WATER_BLUR_MULTIP)->getValue().asReal()); +} -- cgit v1.3 From 438609699b838924becee89fa9d8ec83552f3236 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Mon, 30 Apr 2018 16:37:08 -0700 Subject: New water settings dialog. --- indra/newview/llenvironment.cpp | 35 ++++++++- indra/newview/llenvironment.h | 9 ++- indra/newview/llfloaterfixedenvironment.cpp | 115 +++++++++++++++++++++++++--- indra/newview/llfloaterfixedenvironment.h | 27 +++++-- indra/newview/llpaneleditwater.cpp | 3 +- 5 files changed, 167 insertions(+), 22 deletions(-) (limited to 'indra/newview/llpaneleditwater.cpp') diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 214ebb82b0..50f3f4f979 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -202,10 +202,10 @@ bool LLEnvironment::getIsDayTime() const } //------------------------------------------------------------------------- -void LLEnvironment::setSelectedEnvironment(LLEnvironment::EnvSelection_t env, F64Seconds transition) +void LLEnvironment::setSelectedEnvironment(LLEnvironment::EnvSelection_t env, F64Seconds transition, bool forced) { mSelectedEnvironment = env; - updateEnvironment(transition); + updateEnvironment(transition, forced); } bool LLEnvironment::hasEnvironment(LLEnvironment::EnvSelection_t env) @@ -337,6 +337,9 @@ LLEnvironment::fixedEnvironment_t LLEnvironment::getEnvironmentFixed(LLEnvironme if (fixed.first && fixed.second) break; + if (idx == ENV_EDIT) + continue; // skip the edit environment. + DayInstance::ptr_t environment = getEnvironmentInstance(static_cast(idx)); if (environment) { @@ -379,11 +382,11 @@ LLEnvironment::DayInstance::ptr_t LLEnvironment::getSelectedEnvironmentInstance( } -void LLEnvironment::updateEnvironment(F64Seconds transition) +void LLEnvironment::updateEnvironment(F64Seconds transition, bool forced) { DayInstance::ptr_t pinstance = getSelectedEnvironmentInstance(); - if (mCurrentEnvironment != pinstance) + if ((mCurrentEnvironment != pinstance) || forced) { DayInstance::ptr_t trans = std::make_shared( mCurrentEnvironment->getSky(), mCurrentEnvironment->getWater(), pinstance, transition); @@ -1067,6 +1070,30 @@ std::string LLEnvironment::getUserDir(const std::string &subdir) return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "windlight\\"+subdir, ""); } +LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::string filename) +{ + LLSD data = legacyLoadPreset(filename); + if (!data) + return LLSettingsWater::ptr_t(); + + std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true)); + LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPreset(name, data); + + return water; +} + +LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string filename) +{ + LLSD data = legacyLoadPreset(filename); + if (!data) + return LLSettingsSky::ptr_t(); + + std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true)); + LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPreset(name, data); + + return sky; +} + LLSD LLEnvironment::legacyLoadPreset(const std::string& path) { llifstream xml_file; diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 95b24314cb..cb6cd11608 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -143,7 +143,7 @@ public: void updateGLVariablesForSettings(LLGLSLShader *shader, const LLSettingsBase::ptr_t &psetting); void updateShaderUniforms(LLGLSLShader *shader); - void setSelectedEnvironment(EnvSelection_t env, F64Seconds transition = TRANSITION_DEFAULT); + void setSelectedEnvironment(EnvSelection_t env, F64Seconds transition = TRANSITION_DEFAULT, bool forced = false); EnvSelection_t getSelectedEnvironment() const { return mSelectedEnvironment; } bool hasEnvironment(EnvSelection_t env); @@ -159,7 +159,7 @@ public: LLSettingsSky::ptr_t getEnvironmentFixedSky(EnvSelection_t env) { return getEnvironmentFixed(env).first; }; LLSettingsWater::ptr_t getEnvironmentFixedWater(EnvSelection_t env) { return getEnvironmentFixed(env).second; }; - void updateEnvironment(F64Seconds transition = TRANSITION_DEFAULT); + void updateEnvironment(F64Seconds transition = TRANSITION_DEFAULT, bool forced = false); void addSky(const LLSettingsSky::ptr_t &sky); void addWater(const LLSettingsWater::ptr_t &sky); @@ -187,6 +187,9 @@ public: inline LLVector4 getClampedLightDirection() const { return LLVector4(mCurrentEnvironment->getSky()->getClampedLightDirection(), 0.0f); } inline LLVector4 getRotatedLight() const { return mRotatedLight; } + static LLSettingsWater::ptr_t createWaterFromLegacyPreset(const std::string filename); + static LLSettingsSky::ptr_t createSkyFromLegacyPreset(const std::string filename); + //------------------------------------------- connection_t setSkyListChange(const change_signal_t::slot_type& cb); connection_t setWaterListChange(const change_signal_t::slot_type& cb); @@ -356,7 +359,7 @@ private: void onTransitionDone(const LLSettingsBlender::ptr_t, bool isSky); //========================================================================= void legacyLoadAllPresets(); - LLSD legacyLoadPreset(const std::string& path); + static LLSD legacyLoadPreset(const std::string& path); static std::string getSysDir(const std::string &subdir); static std::string getUserDir(const std::string &subdir); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index d5162ef622..6c883b2534 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -36,6 +36,7 @@ #include "llnotificationsutil.h" #include "llsliderctrl.h" #include "lltabcontainer.h" +#include "llfilepicker.h" // newview #include "llpaneleditwater.h" @@ -44,6 +45,9 @@ #include "llsettingswater.h" #include "llenvironment.h" +#include "llagent.h" + +#include "llsettingsvo.h" namespace { @@ -70,22 +74,41 @@ BOOL LLFloaterFixedEnvironment::postBuild() mTxtName->setCommitOnFocusLost(TRUE); mTxtName->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNameChanged(mTxtName->getValue().asString()); }); + getChild(BUTTON_NAME_LOAD)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonLoad(); }); + getChild(BUTTON_NAME_IMPORT)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonImport(); }); + getChild(BUTTON_NAME_COMMIT)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonApply(); }); + getChild(BUTTON_NAME_CANCEL)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonCancel(); }); + return TRUE; } void LLFloaterFixedEnvironment::onFocusReceived() { updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); } void LLFloaterFixedEnvironment::onFocusLost() { + // *TODO*: If the window receiving focus is from a select color or select image control... + // We have technically not changed out of what we are doing so don't change back to displaying + // the local environment. (unfortunately the focus manager has LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } void LLFloaterFixedEnvironment::refresh() { + if (!mSettings) + { + // disable everything. + return; + } + + bool enableApplyAndLoad = canUseInventory(); + + getChild(BUTTON_NAME_LOAD)->setEnabled(enableApplyAndLoad); + getChild(BUTTON_NAME_COMMIT)->setEnabled(enableApplyAndLoad); + mTxtName->setValue(mSettings->getName()); S32 count = mTab->getTabCount(); @@ -115,6 +138,33 @@ void LLFloaterFixedEnvironment::onNameChanged(const std::string &name) mSettings->setName(name); } +void LLFloaterFixedEnvironment::onButtonLoad() +{ + doLoadFromInventory(); +} + +void LLFloaterFixedEnvironment::onButtonImport() +{ + doImportFromDisk(); +} + +void LLFloaterFixedEnvironment::onButtonApply() +{ + doApplyFixedSettings(); +} + +void LLFloaterFixedEnvironment::onButtonCancel() +{ + // *TODO*: If changed issue a warning? + this->closeFloater(); +} + +//------------------------------------------------------------------------- +bool LLFloaterFixedEnvironment::canUseInventory() const +{ + return !gAgent.getRegionCapability("UpdateSettingsAgentInventory").empty(); +} + //========================================================================= LLFloaterFixedEnvironmentWater::LLFloaterFixedEnvironmentWater(const LLSD &key): LLFloaterFixedEnvironment(key) @@ -131,22 +181,69 @@ BOOL LLFloaterFixedEnvironmentWater::postBuild() panel->setWater(std::static_pointer_cast(mSettings)); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); - // Initialize the settings, take a snapshot of the current water. - mSettings = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_CURRENT)->buildClone(); + return TRUE; +} - mSettings->setName("Snapshot water (new)"); +void LLFloaterFixedEnvironmentWater::updateEditEnvironment(void) +{ + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, + std::static_pointer_cast(mSettings)); +} - mTxtName->setValue(mSettings->getName()); +void LLFloaterFixedEnvironmentWater::onOpen(const LLSD& key) +{ + if (!mSettings) + { + // Initialize the settings, take a snapshot of the current water. + mSettings = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_CURRENT)->buildClone(); + mSettings->setName("Snapshot water (new)"); + // TODO: Should we grab sky and keep it around for reference? + } + + updateEditEnvironment(); syncronizeTabs(); refresh(); - return TRUE; + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_FAST); } -void LLFloaterFixedEnvironmentWater::updateEditEnvironment(void) +void LLFloaterFixedEnvironmentWater::onClose(bool app_quitting) { - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, - std::static_pointer_cast(mSettings)); + mSettings.reset(); + syncronizeTabs(); +} + +void LLFloaterFixedEnvironmentWater::doLoadFromInventory() +{ + +} + +void LLFloaterFixedEnvironmentWater::doImportFromDisk() +{ // Load a a legacy Windlight XML from disk. + + LLFilePicker& picker = LLFilePicker::instance(); + if (picker.getOpenFile(LLFilePicker::FFLOAD_XML)) + { + std::string filename = picker.getFirstFile(); + + LL_WARNS("LAPRAS") << "Selected file: " << filename << LL_ENDL; + LLSettingsWater::ptr_t legacywater = LLEnvironment::createWaterFromLegacyPreset(filename); + + if (!legacywater) + { // *TODO* Put up error dialog here. Could not create water from filename + return; + } + + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacywater); + this->setEditSettings(legacywater); + LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST, true); + } +} + +void LLFloaterFixedEnvironmentWater::doApplyFixedSettings() +{ + LLSettingsVOBase::createInventoryItem(mSettings); + } //========================================================================= diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 0d2d21533e..9eb03e0b3a 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -49,7 +49,7 @@ public: virtual void onFocusReceived() override; virtual void onFocusLost() override; - void setEditSettings(LLSettingsBase::ptr_t &settings) { mSettings = settings; syncronizeTabs(); } + void setEditSettings(const LLSettingsBase::ptr_t &settings) { mSettings = settings; syncronizeTabs(); refresh(); } LLSettingsBase::ptr_t getEditSettings() const { return mSettings; } protected: @@ -63,9 +63,19 @@ protected: LLSettingsBase::ptr_t mSettings; + virtual void doLoadFromInventory() = 0; + virtual void doImportFromDisk() = 0; + virtual void doApplyFixedSettings() = 0; + + bool canUseInventory() const; private: - void onNameChanged(const std::string &name); + void onNameChanged(const std::string &name); + + void onButtonLoad(); + void onButtonImport(); + void onButtonApply(); + void onButtonCancel(); #if 0 @@ -146,10 +156,17 @@ class LLFloaterFixedEnvironmentWater : public LLFloaterFixedEnvironment public: LLFloaterFixedEnvironmentWater(const LLSD &key); - BOOL postBuild() override; + BOOL postBuild() override; + + virtual void onOpen(const LLSD& key) override; + virtual void onClose(bool app_quitting) override; + +protected: + virtual void updateEditEnvironment() override; -protected: - virtual void updateEditEnvironment() override; + virtual void doLoadFromInventory() override; + virtual void doImportFromDisk() override; + virtual void doApplyFixedSettings() override; private: }; diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index 08ba198894..3cb1dcfda4 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -80,11 +80,12 @@ BOOL LLPanelSettingsWaterMainTab::postBuild() mClrFogColor = getChild(FIELD_WATER_FOG_COLOR); mTxtNormalMap = getChild(FIELD_WATER_NORMAL_MAP); - mClrFogColor->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogColorChanged(); }); getChild(FIELD_WATER_FOG_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogDensityChanged(); }); // getChild(FIELD_WATER_FOG_DENSITY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogDensityChanged(getChild(FIELD_WATER_FOG_DENSITY)->getValue().asReal()); }); getChild(FIELD_WATER_UNDERWATER_MOD)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogUnderWaterChanged(); }); + + mTxtNormalMap->setDefaultImageAssetID(LLSettingsWater::DEFAULT_WATER_NORMAL_ID); mTxtNormalMap->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalMapChanged(); }); getChild(FIELD_WATER_WAVE1_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLargeWaveChanged(); }); -- cgit v1.3 From 28d0fa0c69cc5d45844f9f542d99d04bbded16ad Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 16 May 2018 20:25:42 +0300 Subject: MAINT-8344 Day cycle editor (part 2) --- indra/llinventory/llsettingsdaycycle.cpp | 47 ++++ indra/llinventory/llsettingsdaycycle.h | 2 + indra/newview/llfloatereditextdaycycle.cpp | 306 ++++++++++++--------- indra/newview/llfloatereditextdaycycle.h | 43 ++- indra/newview/llpaneleditsky.cpp | 4 + indra/newview/llpaneleditwater.cpp | 2 + .../default/xui/en/floater_edit_ext_day_cycle.xml | 152 +++++----- .../default/xui/en/panel_settings_sky_atmos.xml | 5 +- .../default/xui/en/panel_settings_sky_clouds.xml | 3 +- .../default/xui/en/panel_settings_sky_sunmoon.xml | 3 +- .../skins/default/xui/en/panel_settings_water.xml | 3 +- 11 files changed, 330 insertions(+), 240 deletions(-) (limited to 'indra/newview/llpaneleditwater.cpp') diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 3f60430715..5a6280884d 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -502,6 +502,53 @@ LLSettingsDay::KeyframeList_t LLSettingsDay::getTrackKeyframes(S32 trackno) return keyframes; } +bool LLSettingsDay::moveTrackKeyframe(S32 trackno, F32 old_frame, F32 new_frame) +{ + if ((trackno < 0) || (trackno >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt get track (#" << trackno << ") out of range!" << LL_ENDL; + return false; + } + + if (old_frame == new_frame) + { + return false; + } + + CycleTrack_t &track = mDayTracks[trackno]; + CycleTrack_t::iterator iter = track.find(old_frame); + if (iter != track.end()) + { + LLSettingsBase::ptr_t base = iter->second; + track.erase(iter); + track[llclamp(new_frame, 0.0f, 1.0f)] = base; + return true; + } + + return false; + +} + +bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame) +{ + if ((trackno < 0) || (trackno >= TRACK_MAX)) + { + LL_WARNS("DAYCYCLE") << "Attempt get track (#" << trackno << ") out of range!" << LL_ENDL; + return false; + } + + CycleTrack_t &track = mDayTracks[trackno]; + CycleTrack_t::iterator iter = track.find(frame); + if (iter != track.end()) + { + LLSettingsBase::ptr_t base = iter->second; + track.erase(iter); + return true; + } + + return false; +} + void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe) { mDayTracks[TRACK_WATER][llclamp(keyframe, 0.0f, 1.0f)] = water; diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h index 93c275bfb8..a869d4970c 100644 --- a/indra/llinventory/llsettingsdaycycle.h +++ b/indra/llinventory/llsettingsdaycycle.h @@ -86,6 +86,8 @@ public: //--------------------------------------------------------------------- KeyframeList_t getTrackKeyframes(S32 track); + bool moveTrackKeyframe(S32 track, F32 old_frame, F32 new_frame); + bool removeTrackKeyframe(S32 track, F32 frame); void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe); const LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index e41259feb3..c57add32fe 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -52,22 +52,24 @@ #include "lltrans.h" static const std::string track_tabs[] = { - "water_track", - "sky4_track", - "sky3_track", - "sky2_track", - "sky1_track", - }; + "water_track", + "sky1_track", + "sky2_track", + "sky3_track", + "sky4_track", +}; LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): LLFloater(key), mSaveButton(NULL), mCancelButton(NULL), - mCurrentTrack(1) -// mDayCyclesCombo(NULL) -// , mTimeSlider(NULL) -// , mKeysSlider(NULL) + mDayLength(0), + mDayOffset(0), + mCurrentTrack(4), + mTimeSlider(NULL), + mFramesSlider(NULL), + mCurrentTimeLabel(NULL) // , mTimeCtrl(NULL) // , mMakeDefaultCheckBox(NULL) // , @@ -82,24 +84,24 @@ BOOL LLFloaterEditExtDayCycle::postBuild() getChild("delete_frame")->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onRemoveTrack, this)); getChild("day_cycle_name")->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onCommitName, this, _1, _2), NULL); -// mDayCyclesCombo = getChild("day_cycle_preset_combo"); - -// mTimeSlider = getChild("WLTimeSlider"); -// mKeysSlider = getChild("WLDayCycleKeys"); -// mTimeCtrl = getChild("time"); mSaveButton = getChild("save_btn", true); mCancelButton = getChild("cancel_btn", true); mUploadButton = getChild("upload_btn", true); - mKeysSlider = getChild("WLDayCycleKeys"); - mSkyTabContainer = getChild("frame_settings_sky", true); - mWaterTabContainer = getChild("frame_settings_water", true); -// mMakeDefaultCheckBox = getChild("make_default_cb"); + mTimeSlider = getChild("WLTimeSlider"); + mFramesSlider = getChild("WLDayCycleFrames"); + mSkyTabLayoutContainer = getChild("frame_settings_sky", true); + mWaterTabLayoutContainer = getChild("frame_settings_water", true); + mCurrentTimeLabel = getChild("current_time", true); //initCallbacks(); mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnSave, this)); mCancelButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnCancel, this)); mUploadButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onUpload, this)); + mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onTimeSliderMoved, this)); + mFramesSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onFrameSliderCallback, this)); + + mTimeSlider->addSlider(0); getChild("sky4_track", true)->setToggleState(true); @@ -115,8 +117,14 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) { // TODO/TEMP - LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_REGION); + LLEnvironment::EnvSelection_t env = LLEnvironment::ENV_REGION; // should not be used + LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(env); mEditDay = pday->buildClone(); // pday should be passed as parameter + + S64Seconds daylength = LLEnvironment::instance().getEnvironmentDayLength(env); + S64Seconds dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(env); + mDayLength = daylength; // should be passed as parameter + mDayOffset = dayoffset; // should be passed as parameter } LLLineEditor* name_field = getChild("day_cycle_name"); @@ -124,35 +132,34 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) selectTrack(mCurrentTrack); - /* TODO - if (mEditDay->hasSetting("cycle length")) // todo: figure out name + // time labels + mCurrentTimeLabel->setTextArg("[PRCNT]", std::string("0")); + const S32 max_elm = 5; + if (mDayLength.value() != 0) { - // extract setting - S32 extracted_time = - std::string time = LLTrans::getString("time_label", LLSD("TIME",(extracted_time * 0..100%) + offset)); - std::string descr = LLTrans::getString("0_label", LLSD("DSC",time)); - getChild("p0")->setLabel(descr); - ... - - getChild("p1")->setLabel(descr); - time = - descr = - getChild("p2")->setLabel(descr); - time = - descr = - getChild("p3")->setLabel(descr); - time = - descr = - getChild("p4")->setLabel(descr); + F32Hours hrs; + LLUIString formatted_label = getString("time_label"); + for (int i = 0; i < max_elm; i++) + { + // Todo: if possible, find a better way, both to get string and child names + hrs = ((mDayLength / (max_elm - 1)) * i) + mDayOffset; + formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value())); + getChild("p" + llformat("%d", i), true)->setTextArg("[DSC]", formatted_label.getString()); + } + hrs = mDayOffset; + formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value())); + mCurrentTimeLabel->setTextArg("[DSC]", formatted_label.getString()); } else { - std::string descr = LLTrans::getString("0_label", LLSD()); - getChild("p0")->setLabel(descr); - + for (int i = 0; i < max_elm; i++) + { + getChild("p" + llformat("%d", i), true)->setTextArg("[DSC]", std::string()); + } + mCurrentTimeLabel->setTextArg("[DSC]", std::string()); } - */ + //todo: add time slider setting /*list_name_id_t getSkyList() const; list_name_id_t getWaterList() const; @@ -257,21 +264,33 @@ void LLFloaterEditExtDayCycle::onBtnCancel() void LLFloaterEditExtDayCycle::onAddTrack() { - F32 frame = 0; // temp? - mKeysSlider->addSlider(frame); + F32 frame = mTimeSlider->getCurSliderValue(); + LLSettingsBase::ptr_t setting; + // todo: expand to generate from panels instead of using defaults + if (mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack).get() != NULL) //temp check? todo: disable button in such cases + { + return; + } if (mCurrentTrack == 0) { - mEditDay->setWaterAtKeyframe(LLSettingsVOWater::buildDefaultWater(), frame); + setting = LLSettingsVOWater::buildDefaultWater(); + mEditDay->setWaterAtKeyframe(std::dynamic_pointer_cast(setting), frame); } else { - mEditDay->setSkyAtKeyframe(LLSettingsVOSky::buildDefaultSky(), frame, mCurrentTrack); + setting = LLSettingsVOSky::buildDefaultSky(); + mEditDay->setSkyAtKeyframe(std::dynamic_pointer_cast(setting), frame, mCurrentTrack); } + addSliderFrame(frame, setting); + updateTabs(); } void LLFloaterEditExtDayCycle::onRemoveTrack() { - //mKeysSlider->deleteCurSlider(); + F32 frame = mTimeSlider->getCurSliderValue(); + mEditDay->removeTrackKeyframe(mCurrentTrack, frame); + removeCurrentSliderFrame(); + //mFramesSlider->deleteCurSlider(); } void LLFloaterEditExtDayCycle::onCommitName(class LLLineEditor* caller, void* user_data) @@ -285,8 +304,68 @@ void LLFloaterEditExtDayCycle::onTrackSelectionCallback(const LLSD& user_data) selectTrack(track_index); } +void LLFloaterEditExtDayCycle::onFrameSliderCallback() +{ + if (mFramesSlider->getValue().size() == 0) + { + mLastFrameSlider.clear(); + return; + } + // make sure we have a slider + const std::string& cur_sldr = mFramesSlider->getCurSlider(); + if (cur_sldr == "") + { + mLastFrameSlider.clear(); + return; + } + + F32 new_frame = mFramesSlider->getCurSliderValue(); + // todo: add safety checks, user shouldn't be capable of moving one frame over another or move missing frame + keymap_t::iterator iter = mSliderKeyMap.find(cur_sldr); + if (iter != mSliderKeyMap.end() && /*temp? until disabling mechanics*/ mEditDay->getSettingsAtKeyframe(new_frame, mCurrentTrack).get() == NULL) + { + LL_DEBUGS() << "Moving frame from " << iter->second.first << " to " << new_frame << LL_ENDL; + if (mEditDay->moveTrackKeyframe(mCurrentTrack, iter->second.first, new_frame)) + { + iter->second.first = new_frame; + } + } + + if (mLastFrameSlider != cur_sldr) + { + // technically should not be possible for both frame and slider to change + // but for safety, assume that they can change independently and both + mLastFrameSlider = cur_sldr; + updateTabs(); + } + // updateTrack(); + // reset last known position +} + +void LLFloaterEditExtDayCycle::onTimeSliderMoved() +{ + // Todo: safety checks + // Update label + F32 time = mTimeSlider->getCurSliderValue(); + mCurrentTimeLabel->setTextArg("[PRCNT]", llformat("%.0f", time * 100)); + if (mDayLength.value() != 0) + { + F32Hours hrs = (mDayLength * time) + mDayOffset; + LLUIString formatted_label = getString("time_label"); + formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value())); + mCurrentTimeLabel->setTextArg("[DSC]", formatted_label.getString()); + } + else + { + mCurrentTimeLabel->setTextArg("[DSC]", std::string()); + } + + //Todo: update something related to time/play? +} + void LLFloaterEditExtDayCycle::selectTrack(U32 track_index) { + // todo: safety checks mCurrentTrack = track_index; LLButton* button = getChild(track_tabs[track_index], true); if (button->getToggleState()) @@ -294,24 +373,22 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index) return; } - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; i++) // yse max value { getChild(track_tabs[i], true)->setToggleState(false); } button->setToggleState(true); - updateTabs(); + bool show_water = mCurrentTrack == 0; + mSkyTabLayoutContainer->setVisible(!show_water); + mWaterTabLayoutContainer->setVisible(show_water); updateSlider(); } void LLFloaterEditExtDayCycle::updateTabs() { - bool show_water = mCurrentTrack == 0; - mSkyTabContainer->setVisible(!show_water); - mWaterTabContainer->setVisible(show_water); - - if (show_water) + if (mCurrentTrack == 0) { updateWaterTabs(); } @@ -323,11 +400,13 @@ void LLFloaterEditExtDayCycle::updateTabs() void LLFloaterEditExtDayCycle::updateWaterTabs() { - const LLSettingsWaterPtr_t p_water = mEditDay->getWaterAtKeyframe(mKeysSlider->getCurSliderValue()); + // todo: substitute with mSliderKeyMap? + const LLSettingsWaterPtr_t p_water = mEditDay->getWaterAtKeyframe(mFramesSlider->getCurSliderValue()); // Compiler warnings from getChild about LLPanelSettingsWaterMainTab not being complete/missing params constructor... - // Todo: fix class to work with getChild() - LLPanelSettingsWaterMainTab* panel = mWaterTabContainer->findChild("water_panel", true); + // Todo: fix class to work with getChild()? + LLView* tab_container = mWaterTabLayoutContainer->getChild("water_tabs"); //can't extract panels directly, since they are in 'tuple' + LLPanelSettingsWaterMainTab* panel = dynamic_cast(tab_container->getChildView("water_panel")); if (panel) { panel->setWater(p_water); // todo: Null disables @@ -336,22 +415,25 @@ void LLFloaterEditExtDayCycle::updateWaterTabs() void LLFloaterEditExtDayCycle::updateSkyTabs() { - const LLSettingsSkyPtr_t p_sky = mEditDay->getSkyAtKeyframe(mKeysSlider->getCurSliderValue(), mCurrentTrack); + // todo: substitute with mSliderKeyMap? + const LLSettingsSkyPtr_t p_sky = mEditDay->getSkyAtKeyframe(mFramesSlider->getCurSliderValue(), mCurrentTrack); + + LLView* tab_container = mSkyTabLayoutContainer->getChild("sky_tabs"); //can't extract panels directly, since they are in 'tuple' // Compiler warnings from getChild about tabs... // Todo: fix class LLPanelSettingsSky* panel; - panel = mSkyTabContainer->findChild("atmosphere_panel", true); + panel = dynamic_cast(tab_container->getChildView("atmosphere_panel")); if (panel) { panel->setSky(p_sky); // todo: Null disables } - panel = mSkyTabContainer->findChild("clouds_panel", true); + panel = dynamic_cast(tab_container->getChildView("clouds_panel")); if (panel) { panel->setSky(p_sky); } - panel = mSkyTabContainer->findChild("moon_panel", true); + panel = dynamic_cast(tab_container->getChildView("moon_panel")); if (panel) { panel->setSky(p_sky); @@ -360,17 +442,39 @@ void LLFloaterEditExtDayCycle::updateSkyTabs() void LLFloaterEditExtDayCycle::updateSlider() { - mKeysSlider->clear(); + mFramesSlider->clear(); + mSliderKeyMap.clear(); - LLSettingsDay::KeyframeList_t keyframes = mEditDay->getTrackKeyframes(mCurrentTrack); - LLSettingsDay::KeyframeList_t::iterator iter = keyframes.begin(); - LLSettingsDay::KeyframeList_t::iterator end = keyframes.end(); + LLSettingsDay::CycleTrack_t track = mEditDay->getCycleTrack(mCurrentTrack); + for (auto &frame : track) + { + addSliderFrame(frame.first, frame.second); + } +} + +void LLFloaterEditExtDayCycle::addSliderFrame(const F32 frame, LLSettingsBase::ptr_t setting) +{ + // multi slider distinguishes elements by key/name in string format + // store names to map to be able to recal dependencies + std::string new_slider = mFramesSlider->addSlider(frame); + mSliderKeyMap[new_slider] = framedata_t(frame, setting); + mLastFrameSlider = new_slider; + + updateTabs(); +} - while (iter != end) +void LLFloaterEditExtDayCycle::removeCurrentSliderFrame() +{ + std::string sldr = mFramesSlider->getCurSlider(); + mFramesSlider->deleteCurSlider(); + keymap_t::iterator iter = mSliderKeyMap.find(sldr); + if (iter != mSliderKeyMap.end()) { - mKeysSlider->addSlider(*iter); - iter++; + LL_DEBUGS() << "Removing frame from " << iter->second.first << LL_ENDL; + mSliderKeyMap.erase(iter); } + + updateTabs(); } /*void LLFloaterEditExtDayCycle::updateTrack() @@ -540,52 +644,7 @@ LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSi // #endif // } // -// void LLFloaterEditExtDayCycle::onTimeSliderMoved() -// { -// #if 0 -// /// get the slider value -// F32 val = mTimeSlider->getCurSliderValue() / sHoursPerDay; -// -// // set the value, turn off animation -// LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val); -// LLWLParamManager::getInstance()->mAnimator.deactivate(); -// -// // then call update once -// LLWLParamManager::getInstance()->mAnimator.update( -// LLWLParamManager::getInstance()->mCurParams); -// #endif -// } -// -// void LLFloaterEditExtDayCycle::onKeyTimeMoved() -// { -// #if 0 -// if (mKeysSlider->getValue().size() == 0) -// { -// return; -// } -// -// // make sure we have a slider -// const std::string& cur_sldr = mKeysSlider->getCurSlider(); -// if (cur_sldr == "") -// { -// return; -// } -// -// F32 time24 = mKeysSlider->getCurSliderValue(); -// -// // check to see if a key exists -// LLWLParamKey key = mSliderToKey[cur_sldr].keyframe; -// LL_DEBUGS() << "Setting key time: " << time24 << LL_ENDL; -// mSliderToKey[cur_sldr].time = time24; -// -// // if it exists, turn on check box -// mSkyPresetsCombo->selectByValue(key.toStringVal()); -// -// mTimeCtrl->setTime24(time24); // -// applyTrack(); -// #endif -// } // // void LLFloaterEditExtDayCycle::onKeyTimeChanged() // { @@ -655,25 +714,6 @@ LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSi // #endif // } // -void LLFloaterEditExtDayCycle::addSliderKey(F32 time, const std::shared_ptr keyframe) -{ - // make a slider - const std::string& sldr_name = mKeysSlider->addSlider(time); - if (sldr_name.empty()) - { - return; - } - - // set the key - SliderKey newKey(keyframe, mKeysSlider->getCurSliderValue()); - - llassert_always(sldr_name != LLStringUtil::null); - - // add to map - mSliderToKey.insert(std::pair(sldr_name, newKey)); - - llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); -} // #if 0 // LLWLParamKey LLFloaterEditExtDayCycle::getSelectedDayCycle() diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index a9004087c9..c67cfdd274 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -35,20 +35,11 @@ class LLCheckBoxCtrl; class LLComboBox; class LLLineEditor; class LLMultiSliderCtrl; +class LLTextBox; class LLTimeCtrl; typedef std::shared_ptr LLSettingsBasePtr_t; -class SliderKey -{ -public: - SliderKey(LLSettingsBasePtr_t kf, F32 t) : keyframe(kf), time(t) {} - - LLSettingsBasePtr_t keyframe; - F32 time; -}; - - /** * Floater for creating or editing a day cycle. */ @@ -94,19 +85,22 @@ private: void onRemoveTrack(); void onCommitName(class LLLineEditor* caller, void* user_data); void onTrackSelectionCallback(const LLSD& user_data); + void onTimeSliderMoved(); /// time slider moved + void onFrameSliderCallback(); /// a frame moved or frame selection changed void selectTrack(U32 track_index); void updateTabs(); void updateSkyTabs(); void updateWaterTabs(); - void updateSlider(); //track->slider + void updateSlider(); //track to slider + void addSliderFrame(const F32 frame, LLSettingsBase::ptr_t setting); + void removeCurrentSliderFrame(); //void updateTrack(); // slider->track, todo: better name // /// refresh the day cycle combobox // void refreshDayCyclesList(); // // /// add a slider to the track - void addSliderKey(F32 time, const LLSettingsBasePtr_t key); // // void initCallbacks(); // // LLWLParamKey getSelectedDayCycle(); @@ -119,8 +113,6 @@ private: // void setApplyProgress(bool started); // bool getApplyProgress() const; // -// void onTimeSliderMoved(); /// time slider moved -// void onKeyTimeMoved(); /// a key frame moved // void onKeyTimeChanged(); /// a key frame's time changed // void onAddKey(); /// new key added on slider // void onDeleteKey(); /// a key frame deleted @@ -143,7 +135,10 @@ private: LLSettingsDay::ptr_t mSavedDay; LLSettingsDay::ptr_t mEditDay; - U32 mCurrentTrack; + S64Seconds mDayLength; + S64Seconds mDayOffset; + U32 mCurrentTrack; + std::string mLastFrameSlider; LLButton* mSaveButton; LLButton* mCancelButton; @@ -151,16 +146,16 @@ private: edit_commit_signal_t mCommitSignal; -// LLComboBox* mDayCyclesCombo; -// LLMultiSliderCtrl* mTimeSlider; - LLMultiSliderCtrl* mKeysSlider; - LLView* mSkyTabContainer; - LLView* mWaterTabContainer; - // LLTimeCtrl* mTimeCtrl; -// LLCheckBoxCtrl* mMakeDefaultCheckBox; + LLMultiSliderCtrl* mTimeSlider; + LLMultiSliderCtrl* mFramesSlider; + LLView* mSkyTabLayoutContainer; + LLView* mWaterTabLayoutContainer; + LLTextBox* mCurrentTimeLabel; - // map of sliders to parameters - std::map mSliderToKey; + // map of sliders to parameters + typedef std::pair framedata_t; + typedef std::map keymap_t; + keymap_t mSliderKeyMap; }; #endif // LL_LLFloaterEditExtDayCycle_H diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index e10af29e82..e5c6116c4f 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -74,6 +74,10 @@ namespace const F32 SLIDER_SCALE_GLOW_B(-5.0f); } +static LLPanelInjector t_settings_atmos("panel_settings_atmos"); +static LLPanelInjector t_settings_cloud("panel_settings_cloud"); +static LLPanelInjector t_settings_sunmoon("panel_settings_sunmoon"); + //========================================================================== LLPanelSettingsSky::LLPanelSettingsSky() : LLSettingsEditPanel(), diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index 3cb1dcfda4..5904b5a542 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -57,6 +57,8 @@ namespace const std::string FIELD_WATER_BLUR_MULTIP("water_blur_multip"); } +static LLPanelInjector t_settings_water("panel_settings_water"); + //========================================================================== LLPanelSettingsWater::LLPanelSettingsWater() : LLSettingsEditPanel(), diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index 70f5e21327..3b63d0018c 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -8,17 +8,13 @@ title="Edit Day Cycle" width="705"> + Create a New Day Cycle Edit Day Cycle Name your day cycle, adjust the controls to create it, and click "Save". To edit your day cycle, adjust the controls below and click "Save". - - - 0%[DSC] - 25%[DSC] - 50%[DSC] - 75%[DSC] - 100%[DSC] + + ([TIME] hr) + parameter="4" />