summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpreference.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterpreference.cpp')
-rwxr-xr-xindra/newview/llfloaterpreference.cpp227
1 files changed, 126 insertions, 101 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 9df7f82275..5938566b0a 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -341,6 +341,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this));
mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this));
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this));
+ mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this));
mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this));
mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));
mCommitCallbackRegistrar.add("Pref.UpdateSliderText", boost::bind(&LLFloaterPreference::refreshUI,this));
@@ -734,11 +735,11 @@ void LLFloaterPreference::onOpen(const LLSD& key)
bool started = (LLStartUp::getStartupState() == STATE_STARTED);
- LLComboBox* combo = getChild<LLComboBox>("graphic_preset_combo");
- LLButton* save_btn = findChild<LLButton>("PrefSaveButton");
- LLButton* delete_btn = findChild<LLButton>("PrefDeleteButton");
+ LLButton* load_btn = findChild<LLButton>("PrefLoadButton");
+ LLButton* save_btn = findChild<LLButton>("PrefSaveButton");
+ LLButton* delete_btn = findChild<LLButton>("PrefDeleteButton");
- combo->setEnabled(started);
+ load_btn->setEnabled(started);
save_btn->setEnabled(started);
delete_btn->setEnabled(started);
}
@@ -748,6 +749,11 @@ void LLFloaterPreference::onVertexShaderEnable()
refreshEnabledGraphics();
}
+void LLFloaterPreference::onAvatarImpostorsEnable()
+{
+ refreshEnabledGraphics();
+}
+
//static
void LLFloaterPreference::initDoNotDisturbResponse()
{
@@ -783,8 +789,6 @@ void LLFloaterPreference::setHardwareDefaults()
if (panel)
panel->setHardwareDefaults();
}
-
- LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT);
}
void LLFloaterPreference::getControlNames(std::vector<std::string>& names)
@@ -893,11 +897,6 @@ void LLFloaterPreference::onBtnOK()
LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get();
pPathfindingConsole->onRegionBoundaryCross();
}
-
- // Write settings to currently defined preset. This will recreate a missing preset file
- // and ensure the preset file matches the current settings (which may have been changed
- // via some other means).
- LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, gSavedSettings.getString("PresetGraphicActive"));
}
// static
@@ -926,14 +925,12 @@ void LLFloaterPreference::updateUserInfo(const std::string& visibility, bool im_
}
}
-
void LLFloaterPreference::refreshEnabledGraphics()
{
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
if (instance)
{
instance->refresh();
- //instance->refreshEnabledState();
}
}
@@ -1117,7 +1114,7 @@ void LLFloaterPreference::buildPopupLists()
void LLFloaterPreference::refreshEnabledState()
{
- LLUICtrl* ctrl_reflections = getChild<LLUICtrl>("Reflections");
+ LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections");
LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText");
// Reflections
@@ -1150,11 +1147,11 @@ void LLFloaterPreference::refreshEnabledState()
if (gSavedSettings.getBOOL("VertexShaderEnable") == FALSE ||
gSavedSettings.getBOOL("RenderAvatarVP") == FALSE)
{
- ctrl_avatar_cloth->setEnabled(false);
+ ctrl_avatar_cloth->setEnabled(FALSE);
}
else
{
- ctrl_avatar_cloth->setEnabled(true);
+ ctrl_avatar_cloth->setEnabled(TRUE);
}
// Vertex Shaders
@@ -1170,22 +1167,24 @@ void LLFloaterPreference::refreshEnabledState()
{
terrain_detail->setValue(1);
terrain_detail->setEnabled(FALSE);
- terrain_text->setEnabled(false);
+ terrain_text->setEnabled(FALSE);
}
else
{
terrain_detail->setEnabled(TRUE);
- terrain_text->setEnabled(true);
+ terrain_text->setEnabled(TRUE);
}
// WindLight
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
+ LLCheckBoxCtrl* ctrl_wind_light2 = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders2");
LLSliderCtrl* sky = getChild<LLSliderCtrl>("SkyMeshDetail");
LLTextBox* sky_text = getChild<LLTextBox>("SkyMeshDetailText");
// *HACK just checks to see if we can use shaders...
// maybe some cards that use shaders, but don't support windlight
ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders);
+ ctrl_wind_light2->setEnabled(ctrl_shader_enable->getEnabled() && shaders);
sky->setEnabled(ctrl_wind_light->get() && shaders);
sky_text->setEnabled(ctrl_wind_light->get() && shaders);
@@ -1207,7 +1206,7 @@ void LLFloaterPreference::refreshEnabledState()
LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO");
LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF");
- LLUICtrl* ctrl_shadow = getChild<LLUICtrl>("ShadowDetail");
+ LLComboBox* ctrl_shadow = getChild<LLComboBox>("ShadowDetail");
LLTextBox* shadow_text = getChild<LLTextBox>("RenderShadowDetailText");
// note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it
@@ -1223,6 +1222,13 @@ void LLFloaterPreference::refreshEnabledState()
ctrl_shadow->setEnabled(enabled);
shadow_text->setEnabled(enabled);
+ LLTextBox* maximum_arc_text = getChild<LLTextBox>("MaximumARCText");
+
+ enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseImpostors") && gSavedSettings.getBOOL("RenderUseImpostors");
+ getChildView("MaximumARC")->setEnabled(enabled);
+ maximum_arc_text->setEnabled(enabled);
+ getChildView("MaxNumberAvatarDrawn")->setEnabled(enabled);
+
// Hardware settings
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting();
@@ -1290,16 +1296,19 @@ void LLFloaterPreference::refreshEnabledState()
void LLFloaterPreference::disableUnavailableSettings()
{
- LLUICtrl* ctrl_reflections = getChild<LLUICtrl>("Reflections");
+ LLComboBox* ctrl_reflections = getChild<LLComboBox>("Reflections");
LLTextBox* reflections_text = getChild<LLTextBox>("ReflectionsText");
LLCheckBoxCtrl* ctrl_avatar_vp = getChild<LLCheckBoxCtrl>("AvatarVertexProgram");
LLCheckBoxCtrl* ctrl_avatar_cloth = getChild<LLCheckBoxCtrl>("AvatarCloth");
LLCheckBoxCtrl* ctrl_shader_enable = getChild<LLCheckBoxCtrl>("BasicShaders");
LLCheckBoxCtrl* ctrl_wind_light = getChild<LLCheckBoxCtrl>("WindLightUseAtmosShaders");
LLCheckBoxCtrl* ctrl_avatar_impostors = getChild<LLCheckBoxCtrl>("AvatarImpostors");
+ LLSliderCtrl* ctrl_maximum_arc = getChild<LLSliderCtrl>("MaximumARC");
+ LLTextBox* maximum_arc_text = getChild<LLTextBox>("MaximumARCText");
+ LLSliderCtrl* ctrl_max_visible = getChild<LLSliderCtrl>("MaxNumberAvatarDrawn");
LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
LLCheckBoxCtrl* ctrl_deferred2 = getChild<LLCheckBoxCtrl>("UseLightShaders2");
- LLUICtrl* ctrl_shadows = getChild<LLUICtrl>("ShadowDetail");
+ LLComboBox* ctrl_shadows = getChild<LLComboBox>("ShadowDetail");
LLTextBox* shadows_text = getChild<LLTextBox>("RenderShadowDetailText");
LLCheckBoxCtrl* ctrl_ssao = getChild<LLCheckBoxCtrl>("UseSSAO");
LLCheckBoxCtrl* ctrl_dof = getChild<LLCheckBoxCtrl>("UseDoF");
@@ -1315,12 +1324,12 @@ void LLFloaterPreference::disableUnavailableSettings()
ctrl_wind_light->setEnabled(FALSE);
ctrl_wind_light->setValue(FALSE);
- sky->setEnabled(false);
- sky_text->setEnabled(false);
+ sky->setEnabled(FALSE);
+ sky_text->setEnabled(FALSE);
ctrl_reflections->setEnabled(FALSE);
ctrl_reflections->setValue(0);
- reflections_text->setEnabled(false);
+ reflections_text->setEnabled(FALSE);
ctrl_avatar_vp->setEnabled(FALSE);
ctrl_avatar_vp->setValue(FALSE);
@@ -1330,7 +1339,7 @@ void LLFloaterPreference::disableUnavailableSettings()
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
- shadows_text->setEnabled(false);
+ shadows_text->setEnabled(FALSE);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
@@ -1350,13 +1359,13 @@ void LLFloaterPreference::disableUnavailableSettings()
ctrl_wind_light->setEnabled(FALSE);
ctrl_wind_light->setValue(FALSE);
- sky->setEnabled(false);
- sky_text->setEnabled(false);
+ sky->setEnabled(FALSE);
+ sky_text->setEnabled(FALSE);
//deferred needs windlight, disable deferred
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
- shadows_text->setEnabled(false);
+ shadows_text->setEnabled(FALSE);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
@@ -1376,7 +1385,7 @@ void LLFloaterPreference::disableUnavailableSettings()
{
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
- shadows_text->setEnabled(false);
+ shadows_text->setEnabled(FALSE);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
@@ -1402,7 +1411,7 @@ void LLFloaterPreference::disableUnavailableSettings()
{
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
- shadows_text->setEnabled(false);
+ shadows_text->setEnabled(FALSE);
}
// disabled reflections
@@ -1410,7 +1419,7 @@ void LLFloaterPreference::disableUnavailableSettings()
{
ctrl_reflections->setEnabled(FALSE);
ctrl_reflections->setValue(FALSE);
- reflections_text->setEnabled(false);
+ reflections_text->setEnabled(FALSE);
}
// disabled av
@@ -1425,7 +1434,7 @@ void LLFloaterPreference::disableUnavailableSettings()
//deferred needs AvatarVP, disable deferred
ctrl_shadows->setEnabled(FALSE);
ctrl_shadows->setValue(0);
- shadows_text->setEnabled(false);
+ shadows_text->setEnabled(FALSE);
ctrl_ssao->setEnabled(FALSE);
ctrl_ssao->setValue(FALSE);
@@ -1451,6 +1460,9 @@ void LLFloaterPreference::disableUnavailableSettings()
{
ctrl_avatar_impostors->setEnabled(FALSE);
ctrl_avatar_impostors->setValue(FALSE);
+ ctrl_maximum_arc->setEnabled(FALSE);
+ maximum_arc_text->setEnabled(FALSE);
+ ctrl_max_visible->setEnabled(FALSE);
}
}
@@ -1469,15 +1481,12 @@ void LLFloaterPreference::refresh()
updateSliderText(getChild<LLSliderCtrl>("FlexibleMeshDetail", true), getChild<LLTextBox>("FlexibleMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("TreeMeshDetail", true), getChild<LLTextBox>("TreeMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail", true), getChild<LLTextBox>("AvatarMeshDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("AvatarMeshDetail2", true), getChild<LLTextBox>("AvatarMeshDetailText2", true));
updateSliderText(getChild<LLSliderCtrl>("AvatarPhysicsDetail", true), getChild<LLTextBox>("AvatarPhysicsDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("TerrainMeshDetail", true), getChild<LLTextBox>("TerrainMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("RenderPostProcess", true), getChild<LLTextBox>("PostProcessText", true));
updateSliderText(getChild<LLSliderCtrl>("SkyMeshDetail", true), getChild<LLTextBox>("SkyMeshDetailText", true));
updateSliderText(getChild<LLSliderCtrl>("TerrainDetail", true), getChild<LLTextBox>("TerrainDetailText", true));
- updateSliderText(getChild<LLSliderCtrl>("MaximumARC", true), getChild<LLTextBox>("MaximumARCText", true));
- updateSliderText(getChild<LLSliderCtrl>("Reflections", true), getChild<LLTextBox>("ReflectionsText", true));
- updateSliderText(getChild<LLSliderCtrl>("ShadowDetail", true), getChild<LLTextBox>("RenderShadowDetailText", true));
+ updateMaximumArcText(getChild<LLSliderCtrl>("MaximumARC", true), getChild<LLTextBox>("MaximumARCText", true));
}
void LLFloaterPreference::onCommitWindowedMode()
@@ -1733,22 +1742,6 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b
{
if (text_box == NULL || ctrl== NULL)
return;
-
- std::string name = ctrl->getName();
-
- if ("ShadowDetail" == name)
- {
- U32 value = (U32)ctrl->getValue().asInteger();
- text_box->setText(getString("RenderShadowDetail" + llformat("%d", value)));
- return;
- }
-
- if ("Reflections" == name)
- {
- U32 value = (U32)ctrl->getValue().asInteger();
- text_box->setText(getString("Reflections" + llformat("%d", value)));
- return;
- }
// get range and points when text should change
F32 value = (F32)ctrl->getValue().asReal();
@@ -1772,35 +1765,42 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b
{
text_box->setText(LLTrans::getString("GraphicsQualityHigh"));
}
+}
+
+void LLFloaterPreference::updateMaximumArcText(LLSliderCtrl* ctrl, LLTextBox* text_box)
+{
+ F32 min_result = 20000.0f;
+ F32 max_result = 300000.0f;
- if ("MaximumARC" == name)
+ F32 value = (F32)ctrl->getValue().asReal();
+
+ if (101.0f == value)
+ {
+ // It has been decided that having the slider all the way to the right will be the off position, which
+ // is a value of 101, so it is necessary to change value to 0 disable impostor generation.
+ value = 0.0f;
+ text_box->setText(LLTrans::getString("Off"));
+ }
+ else
{
- F32 control_value = value;
- if (0.0f == control_value)
- {
- text_box->setText(LLTrans::getString("Off"));
- }
- else
- {
- // 100 is the maximum value of this control set in panel_preferences_graphics1.xml
- F32 minp = 0.0f;
- F32 maxp = 100.0f;
- // The result should be between 20,000 and 500,000
- F32 minv = log(20000.0f);
- F32 maxv = log(500000.0f);
+ // 100 is the maximum value of this control set in panel_preferences_graphics1.xml
+ F32 minp = 1.0f;
+ F32 maxp = 100.0f;
- // calculate adjustment factor
- F32 scale = (maxv - minv) / (maxp - minp);
+ // The result should be between min_result and max_result
+ F32 minv = log(min_result);
+ F32 maxv = log(max_result);
- control_value = exp(minv + scale * (control_value - minp));
+ // calculate adjustment factor
+ F32 scale = (maxv - minv) / (maxp - minp);
- // Invert result
- control_value = 500000.0f - control_value;
- }
+ value = exp(minv + scale * (value - minp));
- gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)control_value);
+ text_box->setText(llformat("%0.0f", value));
}
+
+ gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)value);
}
void LLFloaterPreference::onChangeMaturity()
@@ -2002,9 +2002,9 @@ LLPanelPreference::LLPanelPreference()
{
mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2));
mCommitCallbackRegistrar.add("Pref.updateMediaAutoPlayCheckbox", boost::bind(&LLPanelPreference::updateMediaAutoPlayCheckbox, this, _1));
- mCommitCallbackRegistrar.add("Pref.Preset", boost::bind(&LLPanelPreference::onChangePreset, this, _2));
- mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::DeletePreset, this, _2));
- mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::SavePreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::deletePreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefSave", boost::bind(&LLPanelPreference::savePreset, this, _2));
+ mCommitCallbackRegistrar.add("Pref.PrefLoad", boost::bind(&LLPanelPreference::loadPreset, this, _2));
}
//virtual
@@ -2202,31 +2202,22 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl)
}
}
-void LLPanelPreference::DeletePreset(const LLSD& user_data)
+void LLPanelPreference::deletePreset(const LLSD& user_data)
{
std::string subdirectory = user_data.asString();
LLFloaterReg::showInstance("delete_pref_preset", subdirectory);
}
-void LLPanelPreference::SavePreset(const LLSD& user_data)
+void LLPanelPreference::savePreset(const LLSD& user_data)
{
std::string subdirectory = user_data.asString();
LLFloaterReg::showInstance("save_pref_preset", subdirectory);
}
-void LLPanelPreference::onChangePreset(const LLSD& user_data)
+void LLPanelPreference::loadPreset(const LLSD& user_data)
{
std::string subdirectory = user_data.asString();
-
- LLComboBox* combo = getChild<LLComboBox>(subdirectory + "_preset_combo");
- std::string name = combo->getSimple();
-
- LLPresetsManager::getInstance()->loadPreset(subdirectory, name);
- LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
- if (instance)
- {
- instance->refreshEnabledGraphics();
- }
+ LLFloaterReg::showInstance("load_pref_preset", subdirectory);
}
void LLPanelPreference::setHardwareDefaults()
@@ -2288,27 +2279,51 @@ BOOL LLPanelPreferenceGraphics::postBuild()
}
#endif
- LLComboBox* combo = getChild<LLComboBox>("graphic_preset_combo");
- combo->setLabel(LLTrans::getString("preset_combo_label"));
-
- setPresetNamesInComboBox();
+ resetDirtyChilds();
+ setPresetText();
LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this));
return LLPanelPreference::postBuild();
}
+void LLPanelPreferenceGraphics::draw()
+{
+ setPresetText();
+ LLPanelPreference::draw();
+}
+
void LLPanelPreferenceGraphics::onPresetsListChange()
{
- setPresetNamesInComboBox();
+ resetDirtyChilds();
+ setPresetText();
}
-void LLPanelPreferenceGraphics::setPresetNamesInComboBox()
+void LLPanelPreferenceGraphics::setPresetText()
{
- LLComboBox* combo = getChild<LLComboBox>("graphic_preset_combo");
+ LLTextBox* preset_text = getChild<LLTextBox>("preset_text");
+
+ std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive");
+
+ if (hasDirtyChilds() && !preset_graphic_active.empty())
+ {
+ gSavedSettings.setString("PresetGraphicActive", "");
+ preset_graphic_active.clear();
+ // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown
+ // panel to update.
+ LLPresetsManager::getInstance()->triggerChangeSignal();
+ }
+
+ if (!preset_graphic_active.empty())
+ {
+ preset_text->setText(preset_graphic_active);
+ }
+ else
+ {
+ preset_text->setText(LLTrans::getString("none_paren_cap"));
+ }
- EDefaultOptions option = DEFAULT_SHOW;
- LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option);
+ preset_text->resetDirty();
}
bool LLPanelPreferenceGraphics::hasDirtyChilds()
@@ -2325,7 +2340,17 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds()
if (ctrl)
{
if (ctrl->isDirty())
- return true;
+ {
+ LLControlVariable* control = ctrl->getControlVariable();
+ if (control)
+ {
+ std::string control_name = control->getName();
+ if (!control_name.empty())
+ {
+ return true;
+ }
+ }
+ }
}
// Push children onto the end of the work stack
for (child_list_t::const_iterator iter = curview->getChildList()->begin();
@@ -2333,7 +2358,8 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds()
{
view_stack.push_back(*iter);
}
- }
+ }
+
return false;
}
@@ -2363,7 +2389,6 @@ void LLPanelPreferenceGraphics::resetDirtyChilds()
void LLPanelPreferenceGraphics::cancel()
{
- resetDirtyChilds();
LLPanelPreference::cancel();
}
void LLPanelPreferenceGraphics::saveSettings()