From 29a28522e200d4f6bc393e0cc7ed76584687de09 Mon Sep 17 00:00:00 2001
From: Jacek Antonelli
Date: Sat, 31 Jul 2010 04:13:28 -0500
Subject: Fixed a Linden typo that made the object cache useless. (SNOW-783)
---
linden/indra/newview/llviewerregion.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp
index 69405d2..4257f70 100644
--- a/linden/indra/newview/llviewerregion.cpp
+++ b/linden/indra/newview/llviewerregion.cpp
@@ -374,7 +374,7 @@ void LLViewerRegion::saveCache()
std::string filename;
filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"") + gDirUtilp->getDirDelimiter() +
- llformat("sobjects_%d_%d.slc", U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS );
+ llformat("objects_%d_%d.slc", U32(mHandle>>32)/REGION_WIDTH_UNITS, U32(mHandle)/REGION_WIDTH_UNITS );
LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */
if (!fp)
--
cgit v1.1
From e4475e45edde706332718908b1ebbef924c44b4f Mon Sep 17 00:00:00 2001
From: Jacek Antonelli
Date: Tue, 27 Jul 2010 04:08:19 -0500
Subject: Refactored a bunch of messy LightShare code.
---
linden/indra/newview/CMakeLists.txt | 2 +
linden/indra/newview/lightshare.cpp | 302 ++++++++++++++++++++++++
linden/indra/newview/lightshare.h | 67 ++++++
linden/indra/newview/llviewergenericmessage.cpp | 110 +--------
linden/indra/newview/llwindlightremotectrl.cpp | 3 +-
linden/indra/newview/meta7windlight.h | 35 +++
6 files changed, 416 insertions(+), 103 deletions(-)
create mode 100644 linden/indra/newview/lightshare.cpp
create mode 100644 linden/indra/newview/lightshare.h
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index a5f2cbb..7077dde 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -76,6 +76,7 @@ set(viewer_SOURCE_FILES
hippoRestRequest.cpp
jcfloater_animation_list.cpp
jcfloaterareasearch.cpp
+ lightshare.cpp
llagent.cpp
llagentaccess.cpp
llagentdata.cpp
@@ -507,6 +508,7 @@ set(viewer_HEADER_FILES
hippoRestRequest.h
jcfloater_animation_list.h
jcfloaterareasearch.h
+ lightshare.h
llagent.h
llagentaccess.h
llagentdata.h
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp
new file mode 100644
index 0000000..24d4139
--- /dev/null
+++ b/linden/indra/newview/lightshare.cpp
@@ -0,0 +1,302 @@
+/**
+ * @file lightshare.cpp
+ * @brief Handler for Meta7 Lightshare (region-side Windlight settings).
+ *
+ * Copyright (c) 2010, Tom Meta / Meta7
+ * Copyright (c) 2010, Jacek Antonelli
+ *
+ * The source code in this file ("Source Code") is provided to you
+ * under the terms of the GNU General Public License, version 2.0
+ * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
+ * this distribution, or online at
+ * http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ */
+
+
+#include "lightshare.h"
+
+#include "linden_common.h"
+
+#include "lluuid.h"
+#include "llviewercontrol.h"
+#include "llwaterparammanager.h"
+#include "llwaterparamset.h"
+#include "llwlparammanager.h"
+#include "llwlparamset.h"
+#include "message.h"
+#include "meta7windlight.h"
+
+
+// The names of the presets where the region settings are stored.
+const std::string WindlightMessage::sWaterPresetName = "(Region settings)";
+const std::string WindlightMessage::sSkyPresetName = "(Region settings)";
+
+
+WindlightMessage::WindlightMessage( LLMessageSystem* msg ) :
+ mPacket(NULL),
+ mWater(NULL),
+ mSky(NULL),
+ mWaterNormal(NULL),
+ mIsValid(false)
+{
+ std::string method;
+ msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method);
+
+ if( method != "Windlight" )
+ {
+ return; // Wrong message type, somehow.
+ }
+
+ S32 size = msg->getSizeFast(_PREHASH_ParamList, 0,
+ _PREHASH_Parameter);
+
+ if( size < 0 || 250 < size )
+ {
+ return; // Too small or too big.
+ }
+
+ // Unpack and process the message's binary payload.
+ char buf[250];
+ msg->getBinaryDataFast(_PREHASH_ParamList,
+ _PREHASH_Parameter,
+ buf, size, 0, 249);
+
+ mWater = new LLWaterParamSet();
+ mSky = new LLWLParamSet();
+ mWaterNormal = LLUUID();
+
+ process_packet(&buf[0]);
+ process_water();
+ process_sky();
+
+ // *TODO: Actually validate the settings.
+ mIsValid = true;
+}
+
+
+WindlightMessage::~WindlightMessage()
+{
+ delete mWater;
+ delete mSky;
+}
+
+
+// static
+void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
+{
+ if( gSavedSettings.getBOOL("UseServersideWindlightSettings") )
+ {
+ WindlightMessage wl = WindlightMessage(msg);
+ if( wl.isValid() )
+ {
+ wl.apply();
+ }
+ }
+}
+
+
+bool WindlightMessage::apply()
+{
+ LLWaterParamManager* water_mgr = LLWaterParamManager::instance();
+ LLWLParamManager* sky_mgr = LLWLParamManager::instance();
+
+ mWater->mName = sWaterPresetName;
+ water_mgr->removeParamSet( sWaterPresetName, false );
+ water_mgr->addParamSet( sWaterPresetName, *mWater );
+ water_mgr->savePreset( sWaterPresetName );
+ water_mgr->loadPreset( sWaterPresetName, true );
+ water_mgr->setNormalMapID( mWaterNormal );
+
+ mSky->mName = sSkyPresetName;
+ sky_mgr->mAnimator.mIsRunning = false;
+ sky_mgr->mAnimator.mUseLindenTime = false;
+ sky_mgr->removeParamSet( sSkyPresetName, false );
+ sky_mgr->addParamSet( sSkyPresetName, *mSky );
+ sky_mgr->savePreset( sSkyPresetName );
+ sky_mgr->loadPreset( sSkyPresetName, true );
+
+ return true;
+}
+
+
+bool WindlightMessage::isValid()
+{
+ return mIsValid;
+}
+
+
+void WindlightMessage::process_packet( char* buf )
+{
+ // *FIXME: Horrible idea, fragile, not byte-order or endian
+ // safe, no validation, etc. etc. -Jacek
+ mPacket = (Meta7WindlightPacket*)buf;
+}
+
+
+void WindlightMessage::process_water()
+{
+ mWater->set("waterFogColor",
+ mPacket->waterColor.red / 256.f,
+ mPacket->waterColor.green / 256.f,
+ mPacket->waterColor.blue / 256.f);
+
+ mWater->set("waterFogDensity",
+ pow(2.0f, mPacket->waterFogDensityExponent));
+
+ mWater->set("underWaterFogMod", mPacket->underwaterFogModifier);
+
+ mWater->set("normScale",
+ mPacket->reflectionWaveletScale.X,
+ mPacket->reflectionWaveletScale.Y,
+ mPacket->reflectionWaveletScale.Z);
+
+ mWater->set("fresnelScale", mPacket->fresnelScale);
+ mWater->set("fresnelOffset", mPacket->fresnelOffset);
+ mWater->set("scaleAbove", mPacket->refractScaleAbove);
+ mWater->set("scaleBelow", mPacket->refractScaleBelow);
+ mWater->set("blurMultiplier", mPacket->blurMultiplier);
+
+ mWater->set("wave1Dir",
+ mPacket->littleWaveDirection.X,
+ mPacket->littleWaveDirection.Y);
+
+ mWater->set("wave2Dir",
+ mPacket->bigWaveDirection.X,
+ mPacket->bigWaveDirection.Y);
+
+
+ // Format a UUID string from a block of raw bytes. Ugh.
+ std::string uuid = llformat(
+ "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ (U8)(mPacket->normalMapTexture[0]),
+ (U8)(mPacket->normalMapTexture[1]),
+ (U8)(mPacket->normalMapTexture[2]),
+ (U8)(mPacket->normalMapTexture[3]),
+ (U8)(mPacket->normalMapTexture[4]),
+ (U8)(mPacket->normalMapTexture[5]),
+ (U8)(mPacket->normalMapTexture[6]),
+ (U8)(mPacket->normalMapTexture[7]),
+ (U8)(mPacket->normalMapTexture[8]),
+ (U8)(mPacket->normalMapTexture[9]),
+ (U8)(mPacket->normalMapTexture[10]),
+ (U8)(mPacket->normalMapTexture[11]),
+ (U8)(mPacket->normalMapTexture[12]),
+ (U8)(mPacket->normalMapTexture[13]),
+ (U8)(mPacket->normalMapTexture[14]),
+ (U8)(mPacket->normalMapTexture[15]));
+
+ mWaterNormal.set(uuid);
+}
+
+
+void WindlightMessage::process_sky()
+{
+ mSky->setSunAngle(F_TWO_PI * mPacket->sunMoonPosiiton);
+ mSky->setEastAngle(F_TWO_PI * mPacket->eastAngle);
+
+ mSky->set("sunlight_color",
+ mPacket->sunMoonColor.red * 3.0f,
+ mPacket->sunMoonColor.green * 3.0f,
+ mPacket->sunMoonColor.blue * 3.0f,
+ mPacket->sunMoonColor.alpha * 3.0f);
+
+ mSky->set("ambient",
+ mPacket->ambient.red * 3.0f,
+ mPacket->ambient.green * 3.0f,
+ mPacket->ambient.blue * 3.0f,
+ mPacket->ambient.alpha * 3.0f);
+
+ mSky->set("blue_horizon",
+ mPacket->horizon.red * 2.0f,
+ mPacket->horizon.green *2.0f,
+ mPacket->horizon.blue * 2.0f,
+ mPacket->horizon.alpha * 2.0f);
+
+ mSky->set("blue_density",
+ mPacket->blueDensity.red * 2.0f,
+ mPacket->blueDensity.green * 2.0f,
+ mPacket->blueDensity.blue * 2.0f,
+ mPacket->blueDensity.alpha * 2.0f);
+
+ mSky->set("haze_horizon",
+ mPacket->hazeHorizon,
+ mPacket->hazeHorizon,
+ mPacket->hazeHorizon,
+ 1.f);
+
+ mSky->set("haze_density",
+ mPacket->hazeDensity,
+ 0.f, 0.f, 1.f);
+
+ mSky->set("cloud_shadow",
+ mPacket->cloudCoverage,
+ 0.f, 0.f, 1.f);
+
+ mSky->set("density_multiplier",
+ mPacket->densityMultiplier / 1000.0f,
+ 0.f, 0.f, 1.f);
+
+ mSky->set("distance_multiplier",
+ mPacket->distanceMultiplier,
+ 0.f, 0.f, 1.f);
+
+ mSky->set("max_y",
+ (F32)mPacket->maxAltitude,
+ 0.f, 0.f, 1.f);
+
+ mSky->set("cloud_color",
+ mPacket->cloudColor.red,
+ mPacket->cloudColor.green,
+ mPacket->cloudColor.blue,
+ mPacket->cloudColor.alpha);
+
+ mSky->set("cloud_pos_density1",
+ mPacket->cloudXYDensity.X,
+ mPacket->cloudXYDensity.Y,
+ mPacket->cloudXYDensity.Z,
+ 1.f);
+
+ mSky->set("cloud_pos_density2",
+ mPacket->cloudDetailXYDensity.X,
+ mPacket->cloudDetailXYDensity.Y,
+ mPacket->cloudDetailXYDensity.Z,
+ 1.f);
+
+ mSky->set("cloud_scale",
+ mPacket->cloudScale,
+ 0.f, 0.f, 1.f);
+
+ mSky->set("gamma",
+ mPacket->sceneGamma,
+ 0.f, 0.f, 1.f);
+
+ mSky->set("glow",
+ (2 - mPacket->sunGlowSize) * 20,
+ 0.f,
+ -mPacket->sunGlowFocus * 5,
+ 1.f);
+
+ mSky->setCloudScrollX(mPacket->cloudScrollX + 10.0f);
+ mSky->setCloudScrollY(mPacket->cloudScrollY + 10.0f);
+
+ mSky->setEnableCloudScrollX(!mPacket->cloudScrollXLock);
+ mSky->setEnableCloudScrollY(!mPacket->cloudScrollYLock);
+
+ mSky->setStarBrightness(mPacket->starBrightness);
+}
+
+
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h
new file mode 100644
index 0000000..a76cd1b
--- /dev/null
+++ b/linden/indra/newview/lightshare.h
@@ -0,0 +1,67 @@
+/**
+ * @file lightshare.h
+ * @brief Public interface for lightshare.cpp
+ *
+ * Copyright (c) 2010, Jacek Antonelli
+ *
+ * The source code in this file ("Source Code") is provided to you
+ * under the terms of the GNU General Public License, version 2.0
+ * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
+ * this distribution, or online at
+ * http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ */
+
+
+#ifndef LIGHTSHARE_H
+#define LIGHTSHARE_H
+
+#include "message.h"
+#include "meta7windlight.h"
+#include "llwaterparamset.h"
+#include "llwlparamset.h"
+
+
+// Encapsulates a "Windlight" (LightShare) message sent from the
+// server, allowing the settings to be applied at a later time.
+//
+class WindlightMessage
+{
+ public:
+
+ static const std::string sWaterPresetName;
+ static const std::string sSkyPresetName;
+
+ WindlightMessage( LLMessageSystem* msg );
+ ~WindlightMessage();
+ static void processWindlight(LLMessageSystem* msg, void**);
+ bool apply();
+ bool isValid();
+
+ private:
+
+ Meta7WindlightPacket* mPacket;
+ LLWaterParamSet* mWater;
+ LLWLParamSet* mSky;
+ LLUUID mWaterNormal;
+ bool mIsValid;
+
+ void process_packet( char* buf );
+ void process_water();
+ void process_sky();
+};
+
+#endif
diff --git a/linden/indra/newview/llviewergenericmessage.cpp b/linden/indra/newview/llviewergenericmessage.cpp
index c9954b3..8078888 100644
--- a/linden/indra/newview/llviewergenericmessage.cpp
+++ b/linden/indra/newview/llviewergenericmessage.cpp
@@ -32,18 +32,15 @@
*/
#include "llviewerprecompiledheaders.h"
-
#include "llviewergenericmessage.h"
-#include "meta7windlight.h"
+
#include "lldispatcher.h"
#include "lluuid.h"
#include "message.h"
#include "llagent.h"
-#include "llwaterparamset.h"
-#include "llwaterparammanager.h"
-#include "llwlparamset.h"
-#include "llwlparammanager.h"
#include "lluuid.h"
+#include "lightshare.h"
+
LLDispatcher gGenericDispatcher;
@@ -88,109 +85,20 @@ void process_generic_message(LLMessageSystem* msg, void**)
std::string method;
msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method);
- //This needs to be handled by a dispatcher really, but I'm not sure where is the best place to put it
- if (method == "Windlight" && gSavedSettings.getBOOL("UseServersideWindlightSettings"))
+ // TODO: Use a proper dispatcher.
+ if(method == "Windlight")
{
- //Meta7 WindLight packet
- //We are delivering with an agentID of NULL_KEY so as to be
- //friendly and not trigger a warning for unsupporting clients.
- S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList);
- for (S32 i = 0; i < count; ++i)
- {
- // our param is binary data)
- S32 size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter);
- if (size >= 0)
- {
- char buf[250];
- msg->getBinaryDataFast(
- _PREHASH_ParamList, _PREHASH_Parameter,
- buf, size, i, 249);
-
- Meta7WindlightPacket* wl = (Meta7WindlightPacket*)buf;
-
- LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
- LLWaterParamSet & param_set = param_mgr->mCurParams;
-
- param_set.set("waterFogColor", wl->waterColor.red / 256.f, wl->waterColor.green / 256.f, wl->waterColor.blue / 256.f);
- param_set.set("waterFogDensity", pow(2.0f, wl->waterFogDensityExponent));
- param_set.set("underWaterFogMod", wl->underwaterFogModifier);
- param_set.set("normScale", wl->reflectionWaveletScale.X,wl->reflectionWaveletScale.Y,wl->reflectionWaveletScale.Z);
- param_set.set("fresnelScale", wl->fresnelScale);
- param_set.set("fresnelOffset", wl->fresnelOffset);
- param_set.set("scaleAbove", wl->refractScaleAbove);
- param_set.set("scaleBelow", wl->refractScaleBelow);
- param_set.set("blurMultiplier", wl->blurMultiplier);
- param_set.set("wave1Dir", wl->littleWaveDirection.X, wl->littleWaveDirection.Y);
- param_set.set("wave2Dir", wl->bigWaveDirection.X, wl->bigWaveDirection.Y);
-
- LLUUID normalMapTexture;
-
- std::string out = llformat(
- "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- (U8)(wl->normalMapTexture[0]),
- (U8)(wl->normalMapTexture[1]),
- (U8)(wl->normalMapTexture[2]),
- (U8)(wl->normalMapTexture[3]),
- (U8)(wl->normalMapTexture[4]),
- (U8)(wl->normalMapTexture[5]),
- (U8)(wl->normalMapTexture[6]),
- (U8)(wl->normalMapTexture[7]),
- (U8)(wl->normalMapTexture[8]),
- (U8)(wl->normalMapTexture[9]),
- (U8)(wl->normalMapTexture[10]),
- (U8)(wl->normalMapTexture[11]),
- (U8)(wl->normalMapTexture[12]),
- (U8)(wl->normalMapTexture[13]),
- (U8)(wl->normalMapTexture[14]),
- (U8)(wl->normalMapTexture[15]));
-
- normalMapTexture.set(out);
-
- param_mgr->setParamSet( "Meta7CurrentRegion", param_set);
- param_mgr->setNormalMapID(normalMapTexture);
-
- LLWLParamManager * wl_param_mgr = LLWLParamManager::instance();
- LLWLParamSet & wl_param_set = wl_param_mgr->mCurParams;
- wl_param_set.setSunAngle(F_TWO_PI * wl->sunMoonPosiiton);
- wl_param_set.setEastAngle(F_TWO_PI * wl->eastAngle);
- wl_param_set.set("sunlight_color", wl->sunMoonColor.red * 3.0f, wl->sunMoonColor.green * 3.0f, wl->sunMoonColor.blue * 3.0f, wl->sunMoonColor.alpha * 3.0f);
- wl_param_set.set("ambient", wl->ambient.red * 3.0f, wl->ambient.green * 3.0f, wl->ambient.blue * 3.0f, wl->ambient.alpha * 3.0f);
- wl_param_set.set("blue_horizon", wl->horizon.red * 2.0f, wl->horizon.green *2.0f, wl->horizon.blue * 2.0f, wl->horizon.alpha * 2.0f);
- wl_param_set.set("blue_density", wl->blueDensity.red * 2.0f, wl->blueDensity.green * 2.0f, wl->blueDensity.blue * 2.0f, wl->blueDensity.alpha * 2.0f);
- wl_param_set.set("haze_horizon", wl->hazeHorizon, wl->hazeHorizon, wl->hazeHorizon, 1.f);
- wl_param_set.set("haze_density", wl->hazeDensity, wl->hazeDensity, wl->hazeDensity, 1.f);
- wl_param_set.set("cloud_shadow", wl->cloudCoverage, wl->cloudCoverage, wl->cloudCoverage, wl->cloudCoverage);
- wl_param_set.set("density_multiplier", wl->densityMultiplier / 1000.0f);
- wl_param_set.set("distance_multiplier", wl->distanceMultiplier, wl->distanceMultiplier, wl->distanceMultiplier, wl->distanceMultiplier);
- wl_param_set.set("max_y",(F32)wl->maxAltitude);
- wl_param_set.set("cloud_color", wl->cloudColor.red, wl->cloudColor.green, wl->cloudColor.blue, wl->cloudColor.alpha);
- wl_param_set.set("cloud_pos_density1", wl->cloudXYDensity.X, wl->cloudXYDensity.Y, wl->cloudXYDensity.Z);
- wl_param_set.set("cloud_pos_density2", wl->cloudDetailXYDensity.X, wl->cloudDetailXYDensity.Y, wl->cloudDetailXYDensity.Z);
- wl_param_set.set("cloud_scale", wl->cloudScale, 0.f, 0.f, 1.f);
- wl_param_set.set("gamma", wl->sceneGamma, wl->sceneGamma, wl->sceneGamma, 0.0f);
- wl_param_set.set("glow",(2 - wl->sunGlowSize) * 20 , 0.f, -wl->sunGlowFocus * 5);
- wl_param_set.setCloudScrollX(wl->cloudScrollX + 10.0f);
- wl_param_set.setCloudScrollY(wl->cloudScrollY + 10.0f);
- wl_param_set.setEnableCloudScrollX(!wl->cloudScrollXLock);
- wl_param_set.setEnableCloudScrollY(!wl->cloudScrollYLock);
- wl_param_set.setStarBrightness(wl->starBrightness);
- wl_param_mgr->removeParamSet("Meta7-CurrentRegion",true);
- wl_param_mgr->addParamSet( "Meta7-CurrentRegion", wl_param_set);
- wl_param_mgr->savePreset( "Meta7-CurrentRegion");
- LLWLParamManager::instance()->mAnimator.mIsRunning = false;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = false;
- wl_param_mgr->loadPreset( "Meta7-CurrentRegion",true);
- }
- }
+ WindlightMessage::processWindlight(msg, NULL);
+ return;
}
- else if (agent_id != gAgent.getID())
+
+ if( agent_id != gAgent.getID() )
{
llwarns << "GenericMessage for wrong agent" << llendl;
return;
}
else
{
-
std::string request;
LLUUID invoice;
LLDispatcher::sparam_t strings;
diff --git a/linden/indra/newview/llwindlightremotectrl.cpp b/linden/indra/newview/llwindlightremotectrl.cpp
index 0beb3e5..b5c15a5 100644
--- a/linden/indra/newview/llwindlightremotectrl.cpp
+++ b/linden/indra/newview/llwindlightremotectrl.cpp
@@ -173,8 +173,7 @@ void LLWindlightRemoteCtrl::refreshPresets()
mPresetsCombo->addSimpleElement(getString("midnight"), ADD_BOTTOM);
mPresetsCombo->addSimpleElement(getString("revert_region"), ADD_BOTTOM);
- if (mPresetsCombo->getSelectedItemLabel() != currentParams.mName &&
- !currentParams.mName.empty())
+ if (!currentParams.mName.empty())
{
mPresetsCombo->selectByValue(LLSD(currentParams.mName));
}
diff --git a/linden/indra/newview/meta7windlight.h b/linden/indra/newview/meta7windlight.h
index 9927558..04ce86d 100644
--- a/linden/indra/newview/meta7windlight.h
+++ b/linden/indra/newview/meta7windlight.h
@@ -1,3 +1,36 @@
+/**
+ * @file lightshare.cpp
+ * @brief Handler for Meta7 Lightshare (region-side Windlight settings).
+ *
+ * Copyright (c) 2010, Tom Meta / Meta7 Project
+ *
+ * The source code in this file ("Source Code") is provided to you
+ * under the terms of the GNU General Public License, version 2.0
+ * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
+ * this distribution, or online at
+ * http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ */
+
+
+#ifndef META7WINDLIGHT_H
+#define META7WINDLIGHT_H
+
+#include "linden_common.h"
+
struct M7Color3{
M7Color3(){};
M7Color3(F32 pRed, F32 pGreen, F32 pBlue)
@@ -94,3 +127,5 @@ struct Meta7WindlightPacket {
};
+
+#endif
--
cgit v1.1
From 3b8cfc9fbbb8ede46b9bd34b0ad1c59a8d047e9e Mon Sep 17 00:00:00 2001
From: Jacek Antonelli
Date: Wed, 28 Jul 2010 04:02:47 -0500
Subject: Added confirmation dialog before applying LightShare settings.
If you are using a preset other than the default preset or
the LightShare preset, the viewer will now ask you whether
to apply settings received from the server.
---
linden/indra/newview/lightshare.cpp | 37 ++++++++++++++++++++--
linden/indra/newview/lightshare.h | 4 +++
.../skins/default/xui/en-us/notifications.xml | 19 +++++++++++
3 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp
index 24d4139..aa5443b 100644
--- a/linden/indra/newview/lightshare.cpp
+++ b/linden/indra/newview/lightshare.cpp
@@ -100,14 +100,45 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
{
if( gSavedSettings.getBOOL("UseServersideWindlightSettings") )
{
- WindlightMessage wl = WindlightMessage(msg);
- if( wl.isValid() )
+ WindlightMessage* wl = new WindlightMessage(msg);
+ if( wl->isValid() )
{
- wl.apply();
+ std::string water = LLWaterParamManager::instance()->mCurParams.mName;
+ std::string sky = LLWLParamManager::instance()->mCurParams.mName;
+
+ // If they are using the default or region settings, just apply
+ // the new settings, don't bother asking.
+ if((sky == "Default" || sky == sSkyPresetName) &&
+ (water == "Default" || water == sWaterPresetName))
+ {
+ wl->apply();
+ delete wl;
+ }
+ else
+ {
+ LLNotifications::instance()
+ .add("ConfirmLightShare",
+ LLSD(), LLSD(),
+ boost::bind(&applyCallback, _1, _2, wl));
+ }
}
}
}
+// static
+bool WindlightMessage::applyCallback(const LLSD& notification,
+ const LLSD& response,
+ WindlightMessage* wl)
+{
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ if( option == 0 )
+ {
+ wl->apply();
+ }
+ delete wl;
+ return false;
+}
+
bool WindlightMessage::apply()
{
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h
index a76cd1b..2bf95c6 100644
--- a/linden/indra/newview/lightshare.h
+++ b/linden/indra/newview/lightshare.h
@@ -48,6 +48,10 @@ class WindlightMessage
WindlightMessage( LLMessageSystem* msg );
~WindlightMessage();
static void processWindlight(LLMessageSystem* msg, void**);
+ static bool applyCallback(const LLSD& notification,
+ const LLSD& response,
+ WindlightMessage* wl);
+
bool apply();
bool isValid();
diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
index 975f10b..2a0af02 100644
--- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
@@ -6992,6 +6992,25 @@ Shadows cannot be enabled due to your graphics settings being set too low. Make
Note: To comply with the Second Life Terms of Service, Imprudence did not download any texture files for the exported object(s).
+
+This region has custom sky and water settings.
+
+Apply region settings now?
+
+
+
--
cgit v1.1
From fc0899df14e13eb7b20cf37b2c1f37a7412b5475 Mon Sep 17 00:00:00 2001
From: Jacek Antonelli
Date: Thu, 29 Jul 2010 00:48:07 -0500
Subject: No longer reset Windlight settings after teleport.
It was part of the LightShare changes, but it annoys people.
---
linden/indra/newview/llviewermessage.cpp | 6 ------
1 file changed, 6 deletions(-)
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index ecbe0ef..353fd9f 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -138,8 +138,6 @@
#include "llviewerdisplay.h"
#include "llkeythrottle.h"
-#include "llwlparammanager.h"
-#include "llwaterparammanager.h"
#include "panelradarentry.h"
#include
@@ -3224,10 +3222,6 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
gCacheName->setUpstream(sim);
*/
- // Reset windlight settings to default
- LLWLParamManager::instance()->mAnimator.mIsRunning = true;
- LLWLParamManager::instance()->mAnimator.mUseLindenTime = true;
-
// now, use the circuit info to tell simulator about us!
LL_INFOS("Messaging") << "process_teleport_finish() Enabling "
<< sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL;
--
cgit v1.1
From 8314920310fa11d5974d733da6817176f7cc9b93 Mon Sep 17 00:00:00 2001
From: Jacek Antonelli
Date: Thu, 29 Jul 2010 04:13:45 -0500
Subject: Don't spam user with ConfirmLightShare notifications.
Now only one notification is created, but the class remembers
the most recent settings and discards the old ones.
---
linden/indra/newview/lightshare.cpp | 33 +++++++++++++++++++++++++--------
linden/indra/newview/lightshare.h | 5 +++--
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp
index aa5443b..c9f34ee 100644
--- a/linden/indra/newview/lightshare.cpp
+++ b/linden/indra/newview/lightshare.cpp
@@ -45,6 +45,8 @@
const std::string WindlightMessage::sWaterPresetName = "(Region settings)";
const std::string WindlightMessage::sSkyPresetName = "(Region settings)";
+WindlightMessage* WindlightMessage::sMostRecent = NULL;
+
WindlightMessage::WindlightMessage( LLMessageSystem* msg ) :
mPacket(NULL),
@@ -116,10 +118,23 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
}
else
{
- LLNotifications::instance()
- .add("ConfirmLightShare",
- LLSD(), LLSD(),
- boost::bind(&applyCallback, _1, _2, wl));
+ if( sMostRecent == NULL )
+ {
+ // No most recent, so store this and create notification
+ // asking the user whether to apply or not.
+ sMostRecent = wl;
+ LLNotifications::instance()
+ .add("ConfirmLightShare",
+ LLSD(), LLSD(),
+ boost::bind(&applyCallback, _1, _2));
+ }
+ else
+ {
+ // No new notification (to avoid spamming the user), just
+ // store this as most recent.
+ delete sMostRecent;
+ sMostRecent = wl;
+ }
}
}
}
@@ -127,15 +142,17 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
// static
bool WindlightMessage::applyCallback(const LLSD& notification,
- const LLSD& response,
- WindlightMessage* wl)
+ const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
if( option == 0 )
{
- wl->apply();
+ sMostRecent->apply();
}
- delete wl;
+
+ delete sMostRecent;
+ sMostRecent = NULL;
+
return false;
}
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h
index 2bf95c6..cbc03ad 100644
--- a/linden/indra/newview/lightshare.h
+++ b/linden/indra/newview/lightshare.h
@@ -49,14 +49,15 @@ class WindlightMessage
~WindlightMessage();
static void processWindlight(LLMessageSystem* msg, void**);
static bool applyCallback(const LLSD& notification,
- const LLSD& response,
- WindlightMessage* wl);
+ const LLSD& response);
bool apply();
bool isValid();
private:
+ static WindlightMessage* sMostRecent;
+
Meta7WindlightPacket* mPacket;
LLWaterParamSet* mWater;
LLWLParamSet* mSky;
--
cgit v1.1
From c80bc0e259ddf4afe6e8811684ffb505edf6d2a8 Mon Sep 17 00:00:00 2001
From: Jacek Antonelli
Date: Thu, 29 Jul 2010 21:01:21 -0500
Subject: Added a timer after ignoring LightShare settings.
If you ignore a LightShare setting, all settings for the next
30 seconds will be ignored. The timer resets each time a new
message is ignored. Customize with LightShareIgnoreTimer
in Debug Settings.
---
linden/indra/newview/app_settings/settings.xml | 11 +++++++++
linden/indra/newview/lightshare.cpp | 31 +++++++++++++++++++++++++-
linden/indra/newview/lightshare.h | 7 ++++++
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index a59fac6..e2871ad 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -310,6 +310,17 @@
Value
0
+ LightShareIgnoreTimer
+
MapShowAgentCount
+ LightShareAllowed
+
LightShareIgnoreTimer
-
-
- UseServersideWindlightSettings
-
-
-
UseStartScreen
+ PrivatePointAtTarget
+
SavedRenderFarClip
-
+ ShowClientColor
+
+ ShowClientNameHoverTip
+
ShowClientNameTag
-
+
ShowMyClientTagToOthers