aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorDavid Walter Seikel2011-12-29 17:23:04 +1000
committerDavid Walter Seikel2011-12-29 17:23:04 +1000
commitf58782ab0e008fd63924d29f5eac23135bd468b9 (patch)
tree1b3dd609b9c2b2b103dbb767db44ba8893cabae3 /linden/indra
parentEven I did not notice these icons where missing. lol (diff)
downloadmeta-impy-f58782ab0e008fd63924d29f5eac23135bd468b9.zip
meta-impy-f58782ab0e008fd63924d29f5eac23135bd468b9.tar.gz
meta-impy-f58782ab0e008fd63924d29f5eac23135bd468b9.tar.bz2
meta-impy-f58782ab0e008fd63924d29f5eac23135bd468b9.tar.xz
Support the new WindlightReset message from OpenSim for resetting Windlight presets when leaving a sim that uses Lightshare.
Note, this windlight and lighthshare stuff needs a refactoring. The (I think LL inspired) Windlight CAPS duplicates a lot of this code. Still should backup any WL changes that have not been stored in a preset to. Some cleanup to do as well. That's why there is some excess cruft added with this commit, part way through implementing some of the above.
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/newview/lightshare.cpp52
-rw-r--r--linden/indra/newview/lightshare.h5
-rw-r--r--linden/indra/newview/llviewergenericmessage.cpp5
3 files changed, 57 insertions, 5 deletions
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp
index b00df96..599a527 100644
--- a/linden/indra/newview/lightshare.cpp
+++ b/linden/indra/newview/lightshare.cpp
@@ -39,9 +39,18 @@
39#include "meta7windlight.h" 39#include "meta7windlight.h"
40 40
41 41
42const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; 42const std::string WindlightMessage::sWaterPresetName = "(Region settings)";
43const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; 43const std::string WindlightMessage::sSkyPresetName = "(Region settings)";
44 44const std::string WindlightMessage::sBackupWaterPresetName = "(Backup settings)";
45const std::string WindlightMessage::sBackupSkyPresetName = "(Backup settings)";
46
47// Backups.
48LLWaterParamSet waterBackup;
49LLWLParamSet skyBackup;
50//LLUUID* waterNormalBackup = NULL;
51bool animatorIsRunning = true;
52bool animatorUseEstateTime = true;
53bool backup = false;
45 54
46WindlightMessage* WindlightMessage::sMostRecent = NULL; 55WindlightMessage* WindlightMessage::sMostRecent = NULL;
47LLTimer* WindlightMessage::sIgnoreTimer = new LLTimer(); 56LLTimer* WindlightMessage::sIgnoreTimer = new LLTimer();
@@ -204,6 +213,25 @@ bool WindlightMessage::applyCallback(const LLSD& notification,
204void WindlightMessage::resetRegion() 213void WindlightMessage::resetRegion()
205{ 214{
206 sIgnoreRegion = false; 215 sIgnoreRegion = false;
216
217// According to Melanie Thielker -
218// The new WindlightReset message from OpenSim is for resetting Windlight presets when leaving a sim that uses Lightshare.
219// Hopefully if you are moving to a sim that has new LightShare data, that gets sent after this reset, or the reset is never sent.
220 if (backup)
221 {
222 LLWaterParamManager* water_mgr = LLWaterParamManager::instance();
223 LLWLParamManager* sky_mgr = LLWLParamManager::instance();
224
225 llinfos << "Restoring WindLight presets " << waterBackup.mName << " and " << skyBackup.mName << "." << llendl;
226 water_mgr->loadPreset(waterBackup.mName, true);
227 // Don't think we need to do this.
228 //if (waterNormalBackup)
229 //water_mgr->setNormalMapID(*waterNormalBackup);
230 sky_mgr->mAnimator.mIsRunning = animatorIsRunning;
231 sky_mgr->mAnimator.mUseLindenTime = animatorUseEstateTime;
232 sky_mgr->loadPreset(skyBackup.mName, true);
233 backup = false;
234 }
207} 235}
208 236
209 237
@@ -227,10 +255,22 @@ bool WindlightMessage::apply()
227 LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); 255 LLWaterParamManager* water_mgr = LLWaterParamManager::instance();
228 LLWLParamManager* sky_mgr = LLWLParamManager::instance(); 256 LLWLParamManager* sky_mgr = LLWLParamManager::instance();
229 257
258 if (!backup)
259 {
260 llinfos << "Backing up WindLight presets '" << water_mgr->mCurParams.mName << " and " << sky_mgr->mCurParams.mName << "'." << llendl;
261 waterBackup = water_mgr->mCurParams;
262 //waterNormalBackup = waterBackup->getNormalMapID();
263 skyBackup = sky_mgr->mCurParams;
264 animatorIsRunning = sky_mgr->mAnimator.mIsRunning;
265 animatorUseEstateTime = sky_mgr->mAnimator.mUseLindenTime;
266 backup = true;
267 }
268
230 mWater->mName = sWaterPresetName; 269 mWater->mName = sWaterPresetName;
231 water_mgr->removeParamSet( sWaterPresetName, false ); 270 water_mgr->removeParamSet( sWaterPresetName, false );
232 water_mgr->addParamSet( sWaterPresetName, *mWater ); 271 water_mgr->addParamSet( sWaterPresetName, *mWater );
233 water_mgr->savePreset( sWaterPresetName ); 272 // Don't think we need to save it, the load gets the one we added above.
273 //water_mgr->savePreset( sWaterPresetName );
234 water_mgr->loadPreset( sWaterPresetName, true ); 274 water_mgr->loadPreset( sWaterPresetName, true );
235 water_mgr->setNormalMapID( *mWaterNormal ); 275 water_mgr->setNormalMapID( *mWaterNormal );
236 276
@@ -239,13 +279,15 @@ bool WindlightMessage::apply()
239 sky_mgr->mAnimator.mUseLindenTime = false; 279 sky_mgr->mAnimator.mUseLindenTime = false;
240 sky_mgr->removeParamSet( sSkyPresetName, false ); 280 sky_mgr->removeParamSet( sSkyPresetName, false );
241 sky_mgr->addParamSet( sSkyPresetName, *mSky ); 281 sky_mgr->addParamSet( sSkyPresetName, *mSky );
242 sky_mgr->savePreset( sSkyPresetName ); 282 // Don't think we need to save it, the load gets the one we added above.
283 //sky_mgr->savePreset( sSkyPresetName );
243 sky_mgr->loadPreset( sSkyPresetName, true ); 284 sky_mgr->loadPreset( sSkyPresetName, true );
244 285
245 return true; 286 return true;
246} 287}
247 288
248 289
290// static
249bool WindlightMessage::isValid() 291bool WindlightMessage::isValid()
250{ 292{
251 return mIsValid; 293 return mIsValid;
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h
index e3cccf0..4792823 100644
--- a/linden/indra/newview/lightshare.h
+++ b/linden/indra/newview/lightshare.h
@@ -68,6 +68,10 @@ class WindlightMessage
68 // The name of the sky preset where the region settings are stored. 68 // The name of the sky preset where the region settings are stored.
69 static const std::string sSkyPresetName; 69 static const std::string sSkyPresetName;
70 70
71 // The name of the preset where the backup settings are stored.
72 static const std::string sBackupWaterPresetName;
73 static const std::string sBackupSkyPresetName;
74
71 // Message handler for GenericMessage with the "Windlight" method. 75 // Message handler for GenericMessage with the "Windlight" method.
72 // Creates and applies a new WindlightMessage (or prompts user). 76 // Creates and applies a new WindlightMessage (or prompts user).
73 static void processWindlight(LLMessageSystem* msg, void**); 77 static void processWindlight(LLMessageSystem* msg, void**);
@@ -78,6 +82,7 @@ class WindlightMessage
78 82
79 // Called after the user has entered a new region, to reset the 83 // Called after the user has entered a new region, to reset the
80 // "ignore while in this region" state. 84 // "ignore while in this region" state.
85 // Also resets/deactivates the Windlight settings in response to the "WindlightReset" method.
81 static void resetRegion(); 86 static void resetRegion();
82 87
83 // Applies/activates the Windlight settings from the message. 88 // Applies/activates the Windlight settings from the message.
diff --git a/linden/indra/newview/llviewergenericmessage.cpp b/linden/indra/newview/llviewergenericmessage.cpp
index 8078888..0bbcadd 100644
--- a/linden/indra/newview/llviewergenericmessage.cpp
+++ b/linden/indra/newview/llviewergenericmessage.cpp
@@ -91,6 +91,11 @@ void process_generic_message(LLMessageSystem* msg, void**)
91 WindlightMessage::processWindlight(msg, NULL); 91 WindlightMessage::processWindlight(msg, NULL);
92 return; 92 return;
93 } 93 }
94 else if(method == "WindlightReset")
95 {
96 WindlightMessage::resetRegion();
97 return;
98 }
94 99
95 if( agent_id != gAgent.getID() ) 100 if( agent_id != gAgent.getID() )
96 { 101 {