diff options
Diffstat (limited to 'indra/newview/llfloatereditwater.cpp')
-rw-r--r-- | indra/newview/llfloatereditwater.cpp | 324 |
1 files changed, 162 insertions, 162 deletions
diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp index 4a6268435b..9333967b8e 100644 --- a/indra/newview/llfloatereditwater.cpp +++ b/indra/newview/llfloatereditwater.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llfloatereditwater.cpp * @brief Floater to create or edit a water preset * * $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$ */ @@ -53,8 +53,8 @@ #undef max // Fixes a Windows compiler error -LLFloaterEditWater::LLFloaterEditWater(const LLSD &key): - LLFloater(key), +LLFloaterEditWater::LLFloaterEditWater(const LLSD &key): + LLFloater(key), mWaterPresetNameEditor(NULL), mWaterPresetCombo(NULL), mMakeDefaultCheckBox(NULL), @@ -66,115 +66,115 @@ LLFloaterEditWater::LLFloaterEditWater(const LLSD &key): // virtual BOOL LLFloaterEditWater::postBuild() { - mWaterPresetNameEditor = getChild<LLLineEditor>("water_preset_name"); - mWaterPresetCombo = getChild<LLComboBox>("water_preset_combo"); - mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb"); - mSaveButton = getChild<LLButton>("save"); + mWaterPresetNameEditor = getChild<LLLineEditor>("water_preset_name"); + mWaterPresetCombo = getChild<LLComboBox>("water_preset_combo"); + mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb"); + mSaveButton = getChild<LLButton>("save"); mWaterAdapter = std::make_shared<LLWatterSettingsAdapter>(); LLEnvironment::instance().setWaterListChange(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this)); - initCallbacks(); - refreshWaterPresetsList(); - syncControls(); + initCallbacks(); + refreshWaterPresetsList(); + syncControls(); - return TRUE; + return TRUE; } // virtual void LLFloaterEditWater::onOpen(const LLSD& key) { - bool new_preset = isNewPreset(); - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); - std::string hint = getString(std::string("hint_" + param)); + bool new_preset = isNewPreset(); + std::string param = key.asString(); + std::string floater_title = getString(std::string("title_") + param); + std::string hint = getString(std::string("hint_" + param)); - // Update floater title. - setTitle(floater_title); + // Update floater title. + setTitle(floater_title); - // Update the hint at the top. - getChild<LLUICtrl>("hint")->setValue(hint); + // Update the hint at the top. + getChild<LLUICtrl>("hint")->setValue(hint); - // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(!new_preset); + // Hide the hint to the right of the combo if we're invoked to create a new preset. + getChildView("note")->setVisible(!new_preset); - // Switch between the water presets combobox and preset name input field. - mWaterPresetCombo->setVisible(!new_preset); - mWaterPresetNameEditor->setVisible(new_preset); + // Switch between the water presets combobox and preset name input field. + mWaterPresetCombo->setVisible(!new_preset); + mWaterPresetNameEditor->setVisible(new_preset); - reset(); + reset(); } // virtual void LLFloaterEditWater::onClose(bool app_quitting) { - if (!app_quitting) // there's no point to change environment if we're quitting - { + if (!app_quitting) // there's no point to change environment if we're quitting + { LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); - } + } } // virtual void LLFloaterEditWater::draw() { - syncControls(); - LLFloater::draw(); + syncControls(); + LLFloater::draw(); } void LLFloaterEditWater::initCallbacks(void) { - mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL); - mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this)); - mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this)); + mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL); + mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this)); + mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this)); - mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this)); - getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this)); + mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this)); + getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this)); - // Connect to region info updates. - LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this)); + // Connect to region info updates. + LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this)); - //------------------------------------------------------------------------- + //------------------------------------------------------------------------- getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor)); - // fog density + // fog density getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &mWaterAdapter->mFogDensity)); getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mUnderWaterFogMod)); - // blue density + // blue density getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &mWaterAdapter->mNormalScale)); getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &mWaterAdapter->mNormalScale)); getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &mWaterAdapter->mNormalScale)); - // fresnel + // fresnel getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelScale)); getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelOffset)); - // scale above/below + // scale above/below getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleAbove)); getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleBelow)); - // blur mult + // blur mult getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier)); - // wave direction + // wave direction getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave1Dir)); getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave1Dir)); getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave2Dir)); getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave2Dir)); - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("WaterNormalMap"); - texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1)); + LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("WaterNormalMap"); + texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); + texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1)); } //============================================================================= void LLFloaterEditWater::syncControls() { - // *TODO: Eliminate slow getChild() calls. + // *TODO: Eliminate slow getChild() calls. LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater(); mEditSettings = pwater; @@ -183,64 +183,64 @@ void LLFloaterEditWater::syncControls() mWaterPresetNameEditor->setText(name); mWaterPresetCombo->setValue(name); - //getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]); + //getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]); getChild<LLColorSwatchCtrl>("WaterFogColor")->set(LLColor4(pwater->getWaterFogColor())); - // fog and wavelets + // fog and wavelets mWaterAdapter->mFogDensity = pwater->getWaterFogDensity(); getChild<LLUICtrl>("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp()); mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod(); - getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(static_cast<F32>(mWaterAdapter->mUnderWaterFogMod)); + getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(static_cast<F32>(mWaterAdapter->mUnderWaterFogMod)); mWaterAdapter->mNormalScale = pwater->getNormalScale(); getChild<LLUICtrl>("WaterNormalScaleX")->setValue(mWaterAdapter->mNormalScale.getX()); - getChild<LLUICtrl>("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY()); - getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ()); + getChild<LLUICtrl>("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY()); + getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ()); - // Fresnel + // Fresnel mWaterAdapter->mFresnelScale = pwater->getFresnelScale(); - getChild<LLUICtrl>("WaterFresnelScale")->setValue(static_cast<F32>(mWaterAdapter->mFresnelScale)); + getChild<LLUICtrl>("WaterFresnelScale")->setValue(static_cast<F32>(mWaterAdapter->mFresnelScale)); mWaterAdapter->mFresnelOffset = pwater->getFresnelOffset(); getChild<LLUICtrl>("WaterFresnelOffset")->setValue(static_cast<F32>(mWaterAdapter->mFresnelOffset)); - // Scale Above/Below + // Scale Above/Below mWaterAdapter->mScaleAbove = pwater->getScaleAbove(); getChild<LLUICtrl>("WaterScaleAbove")->setValue(static_cast<F32>(mWaterAdapter->mScaleAbove)); mWaterAdapter->mScaleBelow = pwater->getScaleBelow(); getChild<LLUICtrl>("WaterScaleBelow")->setValue(static_cast<F32>(mWaterAdapter->mScaleBelow)); - // blur mult + // blur mult mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier(); getChild<LLUICtrl>("WaterBlurMult")->setValue(static_cast<F32>(mWaterAdapter->mBlurMultiplier)); - // wave directions + // wave directions mWaterAdapter->mWave1Dir = pwater->getWave1Dir(); - getChild<LLUICtrl>("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU()); - getChild<LLUICtrl>("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV()); + getChild<LLUICtrl>("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU()); + getChild<LLUICtrl>("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV()); mWaterAdapter->mWave2Dir = pwater->getWave2Dir(); - getChild<LLUICtrl>("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU()); + getChild<LLUICtrl>("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU()); getChild<LLUICtrl>("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV()); - LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); - textCtrl->setImageAssetID(pwater->getNormalMapID()); + LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); + textCtrl->setImageAssetID(pwater->getNormalMapID()); } // vector control callbacks void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) { - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); + LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); - vector_ctrl->setX( sldr_ctrl->getValueF32() ); - vector_ctrl->update(mEditSettings); + vector_ctrl->setX( sldr_ctrl->getValueF32() ); + vector_ctrl->update(mEditSettings); } // vector control callbacks void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl) { - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); + LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); vector_ctrl->setY(sldr_ctrl->getValueF32()); vector_ctrl->update(mEditSettings); @@ -284,7 +284,7 @@ void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* flo void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl) { - LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); + LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl); expFloatControl->setExp(sldr_ctrl->getValueF32()); expFloatControl->update(mEditSettings); @@ -292,15 +292,15 @@ void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl) { - LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); - color_ctrl->setColor4( swatch->get() ); - color_ctrl->update(mEditSettings); + LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); + color_ctrl->setColor4( swatch->get() ); + color_ctrl->update(mEditSettings); } void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl) { - LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl); - LLUUID textID = textCtrl->getImageAssetID(); + LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl); + LLUUID textID = textCtrl->getImageAssetID(); mEditSettings->setNormalMapID(textID); } @@ -308,28 +308,28 @@ void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl) void LLFloaterEditWater::reset() { - if (isNewPreset()) - { - mWaterPresetNameEditor->setValue(LLSD()); - mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name - } - else - { - refreshWaterPresetsList(); + if (isNewPreset()) + { + mWaterPresetNameEditor->setValue(LLSD()); + mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name + } + else + { + refreshWaterPresetsList(); - // Disable controls until a water preset to edit is selected. - enableEditing(false); - } + // Disable controls until a water preset to edit is selected. + enableEditing(false); + } } bool LLFloaterEditWater::isNewPreset() const { - return mKey.asString() == "new"; + return mKey.asString() == "new"; } void LLFloaterEditWater::refreshWaterPresetsList() { - mWaterPresetCombo->removeall(); + mWaterPresetCombo->removeall(); LLEnvironment::list_name_id_t list = LLEnvironment::instance().getWaterList(); @@ -338,65 +338,65 @@ void LLFloaterEditWater::refreshWaterPresetsList() mWaterPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second)); } - mWaterPresetCombo->setLabel(getString("combo_label")); + mWaterPresetCombo->setLabel(getString("combo_label")); } void LLFloaterEditWater::enableEditing(bool enable) { - // Enable/disable water controls. - getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable); + // Enable/disable water controls. + getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable); - // Enable/disable saving. - mSaveButton->setEnabled(enable); - mMakeDefaultCheckBox->setEnabled(enable); + // Enable/disable saving. + mSaveButton->setEnabled(enable); + mMakeDefaultCheckBox->setEnabled(enable); } void LLFloaterEditWater::saveRegionWater() { #if 0 - llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water + llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water - LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL; + LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL; - //LLWaterParamSet region_water = water_mgr.mCurParams; + //LLWaterParamSet region_water = water_mgr.mCurParams; - // *TODO: save to cached region settings. - LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL; + // *TODO: save to cached region settings. + LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL; #endif } #if 0 std::string LLFloaterEditWater::getCurrentPresetName() const { - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return name; + std::string name; + LLEnvKey::EScope scope; + getSelectedPreset(name, scope); + return name; } #endif #if 0 LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const { - std::string name; - LLEnvKey::EScope scope; - getSelectedPreset(name, scope); - return scope; + std::string name; + LLEnvKey::EScope scope; + getSelectedPreset(name, scope); + return scope; } #endif std::string LLFloaterEditWater::getSelectedPresetName() const { std::string name; - if (mWaterPresetNameEditor->getVisible()) - { - name = mWaterPresetNameEditor->getText(); - } - else - { - LLSD combo_val = mWaterPresetCombo->getValue(); - name = combo_val[0].asString(); - } + if (mWaterPresetNameEditor->getVisible()) + { + name = mWaterPresetNameEditor->getText(); + } + else + { + LLSD combo_val = mWaterPresetCombo->getValue(); + name = combo_val[0].asString(); + } return name; } @@ -408,16 +408,16 @@ void LLFloaterEditWater::onWaterPresetNameEdited() pwater->setName(name); #if 0 - // Disable saving a water preset having empty name. - mSaveButton->setEnabled(!getCurrentPresetName().empty()); + // Disable saving a water preset having empty name. + mSaveButton->setEnabled(!getCurrentPresetName().empty()); #endif } void LLFloaterEditWater::onWaterPresetSelected() { - std::string name; + std::string name; - name = getSelectedPresetName(); + name = getSelectedPresetName(); LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(name); @@ -438,34 +438,34 @@ void LLFloaterEditWater::onWaterPresetSelected() bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - // If they choose save, do it. Otherwise, don't do anything - if (option == 0) - { - onSaveConfirmed(); - } + // If they choose save, do it. Otherwise, don't do anything + if (option == 0) + { + onSaveConfirmed(); + } return false; } void LLFloaterEditWater::onSaveConfirmed() { - // Save currently displayed water params to the selected preset. + // Save currently displayed water params to the selected preset. std::string name = mEditSettings->getName(); - LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; + LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL; LLEnvironment::instance().addWater(mEditSettings); - // Change preference if requested. - if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) - { - LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL; + // Change preference if requested. + if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) + { + LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL; LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings); - } + } - closeFloater(); + closeFloater(); } void LLFloaterEditWater::onBtnSave() @@ -478,7 +478,7 @@ void LLFloaterEditWater::onBtnSave() void LLFloaterEditWater::onBtnCancel() { - closeFloater(); + closeFloater(); } void LLFloaterEditWater::onWaterPresetListChange() @@ -489,38 +489,38 @@ void LLFloaterEditWater::onWaterPresetListChange() void LLFloaterEditWater::onRegionSettingsChange() { #if 0 - // If creating a new preset, don't bother. - if (isNewPreset()) - { - return; - } - - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water - { - // reset the floater to its initial state - reset(); - - // *TODO: Notify user? - } - else // editing a local preset - { - refreshWaterPresetsList(); - } + // If creating a new preset, don't bother. + if (isNewPreset()) + { + return; + } + + if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water + { + // reset the floater to its initial state + reset(); + + // *TODO: Notify user? + } + else // editing a local preset + { + refreshWaterPresetsList(); + } #endif } void LLFloaterEditWater::onRegionInfoUpdate() { #if 0 - bool can_edit = true; + bool can_edit = true; - // If we've selected the region water for editing. - if (getCurrentScope() == LLEnvKey::SCOPE_REGION) - { - // check whether we have the access - can_edit = LLEnvManagerNew::canEditRegionSettings(); - } + // If we've selected the region water for editing. + if (getCurrentScope() == LLEnvKey::SCOPE_REGION) + { + // check whether we have the access + can_edit = LLEnvManagerNew::canEditRegionSettings(); + } - enableEditing(can_edit); + enableEditing(can_edit); #endif } |