1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
|
/**
* @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$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloatereditwater.h"
#include <boost/make_shared.hpp>
// libs
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llcolorswatch.h"
#include "llcombobox.h"
//#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llsliderctrl.h"
#include "lltexturectrl.h"
// newview
#include "llagent.h"
#include "llregioninfomodel.h"
#include "llviewerregion.h"
#include "llenvironment.h"
#include "llsettingswater.h"
#include "llenvadapters.h"
#include "v3colorutil.h"
#undef max // Fixes a Windows compiler error
LLFloaterEditWater::LLFloaterEditWater(const LLSD &key):
LLFloater(key),
mWaterPresetNameEditor(NULL),
mWaterPresetCombo(NULL),
mMakeDefaultCheckBox(NULL),
mSaveButton(NULL),
mWaterAdapter()
{
}
// 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");
mWaterAdapter = boost::make_shared<LLWatterSettingsAdapter>();
initCallbacks();
refreshWaterPresetsList();
syncControls();
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));
// Update floater title.
setTitle(floater_title);
// 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);
// Switch between the water presets combobox and preset name input field.
mWaterPresetCombo->setVisible(!new_preset);
mWaterPresetNameEditor->setVisible(new_preset);
reset();
}
// virtual
void LLFloaterEditWater::onClose(bool app_quitting)
{
if (!app_quitting) // there's no point to change environment if we're quitting
{
// LLEnvManagerNew::instance().usePrefs(); // revert changes made to current environment
}
}
// virtual
void LLFloaterEditWater::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));
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));
//-------------------------------------------------------------------------
getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor));
// 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
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
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
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
getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier));
// 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));
}
//=============================================================================
void LLFloaterEditWater::syncControls()
{
// *TODO: Eliminate slow getChild() calls.
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
mEditSettings = pwater;
//getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]);
getChild<LLColorSwatchCtrl>("WaterFogColor")->set(LLColor4(pwater->getFogColor()));
// fog and wavelets
mWaterAdapter->mFogDensity = pwater->getFogDensity();
getChild<LLUICtrl>("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp());
mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod();
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());
// Fresnel
mWaterAdapter->mFresnelScale = pwater->getFresnelScale();
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
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
mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier();
getChild<LLUICtrl>("WaterBlurMult")->setValue(static_cast<F32>(mWaterAdapter->mBlurMultiplier));
// wave directions
mWaterAdapter->mWave1Dir = pwater->getWave1Dir();
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>("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV());
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);
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);
vector_ctrl->setY(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector3ControlZMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setZ(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector2ControlXMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setU(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
// vector control callbacks
void LLFloaterEditWater::onVector2ControlYMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
vector_ctrl->setV(sldr_ctrl->getValueF32());
vector_ctrl->update(mEditSettings);
}
void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
floatControl->setValue(sldr_ctrl->getValueF32());
floatControl->update(mEditSettings);
}
void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl)
{
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
expFloatControl->setExp(sldr_ctrl->getValueF32());
expFloatControl->update(mEditSettings);
}
void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
{
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();
mEditSettings->setNormalMapID(textID);
}
//=============================================================================
void LLFloaterEditWater::reset()
{
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);
}
}
bool LLFloaterEditWater::isNewPreset() const
{
return mKey.asString() == "new";
}
void LLFloaterEditWater::refreshWaterPresetsList()
{
#if 0
mWaterPresetCombo->removeall();
#if 0 // *TODO: enable when we have a clear workflow to edit existing region environment
// If the region already has water params, add them to the list.
const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings();
if (region_settings.getWaterParams().size() != 0)
{
const std::string& region_name = gAgent.getRegion()->getName();
mWaterPresetCombo->add(region_name, LLSD().with(0, region_name).with(1, LLEnvKey::SCOPE_REGION));
mWaterPresetCombo->addSeparator();
}
#endif
std::list<std::string> user_presets, system_presets;
LLWaterParamManager::instance().getPresetNames(user_presets, system_presets);
// Add local user presets first.
for (std::list<std::string>::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
{
const std::string& name = *it;
mWaterPresetCombo->add(name, LLSD().with(0, name).with(1, LLEnvKey::SCOPE_LOCAL)); // [<name>, <scope>]
}
if (user_presets.size() > 0)
{
mWaterPresetCombo->addSeparator();
}
// Add local system presets.
for (std::list<std::string>::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it)
{
const std::string& name = *it;
mWaterPresetCombo->add(name, LLSD().with(0, name).with(1, LLEnvKey::SCOPE_LOCAL)); // [<name>, <scope>]
}
mWaterPresetCombo->setLabel(getString("combo_label"));
#endif
}
void LLFloaterEditWater::enableEditing(bool enable)
{
// Enable/disable water controls.
getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(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
LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL;
//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;
#endif
}
#if 0
std::string LLFloaterEditWater::getCurrentPresetName() const
{
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;
}
#endif
#if 0
void LLFloaterEditWater::getSelectedPreset(std::string& name, LLEnvKey::EScope& scope) const
{
if (mWaterPresetNameEditor->getVisible())
{
name = mWaterPresetNameEditor->getText();
scope = LLEnvKey::SCOPE_LOCAL;
}
else
{
LLSD combo_val = mWaterPresetCombo->getValue();
if (!combo_val.isArray()) // manually typed text
{
name = combo_val.asString();
scope = LLEnvKey::SCOPE_LOCAL;
}
else
{
name = combo_val[0].asString();
scope = (LLEnvKey::EScope) combo_val[1].asInteger();
}
}
}
#endif
void LLFloaterEditWater::onWaterPresetNameEdited()
{
#if 0
// Disable saving a water preset having empty name.
mSaveButton->setEnabled(!getCurrentPresetName().empty());
#endif
}
void LLFloaterEditWater::onWaterPresetSelected()
{
#if 0
LLWaterParamSet water_params;
std::string name;
LLEnvKey::EScope scope;
getSelectedPreset(name, scope);
// Display selected preset.
if (scope == LLEnvKey::SCOPE_REGION)
{
water_params.setAll(LLEnvManagerNew::instance().getRegionSettings().getWaterParams());
}
else // local preset selected
{
if (!LLWaterParamManager::instance().getParamSet(name, water_params))
{
// Manually entered string?
LL_WARNS("Windlight") << "No water preset named " << name << LL_ENDL;
return;
}
}
LLEnvManagerNew::instance().useWaterParams(water_params.getAll());
bool can_edit = (scope == LLEnvKey::SCOPE_LOCAL || LLEnvManagerNew::canEditRegionSettings());
enableEditing(can_edit);
mMakeDefaultCheckBox->setEnabled(scope == LLEnvKey::SCOPE_LOCAL);
#endif
}
bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response)
{
#if 0
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
// If they choose save, do it. Otherwise, don't do anything
if (option == 0)
{
onSaveConfirmed();
}
#endif
return false;
}
void LLFloaterEditWater::onSaveConfirmed()
{
#if 0
// Save currently displayed water params to the selected preset.
std::string name = getCurrentPresetName();
LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
if (water_mgr.hasParamSet(name))
{
water_mgr.setParamSet(name, water_mgr.mCurParams);
}
else
{
water_mgr.addParamSet(name, water_mgr.mCurParams);
}
water_mgr.savePreset(name);
// Change preference if requested.
if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
{
LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL;
LLEnvManagerNew::instance().setUseWaterPreset(name);
}
closeFloater();
#endif
}
void LLFloaterEditWater::onBtnSave()
{
#if 0
LLEnvKey::EScope scope;
std::string name;
getSelectedPreset(name, scope);
if (scope == LLEnvKey::SCOPE_REGION)
{
saveRegionWater();
closeFloater();
return;
}
if (name.empty())
{
// *TODO: show an alert
LL_WARNS() << "Empty water preset name" << LL_ENDL;
return;
}
// Don't allow overwriting system presets.
LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
if (water_mgr.isSystemPreset(name))
{
LLNotificationsUtil::add("WLNoEditDefault");
return;
}
// Save, ask for confirmation for overwriting an existing preset.
if (water_mgr.hasParamSet(name))
{
LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterEditWater::onSaveAnswer, this, _1, _2));
}
else
{
// new preset, hence no confirmation needed
onSaveConfirmed();
}
#endif
}
void LLFloaterEditWater::onBtnCancel()
{
closeFloater();
}
void LLFloaterEditWater::onWaterPresetListChange()
{
#if 0
std::string name;
LLEnvKey::EScope scope;
getSelectedPreset(name, scope); // preset being edited
if (scope == LLEnvKey::SCOPE_LOCAL && !LLWaterParamManager::instance().hasParamSet(name))
{
// Preset we've been editing doesn't exist anymore. Close the floater.
closeFloater(false);
}
else
{
// A new preset has been added.
// Refresh the presets list, though it may not make sense as the floater is about to be closed.
refreshWaterPresetsList();
}
#endif
}
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();
}
#endif
}
void LLFloaterEditWater::onRegionInfoUpdate()
{
#if 0
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();
}
enableEditing(can_edit);
#endif
}
|