From 0e5c8ed390927f4ad96d0687ecca0f096c0541f5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 4 May 2016 10:16:53 -0400 Subject: add max avatar complexity slider to basic graphics preferences --- indra/newview/llfloaterpreference.cpp | 47 ++++++++++++++++------ indra/newview/llfloaterpreference.h | 14 ++++++- .../default/xui/en/panel_preferences_graphics1.xml | 35 ++++++++++++++++ 3 files changed, 83 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 227d0eac77..36bdcf4d89 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -362,6 +362,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) 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.UpdateIndirectMaxComplexity", boost::bind(&LLFloaterPreference::updateMaxComplexity, 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)); @@ -838,7 +839,7 @@ void LLFloaterPreference::setHardwareDefaults() LLFeatureManager::getInstance()->applyRecommendedSettings(); // reset indirects before refresh because we may have changed what they control - LLFloaterPreferenceGraphicsAdvanced::setIndirectControls(); + LLAvatarComplexityControls::setIndirectControls(); refreshEnabledGraphics(); gSavedSettings.setString("PresetGraphicActive", ""); @@ -1374,7 +1375,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() } // static -void LLFloaterPreferenceGraphicsAdvanced::setIndirectControls() +void LLAvatarComplexityControls::setIndirectControls() { /* * We have controls that have an indirect relationship between the control @@ -1390,7 +1391,7 @@ void LLFloaterPreferenceGraphicsAdvanced::setIndirectControls() } // static -void LLFloaterPreferenceGraphicsAdvanced::setIndirectMaxNonImpostors() +void LLAvatarComplexityControls::setIndirectMaxNonImpostors() { U32 max_non_impostors = gSavedSettings.getU32("RenderAvatarMaxNonImpostors"); // for this one, we just need to make zero, which means off, the max value of the slider @@ -1398,7 +1399,7 @@ void LLFloaterPreferenceGraphicsAdvanced::setIndirectMaxNonImpostors() gSavedSettings.setU32("IndirectMaxNonImpostors", indirect_max_non_impostors); } -void LLFloaterPreferenceGraphicsAdvanced::setIndirectMaxArc() +void LLAvatarComplexityControls::setIndirectMaxArc() { U32 max_arc = gSavedSettings.getU32("RenderAvatarMaxComplexity"); U32 indirect_max_arc; @@ -1567,6 +1568,9 @@ void LLFloaterPreferenceGraphicsAdvanced::disableUnavailableSettings() void LLFloaterPreference::refresh() { LLPanel::refresh(); + LLAvatarComplexityControls::setText( + gSavedSettings.getU32("RenderAvatarMaxComplexity"), + getChild("IndirectMaxComplexityText", true)); refreshEnabledState(); LLFloater* advanced = LLFloaterReg::findTypedInstance("prefs_graphics_advanced"); if (advanced) @@ -1591,9 +1595,13 @@ void LLFloaterPreferenceGraphicsAdvanced::refresh() updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); - setIndirectControls(); - setMaxNonImpostorsText(gSavedSettings.getU32("RenderAvatarMaxNonImpostors"),getChild("IndirectMaxNonImpostorsText", true)); - setMaxComplexityText(gSavedSettings.getU32("RenderAvatarMaxComplexity"),getChild("IndirectMaxComplexityText", true)); + LLAvatarComplexityControls::setIndirectControls(); + setMaxNonImpostorsText( + gSavedSettings.getU32("RenderAvatarMaxNonImpostors"), + getChild("IndirectMaxNonImpostorsText", true)); + LLAvatarComplexityControls::setText( + gSavedSettings.getU32("RenderAvatarMaxComplexity"), + getChild("IndirectMaxComplexityText", true)); refreshEnabledState(); } @@ -1904,12 +1912,11 @@ void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTe } } -void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() +void LLAvatarComplexityControls::updateMax(LLSliderCtrl* slider, LLTextBox* value_label) { // Called when the IndirectMaxComplexity control changes // Responsible for fixing the slider label (IndirectMaxComplexityText) and setting RenderAvatarMaxComplexity - LLSliderCtrl* ctrl = getChild("IndirectMaxComplexity"); - U32 indirect_value = ctrl->getValue().asInteger(); + U32 indirect_value = slider->getValue().asInteger(); U32 max_arc; if (INDIRECT_MAX_ARC_OFF == indirect_value) @@ -1927,10 +1934,10 @@ void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() } gSavedSettings.setU32("RenderAvatarMaxComplexity", (U32)max_arc); - setMaxComplexityText(max_arc, getChild("IndirectMaxComplexityText")); + setText(max_arc, value_label); } -void LLFloaterPreferenceGraphicsAdvanced::setMaxComplexityText(U32 value, LLTextBox* text_box) +void LLAvatarComplexityControls::setText(U32 value, LLTextBox* text_box) { if (0 == value) { @@ -1942,6 +1949,22 @@ void LLFloaterPreferenceGraphicsAdvanced::setMaxComplexityText(U32 value, LLText } } +void LLFloaterPreference::updateMaxComplexity() +{ + // Called when the IndirectMaxComplexity control changes + LLAvatarComplexityControls::updateMax( + getChild("IndirectMaxComplexity"), + getChild("IndirectMaxComplexityText")); +} + +void LLFloaterPreferenceGraphicsAdvanced::updateMaxComplexity() +{ + // Called when the IndirectMaxComplexity control changes + LLAvatarComplexityControls::updateMax( + getChild("IndirectMaxComplexity"), + getChild("IndirectMaxComplexityText")); +} + void LLFloaterPreference::onChangeMaturity() { U8 sim_access = gSavedSettings.getU32("PreferredMaturity"); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index ed692c903e..fa0c09e97a 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -181,6 +181,7 @@ private: void onDeleteTranscripts(); void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response); void updateDeleteTranscriptsButton(); + void updateMaxComplexity(); static std::string sSkin; notifications_map mNotificationOptions; @@ -267,7 +268,7 @@ private: class LLFloaterPreferenceGraphicsAdvanced : public LLFloater { -public: + public: LLFloaterPreferenceGraphicsAdvanced(const LLSD& key); ~LLFloaterPreferenceGraphicsAdvanced(); void onOpen(const LLSD& key); @@ -289,6 +290,17 @@ public: LOG_CLASS(LLFloaterPreferenceGraphicsAdvanced); }; +class LLAvatarComplexityControls +{ + public: + static void updateMax(LLSliderCtrl* slider, LLTextBox* value_label); + static void setText(U32 value, LLTextBox* text_box); + static void setIndirectControls(); + static void setIndirectMaxNonImpostors(); + static void setIndirectMaxArc(); + LOG_CLASS(LLAvatarComplexityControls); +}; + class LLFloaterPreferenceProxy : public LLFloater { public: diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 6cf9045f2a..157668feb1 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -231,6 +231,41 @@ m + + + + + 0 + +