diff options
Diffstat (limited to 'linden/indra/newview/llwlparammanager.cpp')
-rw-r--r-- | linden/indra/newview/llwlparammanager.cpp | 135 |
1 files changed, 78 insertions, 57 deletions
diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp index 8007cce..59de0ad 100644 --- a/linden/indra/newview/llwlparammanager.cpp +++ b/linden/indra/newview/llwlparammanager.cpp | |||
@@ -3,9 +3,9 @@ | |||
3 | * @brief Implementation for the LLWLParamManager class. | 3 | * @brief Implementation for the LLWLParamManager class. |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2007&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2007&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2007-2009, Linden Research, Inc. | 7 | * Copyright (c) 2007-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
11 | * to you under the terms of the GNU General Public License, version 2.0 | 11 | * to you under the terms of the GNU General Public License, version 2.0 |
@@ -13,17 +13,17 @@ | |||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | 21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception |
22 | * | 22 | * |
23 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
24 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
25 | * and agree to abide by those obligations. | 25 | * and agree to abide by those obligations. |
26 | * | 26 | * |
27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
29 | * COMPLETENESS OR PERFORMANCE. | 29 | * COMPLETENESS OR PERFORMANCE. |
@@ -33,6 +33,8 @@ | |||
33 | #include "llviewerprecompiledheaders.h" | 33 | #include "llviewerprecompiledheaders.h" |
34 | 34 | ||
35 | #include "llwlparammanager.h" | 35 | #include "llwlparammanager.h" |
36 | #include "llwaterparammanager.h" | ||
37 | #include "llettherebelight.h" | ||
36 | 38 | ||
37 | #include "pipeline.h" | 39 | #include "pipeline.h" |
38 | #include "llsky.h" | 40 | #include "llsky.h" |
@@ -60,6 +62,7 @@ | |||
60 | #include "llfloaterdaycycle.h" | 62 | #include "llfloaterdaycycle.h" |
61 | #include "llfloaterenvsettings.h" | 63 | #include "llfloaterenvsettings.h" |
62 | 64 | ||
65 | #include "llworld.h" | ||
63 | 66 | ||
64 | // For notecard loading | 67 | // For notecard loading |
65 | #include "llvfile.h" | 68 | #include "llvfile.h" |
@@ -124,9 +127,9 @@ void LLWLParamManager::loadPresets(const std::string& file_name) | |||
124 | { | 127 | { |
125 | std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); | 128 | std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); |
126 | LL_DEBUGS2("AppInit", "ShaderLoading") << "Loading Default WindLight settings from " << path_name << LL_ENDL; | 129 | LL_DEBUGS2("AppInit", "ShaderLoading") << "Loading Default WindLight settings from " << path_name << LL_ENDL; |
127 | 130 | ||
128 | bool found = true; | 131 | bool found = true; |
129 | while(found) | 132 | while(found) |
130 | { | 133 | { |
131 | std::string name; | 134 | std::string name; |
132 | found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false); | 135 | found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false); |
@@ -150,9 +153,9 @@ void LLWLParamManager::loadPresets(const std::string& file_name) | |||
150 | 153 | ||
151 | std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); | 154 | std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); |
152 | LL_INFOS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL; | 155 | LL_INFOS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL; |
153 | 156 | ||
154 | found = true; | 157 | found = true; |
155 | while(found) | 158 | while(found) |
156 | { | 159 | { |
157 | std::string name; | 160 | std::string name; |
158 | found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false); | 161 | found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false); |
@@ -176,14 +179,14 @@ void LLWLParamManager::loadPresets(const std::string& file_name) | |||
176 | bool LLWLParamManager::loadPresetXML(const std::string& name, std::istream& preset_stream, bool propagate /* = false */, bool check_if_real /* = false */) | 179 | bool LLWLParamManager::loadPresetXML(const std::string& name, std::istream& preset_stream, bool propagate /* = false */, bool check_if_real /* = false */) |
177 | { | 180 | { |
178 | LLSD paramsData(LLSD::emptyMap()); | 181 | LLSD paramsData(LLSD::emptyMap()); |
179 | 182 | ||
180 | LLPointer<LLSDParser> parser = new LLSDXMLParser(); | 183 | LLPointer<LLSDParser> parser = new LLSDXMLParser(); |
181 | 184 | ||
182 | if(parser->parse(preset_stream, paramsData, LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE) | 185 | if(parser->parse(preset_stream, paramsData, LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE) |
183 | { | 186 | { |
184 | return false; | 187 | return false; |
185 | } | 188 | } |
186 | 189 | ||
187 | if(check_if_real) | 190 | if(check_if_real) |
188 | { | 191 | { |
189 | static const char* expected_windlight_settings[] = { | 192 | static const char* expected_windlight_settings[] = { |
@@ -220,13 +223,13 @@ bool LLWLParamManager::loadPresetXML(const std::string& name, std::istream& pres | |||
220 | } | 223 | } |
221 | } | 224 | } |
222 | } | 225 | } |
223 | 226 | ||
224 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); | 227 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); |
225 | if(mIt == mParamList.end()) | 228 | if(mIt == mParamList.end()) |
226 | { | 229 | { |
227 | addParamSet(name, paramsData); | 230 | addParamSet(name, paramsData); |
228 | } | 231 | } |
229 | else | 232 | else |
230 | { | 233 | { |
231 | setParamSet(name, paramsData); | 234 | setParamSet(name, paramsData); |
232 | } | 235 | } |
@@ -258,12 +261,12 @@ void LLWLParamManager::savePresets(const std::string & fileName) | |||
258 | //and not over the RO system wide version. | 261 | //and not over the RO system wide version. |
259 | 262 | ||
260 | LLSD paramsData(LLSD::emptyMap()); | 263 | LLSD paramsData(LLSD::emptyMap()); |
261 | 264 | ||
262 | std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName)); | 265 | std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName)); |
263 | 266 | ||
264 | for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin(); | 267 | for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin(); |
265 | mIt != mParamList.end(); | 268 | mIt != mParamList.end(); |
266 | ++mIt) | 269 | ++mIt) |
267 | { | 270 | { |
268 | paramsData[mIt->first] = mIt->second.getAll(); | 271 | paramsData[mIt->first] = mIt->second.getAll(); |
269 | } | 272 | } |
@@ -295,7 +298,7 @@ bool LLWLParamManager::savePresetToNotecard(const std::string & name) | |||
295 | // Write it to a notecard | 298 | // Write it to a notecard |
296 | LLNotecard notecard; | 299 | LLNotecard notecard; |
297 | notecard.setText(presetsXML.str()); | 300 | notecard.setText(presetsXML.str()); |
298 | 301 | ||
299 | LLInventoryItem *item = gInventory.getItem(mParamList[name].mInventoryID); | 302 | LLInventoryItem *item = gInventory.getItem(mParamList[name].mInventoryID); |
300 | if(!item) | 303 | if(!item) |
301 | { | 304 | { |
@@ -309,13 +312,13 @@ bool LLWLParamManager::savePresetToNotecard(const std::string & name) | |||
309 | LLAssetID asset_id; | 312 | LLAssetID asset_id; |
310 | tid.generate(); | 313 | tid.generate(); |
311 | asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); | 314 | asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); |
312 | 315 | ||
313 | LLVFile file(gVFS, asset_id, LLAssetType::AT_NOTECARD, LLVFile::APPEND); | 316 | LLVFile file(gVFS, asset_id, LLAssetType::AT_NOTECARD, LLVFile::APPEND); |
314 | 317 | ||
315 | std::ostringstream stream; | 318 | std::ostringstream stream; |
316 | notecard.exportStream(stream); | 319 | notecard.exportStream(stream); |
317 | std::string buffer = stream.str(); | 320 | std::string buffer = stream.str(); |
318 | 321 | ||
319 | S32 size = buffer.length() + 1; | 322 | S32 size = buffer.length() + 1; |
320 | file.setMaxSize(size); | 323 | file.setMaxSize(size); |
321 | file.write((U8*)buffer.c_str(), size); | 324 | file.write((U8*)buffer.c_str(), size); |
@@ -328,7 +331,7 @@ bool LLWLParamManager::savePresetToNotecard(const std::string & name) | |||
328 | LL_WARNS("WindLight") << "Stuff the legacy system." << LL_ENDL; | 331 | LL_WARNS("WindLight") << "Stuff the legacy system." << LL_ENDL; |
329 | return false; | 332 | return false; |
330 | } | 333 | } |
331 | 334 | ||
332 | propagateParameters(); | 335 | propagateParameters(); |
333 | return true; | 336 | return true; |
334 | } | 337 | } |
@@ -341,7 +344,7 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate) | |||
341 | if(propagate) | 344 | if(propagate) |
342 | { | 345 | { |
343 | getParamSet(name, mCurParams); | 346 | getParamSet(name, mCurParams); |
344 | propagateParameters(); | 347 | LightShare::apply(NULL, NULL, &mCurParams, WL_SCOPE_USER); |
345 | } | 348 | } |
346 | return; | 349 | return; |
347 | } | 350 | } |
@@ -355,7 +358,7 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate) | |||
355 | escaped_filename += ".xml"; | 358 | escaped_filename += ".xml"; |
356 | 359 | ||
357 | std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); | 360 | std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); |
358 | LL_DEBUGS2("AppInit", "Shaders") << "Loading WindLight sky setting from " << pathName << LL_ENDL; | 361 | LL_DEBUGS2("AppInit", "Shaders") << "Loading WindLight sky setting from " << pathName << LL_ENDL; |
359 | 362 | ||
360 | llifstream presetsXML; | 363 | llifstream presetsXML; |
361 | presetsXML.open(pathName.c_str()); | 364 | presetsXML.open(pathName.c_str()); |
@@ -364,7 +367,7 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate) | |||
364 | if(!presetsXML) | 367 | if(!presetsXML) |
365 | { | 368 | { |
366 | pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); | 369 | pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); |
367 | LL_DEBUGS2("AppInit", "Shaders")<< "Loading User WindLight sky setting from " << LL_ENDL; | 370 | LL_DEBUGS2("AppInit", "Shaders")<< "Loading User WindLight sky setting from " << LL_ENDL; |
368 | presetsXML.open(pathName.c_str()); | 371 | presetsXML.open(pathName.c_str()); |
369 | } | 372 | } |
370 | 373 | ||
@@ -372,22 +375,22 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate) | |||
372 | { | 375 | { |
373 | loadPresetXML(name, presetsXML); | 376 | loadPresetXML(name, presetsXML); |
374 | presetsXML.close(); | 377 | presetsXML.close(); |
375 | } | 378 | } |
376 | else | 379 | else |
377 | { | 380 | { |
378 | llwarns << "Can't find " << name << llendl; | 381 | llwarns << "Can't find " << name << llendl; |
379 | return; | 382 | return; |
380 | } | 383 | } |
381 | 384 | ||
382 | 385 | ||
383 | if(propagate) | 386 | if(propagate) |
384 | { | 387 | { |
385 | getParamSet(name, mCurParams); | 388 | getParamSet(name, mCurParams); |
386 | propagateParameters(); | 389 | LightShare::apply(NULL, NULL, &mCurParams, WL_SCOPE_USER); |
387 | } | 390 | } |
388 | 391 | ||
389 | notifyObservers(); | 392 | notifyObservers(); |
390 | } | 393 | } |
391 | 394 | ||
392 | void LLWLParamManager::savePreset(const std::string & name) | 395 | void LLWLParamManager::savePreset(const std::string & name) |
393 | { | 396 | { |
@@ -427,7 +430,7 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) | |||
427 | { | 430 | { |
428 | shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV); | 431 | shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, mRotatedLightDir.mV); |
429 | shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); | 432 | shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); |
430 | } | 433 | } |
431 | 434 | ||
432 | else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) | 435 | else if (shader->mShaderGroup == LLGLSLShader::SG_SKY) |
433 | { | 436 | { |
@@ -435,13 +438,13 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) | |||
435 | } | 438 | } |
436 | 439 | ||
437 | shader->uniform1f("scene_light_strength", mSceneLightStrength); | 440 | shader->uniform1f("scene_light_strength", mSceneLightStrength); |
438 | 441 | ||
439 | } | 442 | } |
440 | 443 | ||
441 | void LLWLParamManager::propagateParameters(void) | 444 | void LLWLParamManager::propagateParameters(void) |
442 | { | 445 | { |
443 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); | 446 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); |
444 | 447 | ||
445 | LLVector4 sunDir; | 448 | LLVector4 sunDir; |
446 | LLVector4 moonDir; | 449 | LLVector4 moonDir; |
447 | 450 | ||
@@ -491,7 +494,7 @@ void LLWLParamManager::propagateParameters(void) | |||
491 | // bind the variables for all shaders only if we're using WindLight | 494 | // bind the variables for all shaders only if we're using WindLight |
492 | LLViewerShaderMgr::shader_iter shaders_iter, end_shaders; | 495 | LLViewerShaderMgr::shader_iter shaders_iter, end_shaders; |
493 | end_shaders = LLViewerShaderMgr::instance()->endShaders(); | 496 | end_shaders = LLViewerShaderMgr::instance()->endShaders(); |
494 | for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter) | 497 | for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter) |
495 | { | 498 | { |
496 | if (shaders_iter->mProgramObject != 0 | 499 | if (shaders_iter->mProgramObject != 0 |
497 | && (gPipeline.canUseWindLightShaders() | 500 | && (gPipeline.canUseWindLightShaders() |
@@ -512,29 +515,29 @@ void LLWLParamManager::propagateParameters(void) | |||
512 | void LLWLParamManager::update(LLViewerCamera * cam) | 515 | void LLWLParamManager::update(LLViewerCamera * cam) |
513 | { | 516 | { |
514 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); | 517 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); |
515 | 518 | ||
516 | // update clouds, sun, and general | 519 | // update clouds, sun, and general |
517 | mCurParams.updateCloudScrolling(); | 520 | mCurParams.updateCloudScrolling(); |
518 | 521 | ||
519 | // update only if running | 522 | // update only if running |
520 | if(mAnimator.mIsRunning) | 523 | if(mAnimator.mIsRunning) |
521 | { | 524 | { |
522 | mAnimator.update(mCurParams); | 525 | mAnimator.update(mCurParams); |
523 | } | 526 | } |
524 | 527 | ||
525 | // update the shaders and the menu | 528 | // update the shaders and the menu |
526 | propagateParameters(); | 529 | propagateParameters(); |
527 | 530 | ||
528 | // sync menus if they exist | 531 | // sync menus if they exist |
529 | if(LLFloaterWindLight::isOpen()) | 532 | if(LLFloaterWindLight::isOpen()) |
530 | { | 533 | { |
531 | LLFloaterWindLight::instance()->syncMenu(); | 534 | LLFloaterWindLight::instance()->syncMenu(); |
532 | } | 535 | } |
533 | if(LLFloaterDayCycle::isOpen()) | 536 | if(LLFloaterDayCycle::isOpen()) |
534 | { | 537 | { |
535 | LLFloaterDayCycle::instance()->syncMenu(); | 538 | LLFloaterDayCycle::instance()->syncMenu(); |
536 | } | 539 | } |
537 | if(LLFloaterEnvSettings::isOpen()) | 540 | if(LLFloaterEnvSettings::isOpen()) |
538 | { | 541 | { |
539 | LLFloaterEnvSettings::instance()->syncMenu(); | 542 | LLFloaterEnvSettings::instance()->syncMenu(); |
540 | } | 543 | } |
@@ -547,8 +550,8 @@ void LLWLParamManager::update(LLViewerCamera * cam) | |||
547 | // executed some of the time. For example for water shaders only. | 550 | // executed some of the time. For example for water shaders only. |
548 | { | 551 | { |
549 | F32 camYawDelta = mSunDeltaYaw * DEG_TO_RAD; | 552 | F32 camYawDelta = mSunDeltaYaw * DEG_TO_RAD; |
550 | 553 | ||
551 | LLVector3 lightNorm3(mLightDir); | 554 | LLVector3 lightNorm3(mLightDir); |
552 | lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f)); | 555 | lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f)); |
553 | mRotatedLightDir = LLVector4(lightNorm3, 0.f); | 556 | mRotatedLightDir = LLVector4(lightNorm3, 0.f); |
554 | 557 | ||
@@ -621,7 +624,7 @@ void LLWLParamManager::cleanupClass() | |||
621 | 624 | ||
622 | void LLWLParamManager::resetAnimator(F32 curTime, bool run) | 625 | void LLWLParamManager::resetAnimator(F32 curTime, bool run) |
623 | { | 626 | { |
624 | mAnimator.setTrack(mDay.mTimeMap, mDay.mDayRate, | 627 | mAnimator.setTrack(mDay.mTimeMap, mDay.mDayRate, |
625 | curTime, run); | 628 | curTime, run); |
626 | 629 | ||
627 | return; | 630 | return; |
@@ -630,8 +633,8 @@ bool LLWLParamManager::addParamSet(const std::string& name, LLWLParamSet& param) | |||
630 | { | 633 | { |
631 | // add a new one if not one there already | 634 | // add a new one if not one there already |
632 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); | 635 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); |
633 | if(mIt == mParamList.end()) | 636 | if(mIt == mParamList.end()) |
634 | { | 637 | { |
635 | mParamList[name] = param; | 638 | mParamList[name] = param; |
636 | return true; | 639 | return true; |
637 | } | 640 | } |
@@ -658,7 +661,7 @@ bool LLWLParamManager::getParamSet(const std::string& name, LLWLParamSet& param) | |||
658 | { | 661 | { |
659 | // find it and set it | 662 | // find it and set it |
660 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); | 663 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); |
661 | if(mIt != mParamList.end()) | 664 | if(mIt != mParamList.end()) |
662 | { | 665 | { |
663 | param = mParamList[name]; | 666 | param = mParamList[name]; |
664 | param.mName = name; | 667 | param.mName = name; |
@@ -678,11 +681,11 @@ bool LLWLParamManager::setParamSet(const std::string& name, LLWLParamSet& param) | |||
678 | bool LLWLParamManager::setParamSet(const std::string& name, const LLSD & param) | 681 | bool LLWLParamManager::setParamSet(const std::string& name, const LLSD & param) |
679 | { | 682 | { |
680 | // quick, non robust (we won't be working with files, but assets) check | 683 | // quick, non robust (we won't be working with files, but assets) check |
681 | if(!param.isMap()) | 684 | if(!param.isMap()) |
682 | { | 685 | { |
683 | return false; | 686 | return false; |
684 | } | 687 | } |
685 | 688 | ||
686 | mParamList[name].setAll(param); | 689 | mParamList[name].setAll(param); |
687 | 690 | ||
688 | return true; | 691 | return true; |
@@ -692,7 +695,7 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_ | |||
692 | { | 695 | { |
693 | // remove from param list | 696 | // remove from param list |
694 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); | 697 | std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.find(name); |
695 | if(mIt != mParamList.end()) | 698 | if(mIt != mParamList.end()) |
696 | { | 699 | { |
697 | mParamList.erase(mIt); | 700 | mParamList.erase(mIt); |
698 | } | 701 | } |
@@ -701,11 +704,11 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_ | |||
701 | 704 | ||
702 | // remove all references | 705 | // remove all references |
703 | bool stat = true; | 706 | bool stat = true; |
704 | do | 707 | do |
705 | { | 708 | { |
706 | // get it | 709 | // get it |
707 | stat = mDay.getKey(name, key); | 710 | stat = mDay.getKey(name, key); |
708 | if(stat == false) | 711 | if(stat == false) |
709 | { | 712 | { |
710 | break; | 713 | break; |
711 | } | 714 | } |
@@ -714,17 +717,17 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_ | |||
714 | stat = mDay.removeKey(key); | 717 | stat = mDay.removeKey(key); |
715 | 718 | ||
716 | } while(stat == true); | 719 | } while(stat == true); |
717 | 720 | ||
718 | if(delete_from_disk) | 721 | if(delete_from_disk) |
719 | { | 722 | { |
720 | std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); | 723 | std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); |
721 | 724 | ||
722 | // use full curl escaped name | 725 | // use full curl escaped name |
723 | char * curl_str = curl_escape(name.c_str(), name.size()); | 726 | char * curl_str = curl_escape(name.c_str(), name.size()); |
724 | std::string escaped_name(curl_str); | 727 | std::string escaped_name(curl_str); |
725 | curl_free(curl_str); | 728 | curl_free(curl_str); |
726 | curl_str = NULL; | 729 | curl_str = NULL; |
727 | 730 | ||
728 | gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml"); | 731 | gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml"); |
729 | } | 732 | } |
730 | 733 | ||
@@ -797,7 +800,7 @@ void LLWLParamManager::loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, | |||
797 | } | 800 | } |
798 | else | 801 | else |
799 | { | 802 | { |
800 | // We can do this because we know mCurParams | 803 | // We can do this because we know mCurParams |
801 | sInstance->mParamList[name].mInventoryID = inventory_id; | 804 | sInstance->mParamList[name].mInventoryID = inventory_id; |
802 | } | 805 | } |
803 | } | 806 | } |
@@ -836,3 +839,21 @@ void LLWLParamManager::notifyObservers() | |||
836 | observer->changed(); | 839 | observer->changed(); |
837 | } | 840 | } |
838 | } | 841 | } |
842 | |||
843 | // static | ||
844 | bool LLWLParamManager::isWaterSettingsNotecard(std::string name) | ||
845 | { | ||
846 | return (name.length() > 2 && name.compare(name.length() - 3, 3, ".ww") == 0); | ||
847 | } | ||
848 | |||
849 | // static | ||
850 | bool LLWLParamManager::isSkySettingsNotecard(std::string name) | ||
851 | { | ||
852 | return (name.length() > 2 && name.compare(name.length() - 3, 3, ".wl") == 0); | ||
853 | } | ||
854 | |||
855 | // static | ||
856 | bool LLWLParamManager::isSettingsNotecard(std::string name) | ||
857 | { | ||
858 | return (isSkySettingsNotecard(name) || isWaterSettingsNotecard(name)); | ||
859 | } | ||