MAINT-6435 Deafult preset should set the same settings as the "Reset to recommended settings" button
parent
67f8d57927
commit
0d5edb03a2
|
|
@ -809,3 +809,62 @@ void LLFeatureManager::applyBaseMasks()
|
|||
maskFeatures("safe");
|
||||
}
|
||||
}
|
||||
|
||||
LLSD LLFeatureManager::getRecommendedSettingsMap()
|
||||
{
|
||||
// Create the map and fill it with the hardware recommended settings.
|
||||
// It's needed to create an initial Default graphics preset (MAINT-6435).
|
||||
// The process is similar to the one LLFeatureManager::applyRecommendedSettings() does.
|
||||
|
||||
LLSD map(LLSD::emptyMap());
|
||||
|
||||
loadGPUClass();
|
||||
U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5));
|
||||
LL_INFOS("RenderInit") << "Getting the map of recommended settings for level " << level << LL_ENDL;
|
||||
|
||||
applyBaseMasks();
|
||||
std::string features(isValidGraphicsLevel(level) ? getNameForGraphicsLevel(level) : "Low");
|
||||
|
||||
maskFeatures(features);
|
||||
|
||||
LLControlVariable* ctrl = gSavedSettings.getControl("RenderQualityPerformance"); // include the quality value for correct preset loading
|
||||
map["RenderQualityPerformance"]["Value"] = (LLSD::Integer)level;
|
||||
map["RenderQualityPerformance"]["Comment"] = ctrl->getComment();;
|
||||
map["RenderQualityPerformance"]["Persist"] = 1;
|
||||
map["RenderQualityPerformance"]["Type"] = LLControlGroup::typeEnumToString(ctrl->type());
|
||||
|
||||
|
||||
|
||||
for (feature_map_t::iterator mIt = mFeatures.begin(); mIt != mFeatures.end(); ++mIt)
|
||||
{
|
||||
LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first);
|
||||
if (ctrl == NULL)
|
||||
{
|
||||
LL_WARNS() << "AHHH! Control setting " << mIt->first << " does not exist!" << LL_ENDL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ctrl->isType(TYPE_BOOLEAN))
|
||||
{
|
||||
map[mIt->first]["Value"] = (LLSD::Boolean)getRecommendedValue(mIt->first);
|
||||
}
|
||||
else if (ctrl->isType(TYPE_S32) || ctrl->isType(TYPE_U32))
|
||||
{
|
||||
map[mIt->first]["Value"] = (LLSD::Integer)getRecommendedValue(mIt->first);
|
||||
}
|
||||
else if (ctrl->isType(TYPE_F32))
|
||||
{
|
||||
map[mIt->first]["Value"] = (LLSD::Real)getRecommendedValue(mIt->first);
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "AHHH! Control variable is not a numeric type!" << LL_ENDL;
|
||||
continue;
|
||||
}
|
||||
map[mIt->first]["Comment"] = ctrl->getComment();;
|
||||
map[mIt->first]["Persist"] = 1;
|
||||
map[mIt->first]["Type"] = LLControlGroup::typeEnumToString(ctrl->type());
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,9 @@ public:
|
|||
|
||||
// load the dynamic GPU/feature table from a website
|
||||
void fetchHTTPTables();
|
||||
|
||||
|
||||
LLSD getRecommendedSettingsMap();
|
||||
|
||||
protected:
|
||||
bool loadGPUClass();
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "llviewercontrol.h"
|
||||
#include "llfloaterpreference.h"
|
||||
#include "llfloaterreg.h"
|
||||
#include "llfeaturemanager.h"
|
||||
|
||||
LLPresetsManager::LLPresetsManager()
|
||||
{
|
||||
|
|
@ -60,7 +61,7 @@ void LLPresetsManager::createMissingDefault()
|
|||
LL_INFOS() << "No default preset found -- creating one at " << default_file << LL_ENDL;
|
||||
|
||||
// Write current graphic settings as the default
|
||||
savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT);
|
||||
savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -134,7 +135,7 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam
|
|||
presets = mPresetNames;
|
||||
}
|
||||
|
||||
bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name)
|
||||
bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string name, bool createDefault)
|
||||
{
|
||||
if (LLTrans::getString(PRESETS_DEFAULT) == name)
|
||||
{
|
||||
|
|
@ -146,11 +147,10 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n
|
|||
|
||||
if(PRESETS_GRAPHIC == subdirectory)
|
||||
{
|
||||
gSavedSettings.setString("PresetGraphicActive", name);
|
||||
|
||||
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
|
||||
if (instance)
|
||||
if (instance && !createDefault)
|
||||
{
|
||||
gSavedSettings.setString("PresetGraphicActive", name);
|
||||
instance->getControlNames(name_list);
|
||||
LL_DEBUGS() << "saving preset '" << name << "'; " << name_list.size() << " names" << LL_ENDL;
|
||||
name_list.push_back("PresetGraphicActive");
|
||||
|
|
@ -170,23 +170,36 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n
|
|||
LL_ERRS() << "Invalid presets directory '" << subdirectory << "'" << LL_ENDL;
|
||||
}
|
||||
|
||||
if (name_list.size() > 1) // if the active preset name is the only thing in the list, don't save the list
|
||||
if (name_list.size() > 1 // if the active preset name is the only thing in the list, don't save the list
|
||||
|| (createDefault && name == PRESETS_DEFAULT && subdirectory == PRESETS_GRAPHIC)) // or create a default graphics preset from hw recommended settings
|
||||
{
|
||||
// make an empty llsd
|
||||
LLSD paramsData(LLSD::emptyMap());
|
||||
|
||||
for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it)
|
||||
if (createDefault)
|
||||
{
|
||||
std::string ctrl_name = *it;
|
||||
LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get();
|
||||
std::string comment = ctrl->getComment();
|
||||
std::string type = LLControlGroup::typeEnumToString(ctrl->type());
|
||||
LLSD value = ctrl->getValue();
|
||||
paramsData = LLFeatureManager::getInstance()->getRecommendedSettingsMap();
|
||||
if (gSavedSettings.getU32("RenderAvatarMaxComplexity") == 0)
|
||||
{
|
||||
// use the recommended setting as an initial one (MAINT-6435)
|
||||
gSavedSettings.setU32("RenderAvatarMaxComplexity", paramsData["RenderAvatarMaxComplexity"]["Value"].asInteger());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (std::vector<std::string>::iterator it = name_list.begin(); it != name_list.end(); ++it)
|
||||
{
|
||||
std::string ctrl_name = *it;
|
||||
LLControlVariable* ctrl = gSavedSettings.getControl(ctrl_name).get();
|
||||
std::string comment = ctrl->getComment();
|
||||
std::string type = LLControlGroup::typeEnumToString(ctrl->type());
|
||||
LLSD value = ctrl->getValue();
|
||||
|
||||
paramsData[ctrl_name]["Comment"] = comment;
|
||||
paramsData[ctrl_name]["Persist"] = 1;
|
||||
paramsData[ctrl_name]["Type"] = type;
|
||||
paramsData[ctrl_name]["Value"] = value;
|
||||
paramsData[ctrl_name]["Comment"] = comment;
|
||||
paramsData[ctrl_name]["Persist"] = 1;
|
||||
paramsData[ctrl_name]["Type"] = type;
|
||||
paramsData[ctrl_name]["Value"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml");
|
||||
|
|
@ -203,10 +216,12 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, std::string n
|
|||
|
||||
LL_DEBUGS() << "saved preset '" << name << "'; " << paramsData.size() << " parameters" << LL_ENDL;
|
||||
|
||||
gSavedSettings.setString("PresetGraphicActive", name);
|
||||
|
||||
// signal interested parties
|
||||
triggerChangeSignal();
|
||||
if (!createDefault)
|
||||
{
|
||||
gSavedSettings.setString("PresetGraphicActive", name);
|
||||
// signal interested parties
|
||||
triggerChangeSignal();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
static std::string getPresetsDir(const std::string& subdirectory);
|
||||
void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo, EDefaultOptions default_option);
|
||||
void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option);
|
||||
bool savePreset(const std::string& subdirectory, std::string name);
|
||||
bool savePreset(const std::string& subdirectory, std::string name, bool createDefault = false);
|
||||
void loadPreset(const std::string& subdirectory, std::string name);
|
||||
bool deletePreset(const std::string& subdirectory, std::string name);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue