- fixed : @setenv_preset:<name>=force and @setenv_daycycle:<name>=force don't change the current sky preset or day cycle

--HG--
branch : RLVa
master
Kitty Barnett 2011-09-04 23:48:57 +02:00
parent 276e151642
commit a47c2185c3
6 changed files with 61 additions and 5 deletions

View File

@ -30,6 +30,10 @@
#include "lldiriterator.h"
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
#include <boost/algorithm/string.hpp>
// [/RLVa:KB]
void LLDayCycleManager::getPresetNames(preset_name_list_t& names) const
{
names.clear();
@ -60,6 +64,18 @@ void LLDayCycleManager::getPresetNames(preset_name_list_t& user, preset_name_lis
}
}
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
const std::string& LLDayCycleManager::findPreset(const std::string& strPresetName)
{
for (dc_map_t::const_iterator itCycle = mDayCycleMap.begin(); itCycle != mDayCycleMap.end(); ++itCycle)
{
if (boost::iequals(itCycle->first, strPresetName))
return itCycle->first;
}
return LLStringUtil::null;
}
// [/RLVa:KB]
void LLDayCycleManager::getUserPresetNames(preset_name_list_t& user) const
{
preset_name_list_t sys; // unused

View File

@ -51,6 +51,9 @@ public:
void getPresetNames(preset_name_list_t& names) const;
void getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const;
void getUserPresetNames(preset_name_list_t& user) const;
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
const std::string& findPreset(const std::string& strPresetName);
// [/RLVa:KB]
bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const;
bool getPreset(const std::string name, LLSD& day_cycle) const;

View File

@ -35,6 +35,10 @@
#include "llwaterparammanager.h"
#include "llwlhandlers.h"
#include "llwlparammanager.h"
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
#include <boost/algorithm/string.hpp>
#include "rlvhandler.h"
// [/RLVa:KB]
std::string LLEnvPrefs::getWaterPresetName() const
{
@ -597,6 +601,13 @@ void LLEnvManagerNew::updateWaterFromPrefs(bool interpolate)
void LLEnvManagerNew::updateManagersFromPrefs(bool interpolate)
{
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
if (gRlvHandler.hasBehaviour(RLV_BHVR_SETENV))
{
return;
}
// [/RLVa:KB]
// Apply water settings.
updateWaterFromPrefs(interpolate);

View File

@ -61,6 +61,10 @@
#include "curl/curl.h"
#include "llstreamtools.h"
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
#include <boost/algorithm/string.hpp>
// [/RLVa:KB]
LLWLParamManager::LLWLParamManager() :
//set the defaults for the controls
@ -645,6 +649,19 @@ void LLWLParamManager::getPresetNames(preset_name_list_t& region, preset_name_li
}
}
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
const std::string& LLWLParamManager::findPreset(const std::string& strPresetName, LLEnvKey::EScope eScope)
{
for (std::map<LLWLParamKey, LLWLParamSet>::const_iterator itList = mParamList.begin(); itList != mParamList.end(); itList++)
{
const LLWLParamKey& wlKey = itList->first;
if ( (wlKey.scope == eScope) && (boost::iequals(wlKey.name, strPresetName)) )
return wlKey.name;
}
return LLStringUtil::null;
}
// [/RLVa:KB]
void LLWLParamManager::getUserPresetNames(preset_name_list_t& user) const
{
preset_name_list_t region, sys; // unused

View File

@ -288,6 +288,10 @@ public:
/// @return user and system preset names as a single list
void getPresetNames(preset_name_list_t& region, preset_name_list_t& user, preset_name_list_t& sys) const;
// [RLVa:KB] - Checked: 2011-09-04 (RLVa-1.4.1a) | Added: RLVa-1.4.1a
const std::string& findPreset(const std::string& strPresetName, LLEnvKey::EScope eScope);
// [/RLVa:KB]
/// @return user preset names
void getUserPresetNames(preset_name_list_t& user) const;

View File

@ -17,6 +17,7 @@
#include "llviewerprecompiledheaders.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "lldaycyclemanager.h"
#include "llviewercontrol.h"
#include "llvoavatarself.h"
#include "llwlparammanager.h"
@ -264,7 +265,7 @@ bool RlvWindLight::setValue(const std::string& strRlvName, const std::string& st
F32 nValue = 0.0f;
// Sanity check - make sure strValue specifies a number for all settings except "preset" and "daycycle"
if ( (RlvSettings::getNoSetEnv()) ||
( (!LLStringUtil::convertToF32(strValue, nValue)) && (("preset" != strRlvName) || ("daycycle" != strRlvName)) ) )
( (!LLStringUtil::convertToF32(strValue, nValue)) && (("preset" != strRlvName) && ("daycycle" != strRlvName)) ) )
{
return false;
}
@ -288,13 +289,17 @@ bool RlvWindLight::setValue(const std::string& strRlvName, const std::string& st
}
else if ("preset" == strRlvName)
{
pEnvMgr->useSkyPreset(strValue);
return true;
std::string strPresetName = pWLParams->findPreset(strValue, LLEnvKey::SCOPE_LOCAL);
if (!strPresetName.empty())
pEnvMgr->useSkyPreset(strPresetName);
return !strPresetName.empty();
}
else if ("daycycle" == strRlvName)
{
pEnvMgr->useDayCycle(strValue, LLEnvKey::SCOPE_LOCAL);
return true;
std::string strPresetName = LLDayCycleManager::instance().findPreset(strValue);
if (!strPresetName.empty())
pEnvMgr->useDayCycle(strValue, LLEnvKey::SCOPE_LOCAL);
return !strPresetName.empty();
}
bool fError = false;