From 0858ba2d0a7253e7f9f4db84560da6f829f7270c Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Nov 2014 12:37:46 -0500 Subject: clean up showing avatar draw costs --- indra/newview/llviewermenu.cpp | 9 +-- indra/newview/llvoavatar.cpp | 77 ++++++++++++++-------- indra/newview/pipeline.h | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 8 +-- 4 files changed, 59 insertions(+), 37 deletions(-) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 3abeba4b43..79c353f30c 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -978,10 +978,6 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY; } - else if ("shame" == info_display) - { - return LLPipeline::RENDER_DEBUG_SHAME; - } else if ("texture area" == info_display) { return LLPipeline::RENDER_DEBUG_TEXTURE_AREA; @@ -1010,9 +1006,9 @@ U32 info_display_from_string(std::string info_display) { return LLPipeline::RENDER_DEBUG_COMPOSITION; } - else if ("attachment bytes" == info_display) + else if ("avatardrawinfo" == info_display) { - return LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES; + return (LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO); } else if ("glow" == info_display) { @@ -1048,6 +1044,7 @@ U32 info_display_from_string(std::string info_display) } else { + LL_WARNS() << "unrecognized feature name '" << info_display << "'" << LL_ENDL; return 0; } }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 22b979aa09..d5d93e82a8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3089,9 +3089,6 @@ bool LLVOAvatar::isVisuallyMuted() if (!isSelf()) { - static LLCachedControl render_auto_mute_functions(gSavedSettings, "RenderAutoMuteFunctions", 0); - if (render_auto_mute_functions) // Hacky debug switch for developing feature - { // Priority order (highest priority first) // * own avatar is never visually muted // * if on the "always draw normally" list, draw them normally @@ -3124,7 +3121,7 @@ bool LLVOAvatar::isVisuallyMuted() else { // Determine if visually muted or not - U32 max_cost = (U32) (max_render_cost*(LLVOAvatar::sLODFactor+0.5)); + U32 max_cost = (U32) (max_render_cost); muted = LLMuteList::getInstance()->isMuted(getID()) || (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || @@ -3140,8 +3137,7 @@ bool LLVOAvatar::isVisuallyMuted() } // Always draw friends or those in IMs. Needs UI? - if ((render_auto_mute_functions & 0x02) && - (muted || sMaxVisible == 0)) // Don't mute friends or IMs + if (muted || sMaxVisible == 0) // Don't mute friends or IMs { muted = !(LLAvatarTracker::instance().isBuddy(getID())); if (muted) @@ -3158,7 +3154,6 @@ bool LLVOAvatar::isVisuallyMuted() mCachedVisualMute = muted; } } - } } return muted; @@ -7956,28 +7951,58 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d void LLVOAvatar::idleUpdateRenderCost() { - static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - static const U32 ARC_LIMIT = 20000; + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO)) + { + std::string render_info_text; + F32 worst_ratio = 0.f; + F32 red_level, green_level; + + static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); + render_info_text.append(llformat("%.1f KB%s", mAttachmentGeometryBytes/1024.f, + (max_attachment_bytes > 0 && mAttachmentGeometryBytes > max_attachment_bytes) ? "!" : "")); - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_ATTACHMENT_BYTES)) - { //set debug text to attachment geometry bytes here so render cost will override - setDebugText(llformat("%.1f KB, %.2f m^2", mAttachmentGeometryBytes/1024.f, mAttachmentSurfaceArea)); - } + if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this + { + if ((mAttachmentGeometryBytes/(F32)max_attachment_bytes) > worst_ratio) + { + worst_ratio = mAttachmentGeometryBytes/(F32)max_attachment_bytes; + green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); + red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); + } + } + + static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); + render_info_text.append(llformat(" %.2f m^2%s", mAttachmentSurfaceArea, + (max_attachment_area > 0 && mAttachmentSurfaceArea > max_attachment_area) ? "!" : "")); - if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME) && max_render_cost == 0) - { - return; - } + if (max_attachment_area != 0) // zero means don't care, so don't bother coloring based on this + { + if ((mAttachmentSurfaceArea/max_attachment_area) > worst_ratio) + { + worst_ratio = mAttachmentSurfaceArea/max_attachment_area; + green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f); + red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f); + } + } - calculateUpdateRenderCost(); // Update mVisualComplexity if needed - - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) - { - std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus()); - setDebugText(llformat("%s %d", viz_string.c_str(), mVisualComplexity)); - F32 green = 1.f-llclamp(((F32) mVisualComplexity-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f); - F32 red = llmin((F32) mVisualComplexity/(F32)ARC_LIMIT, 1.f); - mText->setColor(LLColor4(red,green,0,1)); + calculateUpdateRenderCost(); // Update mVisualComplexity if needed + + static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); + render_info_text.append(llformat(" %d%s", mVisualComplexity, + (max_render_cost > 0 && mVisualComplexity > max_render_cost) ? "!" : "")); + + if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this + { + if (((F32)mVisualComplexity/(F32)max_render_cost) > worst_ratio) + { + worst_ratio = (F32)mVisualComplexity/(F32)max_render_cost; + green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); + red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); + } + } + + setDebugText(render_info_text); + mText->setColor(worst_ratio != 0.f ? LLColor4(red_level,green_level,0,1) : LLColor4::green); } } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index ce2f4b17b1..869fe6ffae 100755 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -518,7 +518,7 @@ public: RENDER_DEBUG_BATCH_SIZE = 0x00004000, RENDER_DEBUG_ALPHA_BINS = 0x00008000, RENDER_DEBUG_RAYCAST = 0x00010000, - RENDER_DEBUG_SHAME = 0x00020000, + RENDER_DEBUG_AVATAR_DRAW_INFO = 0x00020000, RENDER_DEBUG_SHADOW_FRUSTA = 0x00040000, RENDER_DEBUG_SCULPTED = 0x00080000, RENDER_DEBUG_AVATAR_VOLUME = 0x00100000, diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index de441983d0..21e15ba270 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1533,14 +1533,14 @@ parameter="scene_load_stats" /> + label="Show Draw Information for Avatars" + name="Avatar Draw Info"> + parameter="avatardrawinfo" /> + parameter="avatardrawinfo" /> Date: Thu, 13 Nov 2014 13:26:34 -0500 Subject: fix warning for gcc that clang did not care about --- indra/newview/llvoavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d5d93e82a8..e0128463f3 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7955,7 +7955,8 @@ void LLVOAvatar::idleUpdateRenderCost() { std::string render_info_text; F32 worst_ratio = 0.f; - F32 red_level, green_level; + F32 red_level = 0.f; + F32 green_level = 0.f; static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); render_info_text.append(llformat("%.1f KB%s", mAttachmentGeometryBytes/1024.f, -- cgit v1.2.3 From 41500add1e7dc392c9505fa544aca09b2954054f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 21 Nov 2014 18:33:00 -0500 Subject: STORM-2082 Pulled in Oz's render weight changes --- doc/contributions.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/contributions.txt b/doc/contributions.txt index 2d27562e37..36b9cf536d 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -717,6 +717,7 @@ Jonathan Yap STORM-2030 STORM-2034 STORM-2018 + STORM-2082 Kadah Coba STORM-1060 STORM-1843 -- cgit v1.2.3 From b92dd27878c73d23dec9859b317babfde749b33b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 23 Nov 2014 12:11:51 -0500 Subject: STORM-2082 Allow saving and loading of graphic settings --- indra/newview/app_settings/settings.xml | 4 +- indra/newview/llfloaterpreference.cpp | 43 +- indra/newview/llfloaterpreference.h | 2 + .../skins/default/xui/en/floater_preferences.xml | 10 +- .../xui/en/menu_preferences_graphics_gear.xml | 21 + .../default/xui/en/panel_preferences_graphics1.xml | 1764 ++++++++++---------- 6 files changed, 968 insertions(+), 876 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_preferences_graphics_gear.xml diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f2fb9e854f..2e8737f0d7 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9737,13 +9737,13 @@ RenderTerrainDetail Comment - Detail applied to terrain texturing (0 = none, 1 or 2 = full) + Detail applied to terrain texturing (0 = none, 1 = full) Persist 1 Type S32 Value - 2 + 1 RenderTerrainLODFactor diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d3773767d0..3b64ffcf4c 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1099,8 +1099,7 @@ void LLFloaterPreference::buildPopupLists() void LLFloaterPreference::refreshEnabledState() { - LLComboBox* ctrl_reflections = getChild("Reflections"); - LLRadioGroup* radio_reflection_detail = getChild("ReflectionDetailRadio"); + LLUICtrl* ctrl_reflections = getChild("Reflections"); // Reflections BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") @@ -1113,8 +1112,6 @@ void LLFloaterPreference::refreshEnabledState() bool bumpshiny = gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); bumpshiny_ctrl->setEnabled(bumpshiny ? TRUE : FALSE); - radio_reflection_detail->setEnabled(reflections); - // Avatar Mode // Enable Avatar Shaders LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); @@ -1143,20 +1140,19 @@ void LLFloaterPreference::refreshEnabledState() // Vertex Shaders // Global Shader Enable LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); - // radio set for terrain detail mode - LLRadioGroup* mRadioTerrainDetail = getChild("TerrainDetailRadio"); // can be linked with control var + LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); BOOL shaders = ctrl_shader_enable->get(); if (shaders) { - mRadioTerrainDetail->setValue(1); - mRadioTerrainDetail->setEnabled(FALSE); + terrain_detail->setValue(1); + terrain_detail->setEnabled(FALSE); } else { - mRadioTerrainDetail->setEnabled(TRUE); + terrain_detail->setEnabled(TRUE); } // WindLight @@ -1209,7 +1205,7 @@ void LLFloaterPreference::refreshEnabledState() void LLFloaterPreference::disableUnavailableSettings() { - LLComboBox* ctrl_reflections = getChild("Reflections"); + LLUICtrl* ctrl_reflections = getChild("Reflections"); LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); @@ -1360,6 +1356,8 @@ void LLFloaterPreference::refresh() { LLPanel::refresh(); + refreshEnabledState(); + // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes @@ -1372,8 +1370,9 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); - - refreshEnabledState(); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); + updateReflectionsText(getChild("Reflections", true), getChild("ReflectionsText", true)); + updateRenderShadowDetailText(getChild("RenderShadowDetail", true), getChild("RenderShadowDetailText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1625,6 +1624,23 @@ void LLFloaterPreference::refreshUI() refresh(); } +void LLFloaterPreference::updateReflectionsText(LLSliderCtrl* ctrl, LLTextBox* text_box) +{ + if (text_box == NULL || ctrl== NULL) + return; + + U32 value = (U32)ctrl->getValue().asInteger(); + text_box->setText(getString("Reflections" + llformat("%d", value))); +} +void LLFloaterPreference::updateRenderShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box) +{ + if (text_box == NULL || ctrl== NULL) + return; + + U32 value = (U32)ctrl->getValue().asInteger(); + text_box->setText(getString("RenderShadowDetail" + llformat("%d", value))); +} + void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { if (text_box == NULL || ctrl== NULL) @@ -2093,6 +2109,9 @@ static LLPanelInjector t_pref_privacy("panel_preferenc BOOL LLPanelPreferenceGraphics::postBuild() { + LLComboBox* graphic_preset = getChild("graphic_preset_combo"); + graphic_preset->setLabel(getString("graphic_preset_combo_label")); + return LLPanelPreference::postBuild(); } void LLPanelPreferenceGraphics::draw() diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 7bf6ae7d79..3ac5b2ad81 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -157,6 +157,8 @@ public: void onChangeQuality(const LLSD& data); void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateReflectionsText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateRenderShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box); void refreshUI(); void onCommitParcelMediaAutoPlayEnable(); diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index bd6faf4ed8..edc205927c 100755 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -11,7 +11,15 @@ single_instance="true" title="PREFERENCES" width="658"> - - - + + + + + + + -- cgit v1.2.3 From 42821c7c54ff2eed5327262bf26b28ad429ee1d3 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 25 Nov 2014 09:02:28 -0500 Subject: STORM-2082 Small fix for button highlighting issue --- indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml | 2 ++ 1 file changed, 2 insertions(+) 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 72976deaed..955c0f1a41 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -168,6 +168,7 @@ control_name="ShowAdvancedGraphicsSettings" enabled_control="ShowAdvancedGraphicsSettings" is_toggle="true" + image_selected="PushButton_Off" follows="top|left" height="23" label="Basic Settings" @@ -180,6 +181,7 @@ control_name="ShowAdvancedGraphicsSettings" disabled_control="ShowAdvancedGraphicsSettings" is_toggle="true" + image_disabled_selected="PushButton_Disabled" follows="top|left" height="23" label="Advanced Settings" -- cgit v1.2.3 From ea0216f67c12195aadb1993180c28c43b04294bd Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 25 Nov 2014 16:33:53 -0500 Subject: STORM-2082 Add tab containers, remove buttons and obsolete debug setting --- indra/newview/app_settings/settings.xml | 11 - .../default/textures/icons/FastPrefs_Icon.png | Bin 0 -> 268 bytes indra/newview/skins/default/textures/textures.xml | 2 + .../xui/en/menu_preferences_graphics_gear.xml | 21 - .../default/xui/en/panel_preferences_graphics1.xml | 1467 ++++++++++---------- .../skins/default/xui/en/panel_status_bar.xml | 11 +- 6 files changed, 759 insertions(+), 753 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/FastPrefs_Icon.png delete mode 100644 indra/newview/skins/default/xui/en/menu_preferences_graphics_gear.xml diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2e8737f0d7..17b43901a9 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10529,17 +10529,6 @@ Value 0 - ShowAdvancedGraphicsSettings - - Comment - Show advanced graphics settings - Persist - 1 - Type - Boolean - Value - 0 - ShowAllObjectHoverTip Comment diff --git a/indra/newview/skins/default/textures/icons/FastPrefs_Icon.png b/indra/newview/skins/default/textures/icons/FastPrefs_Icon.png new file mode 100644 index 0000000000..380d3812d8 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/FastPrefs_Icon.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 1f10d966d5..2dbf9d1bab 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -204,6 +204,8 @@ with the same filename but different name + + diff --git a/indra/newview/skins/default/xui/en/menu_preferences_graphics_gear.xml b/indra/newview/skins/default/xui/en/menu_preferences_graphics_gear.xml deleted file mode 100644 index 0e0f8f6865..0000000000 --- a/indra/newview/skins/default/xui/en/menu_preferences_graphics_gear.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - 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 955c0f1a41..0a7cc995c7 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -20,8 +20,8 @@ left="5" name="label" top="10" - width="120"> - Graphic Presets: + width="60"> + Presets: - - - + width="115"> + + + - + function="Pref.QualityPerformance"/> + - - - + + + + diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 064ece6e4b..a1f7503269 100755 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -35,7 +35,7 @@ 24:00 AM PST + + + Graphic Presets + + diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index a1f7503269..bb38c384a8 100755 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -105,14 +105,13 @@ width="145"> 24:00 AM PST - Loading... - + + + -None saved yet- + -- cgit v1.2.3 From 563e22e81c6bf14bca6370b098a257f94f4f843f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 30 Nov 2014 11:24:22 -0500 Subject: STORM-2082 Make code more generic to handle the future camera presets. --- indra/newview/llfloaterdeleteprefpreset.cpp | 9 +- indra/newview/llfloaterdeleteprefpreset.h | 2 + indra/newview/llfloaterpreference.cpp | 6 +- indra/newview/llpresetsmanager.cpp | 122 ++++++++++++++-------------- indra/newview/llpresetsmanager.h | 12 +-- 5 files changed, 75 insertions(+), 76 deletions(-) diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index 5dc51c4223..bef5b4e3bf 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -49,14 +49,14 @@ BOOL LLFloaterDeletePrefPreset::postBuild() void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) { - std::string param = key.asString(); - std::string floater_title = getString(std::string("title_") + param); + std::string mSubdirectory = key.asString(); + std::string floater_title = getString(std::string("title_") + mSubdirectory); setTitle(floater_title); LLComboBox* combo = getChild("preset_combo"); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(combo); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo); } void LLFloaterDeletePrefPreset::onBtnDelete() @@ -64,6 +64,7 @@ void LLFloaterDeletePrefPreset::onBtnDelete() LLComboBox* combo = getChild("preset_combo"); std::string name = combo->getSimple(); + // Ignore return status LLPresetsManager::getInstance()->deletePreset(name); } @@ -71,7 +72,7 @@ void LLFloaterDeletePrefPreset::onPresetsListChange() { LLComboBox* combo = getChild("preset_combo"); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(combo); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, combo); } void LLFloaterDeletePrefPreset::onBtnCancel() diff --git a/indra/newview/llfloaterdeleteprefpreset.h b/indra/newview/llfloaterdeleteprefpreset.h index fc531ca1b7..356bc1a437 100644 --- a/indra/newview/llfloaterdeleteprefpreset.h +++ b/indra/newview/llfloaterdeleteprefpreset.h @@ -46,6 +46,8 @@ public: private: void onPresetsListChange(); + + std::string mSubdirectory; }; #endif // LL_LLFLOATERDELETEPREFPRESET_H diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6b798f6549..508d82522e 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -749,7 +749,9 @@ void LLFloaterPreference::onOpen(const LLSD& key) { LL_WARNS() << "No " << default_file << " found -- creating one" << LL_ENDL; // Write current graphic settings to default.xml - LLPresetsManager::getInstance()->savePreset("Default"); + // If this name is to be localized additional code will be needed to delete the old default + // when changing languages. + LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, "Default"); } } @@ -2160,7 +2162,7 @@ void LLPanelPreferenceGraphics::setPresetNamesInComboBox() { LLComboBox* combo = getChild("graphic_preset_combo"); - LLPresetsManager::getInstance()->setPresetNamesInComboBox(combo); + LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo); } void LLPanelPreferenceGraphics::draw() diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 6b0023d97a..6e00a90ae5 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -45,7 +45,8 @@ LLPresetsManager::~LLPresetsManager() { } -std::string LLPresetsManager::getUserDir(const std::string& subdirectory) +//std::string LLPresetsManager::getUserDir(const std::string& subdirectory) +std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) { std::string presets_path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR); std::string full_path; @@ -64,22 +65,7 @@ std::string LLPresetsManager::getUserDir(const std::string& subdirectory) return full_path; } -std::string LLPresetsManager::getCameraPresetsDir() -{ - return getUserDir(PRESETS_CAMERA); -} - -std::string LLPresetsManager::getGraphicPresetsDir() -{ - return getUserDir(PRESETS_GRAPHIC); -} - -void LLPresetsManager::getPresetNames(preset_name_list_t& presets) const -{ - presets = mPresetNames; -} - -void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir) +void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets) { LL_INFOS("AppInit") << "Loading presets from " << dir << LL_ENDL; @@ -106,48 +92,61 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir) } } } + + presets = mPresetNames; } -void LLPresetsManager::savePreset(const std::string& name) +void LLPresetsManager::savePreset(const std::string& subdirectory, const std::string& name) { llassert(!name.empty()); + std::vector name_list; // This ugliness is the current list of all the control variables in the graphics and hardware - // preferences floaters. Additions or subtractions to the floaters must also be reflected here. - std::vector name_list = boost::assign::list_of - ("RenderQualityPerformance") - ("RenderFarClip") - ("RenderMaxPartCount") - ("RenderGlowResolutionPow") - ("RenderTerrainDetail") - ("RenderAvatarLODFactor") - ("RenderAvatarMaxVisible") - ("RenderUseImpostors") - ("RenderTerrainLODFactor") - ("RenderTreeLODFactor") - ("RenderVolumeLODFactor") - ("RenderFlexTimeFactor") - ("RenderTransparentWater") - ("RenderObjectBump") - ("RenderLocalLights") - ("VertexShaderEnable") - ("RenderAvatarVP") - ("RenderAvatarCloth") - ("RenderReflectionDetail") - ("WindLightUseAtmosShaders") - ("WLSkyDetail") - ("RenderDeferred") - ("RenderDeferredSSAO") - ("RenderDepthOfField") - ("RenderShadowDetail") - - ("RenderAnisotropic") - ("RenderFSAASamples") - ("RenderGamma") - ("RenderVBOEnable") - ("RenderCompressTextures") - ("TextureMemory") - ("RenderFogRatio"); + // preferences floaters or the settings for camera views. + // Additions or subtractions to the control variables in the floaters must also be reflected here. + if(PRESETS_GRAPHIC == subdirectory) + { + name_list = boost::assign::list_of + ("RenderQualityPerformance") + ("RenderFarClip") + ("RenderMaxPartCount") + ("RenderGlowResolutionPow") + ("RenderTerrainDetail") + ("RenderAvatarLODFactor") + ("RenderAvatarMaxVisible") + ("RenderUseImpostors") + ("RenderTerrainLODFactor") + ("RenderTreeLODFactor") + ("RenderVolumeLODFactor") + ("RenderFlexTimeFactor") + ("RenderTransparentWater") + ("RenderObjectBump") + ("RenderLocalLights") + ("VertexShaderEnable") + ("RenderAvatarVP") + ("RenderAvatarCloth") + ("RenderReflectionDetail") + ("WindLightUseAtmosShaders") + ("WLSkyDetail") + ("RenderDeferred") + ("RenderDeferredSSAO") + ("RenderDepthOfField") + ("RenderShadowDetail") + + ("RenderAnisotropic") + ("RenderFSAASamples") + ("RenderGamma") + ("RenderVBOEnable") + ("RenderCompressTextures") + ("TextureMemory") + ("RenderFogRatio"); + } + + if(PRESETS_CAMERA == subdirectory) + { + name_list = boost::assign::list_of + ("Placeholder"); + } // make an empty llsd LLSD paramsData(LLSD::emptyMap()); @@ -166,7 +165,7 @@ void LLPresetsManager::savePreset(const std::string& name) paramsData[ctrl_name]["Value"] = value; } - std::string pathName(getUserDir(PRESETS_GRAPHIC) + "\\" + LLURI::escape(name) + ".xml"); + std::string pathName(getPresetsDir(subdirectory) + "\\" + LLURI::escape(name) + ".xml"); // write to file llofstream presetsXML(pathName); @@ -178,17 +177,16 @@ void LLPresetsManager::savePreset(const std::string& name) mPresetListChangeSignal(); } -void LLPresetsManager::setPresetNamesInComboBox(LLComboBox* combo) +void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo) { combo->clearRows(); - std::string presets_dir = getGraphicPresetsDir(); + std::string presets_dir = getPresetsDir(subdirectory); if (!presets_dir.empty()) { - loadPresetNamesFromDir(presets_dir); std::list preset_names; - getPresetNames(preset_names); + loadPresetNamesFromDir(presets_dir, preset_names); combo->setLabel(LLTrans::getString("preset_combo_label")); @@ -206,9 +204,9 @@ void LLPresetsManager::setPresetNamesInComboBox(LLComboBox* combo) void LLPresetsManager::loadPreset(const std::string& name) { - std::string pathName(getUserDir(PRESETS_GRAPHIC) + "\\" + LLURI::escape(name) + ".xml"); + std::string full_path(getPresetsDir(PRESETS_GRAPHIC) + "\\" + LLURI::escape(name) + ".xml"); - gSavedSettings.loadFromFile(pathName, false, true); + gSavedSettings.loadFromFile(full_path, false, true); } bool LLPresetsManager::deletePreset(const std::string& name) @@ -221,10 +219,10 @@ bool LLPresetsManager::deletePreset(const std::string& name) return false; } - // (*TODO Should the name be escaped here? - if (gDirUtilp->deleteFilesInDir(getUserDir(PRESETS_GRAPHIC), name + ".xml") < 1) + if (gDirUtilp->deleteFilesInDir(getPresetsDir(PRESETS_GRAPHIC), LLURI::escape(name) + ".xml") < 1) { LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; + return false; } else { diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 128c5850f2..3a2542bda0 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -42,13 +42,11 @@ public: typedef std::list preset_name_list_t; typedef boost::signals2::signal preset_list_signal_t; - void setPresetNamesInComboBox(LLComboBox* combo); - void getPresetNames(preset_name_list_t& presets) const; - void loadPresetNamesFromDir(const std::string& dir); - void savePreset(const std::string & name); + static std::string getPresetsDir(const std::string& subdirectory); + void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo); + void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets); + void savePreset(const std::string& subdirectory, const std::string & name); void loadPreset(const std::string & name); - static std::string getCameraPresetsDir(); - static std::string getGraphicPresetsDir(); bool deletePreset(const std::string& name); /// Emitted when a preset gets loaded or deleted. @@ -60,8 +58,6 @@ public: LLPresetsManager(); ~LLPresetsManager(); - static std::string getUserDir(const std::string& subdirectory); - preset_list_signal_t mPresetListChangeSignal; }; -- cgit v1.2.3 From 6d1296f71640c9c25affcff4e784ea5798ba2d5c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 1 Dec 2014 08:09:17 -0500 Subject: STORM-2082 Implement save floater and some code cleanup. --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterdeleteprefpreset.cpp | 12 ++- indra/newview/llfloaterdeleteprefpreset.h | 2 +- indra/newview/llfloaterpreference.cpp | 25 ++++-- indra/newview/llfloaterpreference.h | 5 +- indra/newview/llfloatersaveprefpreset.cpp | 97 ++++++++++++++++++++++ indra/newview/llfloatersaveprefpreset.h | 57 +++++++++++++ indra/newview/llpresetsmanager.cpp | 41 ++++----- indra/newview/llpresetsmanager.h | 4 +- indra/newview/llviewerfloaterreg.cpp | 2 + .../default/xui/en/floater_save_pref_preset.xml | 50 +++++++++++ .../newview/skins/default/xui/en/notifications.xml | 14 ++++ .../default/xui/en/panel_preferences_graphics1.xml | 6 +- 13 files changed, 274 insertions(+), 43 deletions(-) create mode 100644 indra/newview/llfloatersaveprefpreset.cpp create mode 100644 indra/newview/llfloatersaveprefpreset.h create mode 100644 indra/newview/skins/default/xui/en/floater_save_pref_preset.xml diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 213446ccfb..57fa11a0bf 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -279,6 +279,7 @@ set(viewer_SOURCE_FILES llfloaterregioninfo.cpp llfloaterreporter.cpp llfloaterregionrestarting.cpp + llfloatersaveprefpreset.cpp llfloatersceneloadstats.cpp llfloaterscriptdebug.cpp llfloaterscriptedprefs.cpp @@ -890,6 +891,7 @@ set(viewer_HEADER_FILES llfloaterregioninfo.h llfloaterreporter.h llfloaterregionrestarting.h + llfloatersaveprefpreset.h llfloatersceneloadstats.h llfloaterscriptdebug.h llfloaterscriptedprefs.h diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index bef5b4e3bf..74f8805d03 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -28,9 +28,11 @@ #include "llfloaterdeleteprefpreset.h" +#include "llpresetsmanager.h" + #include "llbutton.h" #include "llcombobox.h" -#include "llpresetsmanager.h" +#include "llnotificationsutil.h" LLFloaterDeletePrefPreset::LLFloaterDeletePrefPreset(const LLSD &key) : LLFloater(key) @@ -49,7 +51,7 @@ BOOL LLFloaterDeletePrefPreset::postBuild() void LLFloaterDeletePrefPreset::onOpen(const LLSD& key) { - std::string mSubdirectory = key.asString(); + mSubdirectory = key.asString(); std::string floater_title = getString(std::string("title_") + mSubdirectory); setTitle(floater_title); @@ -65,7 +67,11 @@ void LLFloaterDeletePrefPreset::onBtnDelete() std::string name = combo->getSimple(); // Ignore return status - LLPresetsManager::getInstance()->deletePreset(name); + LLPresetsManager::getInstance()->deletePreset(mSubdirectory, name); + + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetDeleted", args); } void LLFloaterDeletePrefPreset::onPresetsListChange() diff --git a/indra/newview/llfloaterdeleteprefpreset.h b/indra/newview/llfloaterdeleteprefpreset.h index 356bc1a437..0ab3da7139 100644 --- a/indra/newview/llfloaterdeleteprefpreset.h +++ b/indra/newview/llfloaterdeleteprefpreset.h @@ -25,7 +25,7 @@ * $/LicenseInfo$ */ -#ifndef LL_LLFLOATERDELETPREFPRESET_H +#ifndef LL_LLFLOATERDELETEPREFPRESET_H #define LL_LLFLOATERDELETEPREFPRESET_H #include "llfloater.h" diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 508d82522e..2e1e1ba318 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1883,8 +1883,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)); - mCommitCallbackRegistrar.add("Pref.PrefDelete", boost::bind(&LLPanelPreference::onDeletePreset, this)); + 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)); } //virtual @@ -2082,17 +2083,27 @@ void LLPanelPreference::updateMediaAutoPlayCheckbox(LLUICtrl* ctrl) } } -void LLPanelPreference::onDeletePreset() +void LLPanelPreference::DeletePreset(const LLSD& user_data) { - LLFloaterReg::showInstance("delete_pref_preset", PRESETS_GRAPHIC); + std::string subdirectory = user_data.asString(); + LLFloaterReg::showInstance("delete_pref_preset", subdirectory); } -void LLPanelPreference::onChangePreset() +void LLPanelPreference::SavePreset(const LLSD& user_data) { - LLComboBox* combo = getChild("graphic_preset_combo"); + std::string subdirectory = user_data.asString(); + LLFloaterReg::showInstance("save_pref_preset", subdirectory); +} + +void LLPanelPreference::onChangePreset(const LLSD& user_data) +{ + std::string subdirectory = user_data.asString(); + + LLComboBox* combo = getChild(subdirectory + "_preset_combo"); std::string name = combo->getSimple(); - LLPresetsManager::getInstance()->loadPreset(name); + + LLPresetsManager::getInstance()->loadPreset(subdirectory, name); LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); if (instance) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index be228c8625..5452dc6442 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -221,8 +221,9 @@ public: // cancel() can restore them. virtual void saveSettings(); - void onDeletePreset(); - void onChangePreset(); + void onChangePreset(const LLSD& user_data); + void DeletePreset(const LLSD& user_data); + void SavePreset(const LLSD& user_data); class Updater; diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp new file mode 100644 index 0000000000..16d77c0750 --- /dev/null +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -0,0 +1,97 @@ +/** + * @file llfloatersaveprefpreset.cpp + * @brief Floater to save a graphics / camera preset + * + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2014, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatersaveprefpreset.h" + +#include "llbutton.h" +#include "llcombobox.h" +#include "llnotificationsutil.h" +#include "llpresetsmanager.h" + +LLFloaterSavePrefPreset::LLFloaterSavePrefPreset(const LLSD &key) +: LLFloater(key) +{ +} + +// virtual +BOOL LLFloaterSavePrefPreset::postBuild() +{ + getChild("preset_combo")->setTextEntryCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("preset_combo")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetNameEdited, this)); + getChild("save")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnSave, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterSavePrefPreset::onBtnCancel, this)); + + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterSavePrefPreset::onPresetsListChange, this)); + + mSaveButton = getChild("save"); + mPresetCombo = getChild("preset_combo"); + + return TRUE; +} + +void LLFloaterSavePrefPreset::onPresetNameEdited() +{ + // Disable saving a preset having empty name. + std::string name = mPresetCombo->getSimple(); + + mSaveButton->setEnabled(!name.empty()); +} + +void LLFloaterSavePrefPreset::onOpen(const LLSD& key) +{ + mSubdirectory = key.asString(); + + std::string floater_title = getString(std::string("title_") + mSubdirectory); + + setTitle(floater_title); + + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo); + + onPresetNameEdited(); +} + +void LLFloaterSavePrefPreset::onBtnSave() +{ + std::string name = mPresetCombo->getSimple(); + + LLPresetsManager::getInstance()->savePreset(mSubdirectory, name); + + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("PresetSaved", args); +} + +void LLFloaterSavePrefPreset::onPresetsListChange() +{ + LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo); +} + +void LLFloaterSavePrefPreset::onBtnCancel() +{ + closeFloater(); +} diff --git a/indra/newview/llfloatersaveprefpreset.h b/indra/newview/llfloatersaveprefpreset.h new file mode 100644 index 0000000000..09a87b8c62 --- /dev/null +++ b/indra/newview/llfloatersaveprefpreset.h @@ -0,0 +1,57 @@ +/** + * @file llfloatersaveprefpreset.h + * @brief Floater to save a graphics / camera preset + + * + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2014, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERSAVEPREFPRESET_H +#define LL_LLFLOATERSAVEPREFPRESET_H + +#include "llfloater.h" + +class LLComboBox; + +class LLFloaterSavePrefPreset : public LLFloater +{ + +public: + LLFloaterSavePrefPreset(const LLSD &key); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + + void onBtnSave(); + void onBtnCancel(); + +private: + LLComboBox* mPresetCombo; + LLButton* mSaveButton; + + void onPresetsListChange(); + void onPresetNameEdited(); + + std::string mSubdirectory; +}; + +#endif // LL_LLFLOATERSAVEPREFPRESET_H diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 6e00a90ae5..f6f2275da9 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -165,7 +165,7 @@ void LLPresetsManager::savePreset(const std::string& subdirectory, const std::st paramsData[ctrl_name]["Value"] = value; } - std::string pathName(getPresetsDir(subdirectory) + "\\" + LLURI::escape(name) + ".xml"); + std::string pathName(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); // write to file llofstream presetsXML(pathName); @@ -188,46 +188,35 @@ void LLPresetsManager::setPresetNamesInComboBox(const std::string& subdirectory, std::list preset_names; loadPresetNamesFromDir(presets_dir, preset_names); - combo->setLabel(LLTrans::getString("preset_combo_label")); - - for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) + if (preset_names.begin() != preset_names.end()) { - const std::string& name = *it; - combo->add(name, LLSD().with(0, name)); + for (std::list::const_iterator it = preset_names.begin(); it != preset_names.end(); ++it) + { + const std::string& name = *it; + combo->add(name, LLSD().with(0, name)); + } + } + else + { + combo->setLabel(LLTrans::getString("preset_combo_label")); } - } - else - { - LL_WARNS() << "Could not obtain graphic presets path" << LL_ENDL; } } -void LLPresetsManager::loadPreset(const std::string& name) +void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::string& name) { - std::string full_path(getPresetsDir(PRESETS_GRAPHIC) + "\\" + LLURI::escape(name) + ".xml"); + std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); gSavedSettings.loadFromFile(full_path, false, true); } -bool LLPresetsManager::deletePreset(const std::string& name) +bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std::string& name) { - // remove from param list - preset_name_list_t::iterator it = find(mPresetNames.begin(), mPresetNames.end(), name); - if (it == mPresetNames.end()) - { - LL_WARNS("Presets") << "No preset named " << name << LL_ENDL; - return false; - } - - if (gDirUtilp->deleteFilesInDir(getPresetsDir(PRESETS_GRAPHIC), LLURI::escape(name) + ".xml") < 1) + if (gDirUtilp->deleteFilesInDir(getPresetsDir(subdirectory), LLURI::escape(name) + ".xml") < 1) { LL_WARNS("Presets") << "Error removing preset " << name << " from disk" << LL_ENDL; return false; } - else - { - mPresetNames.erase(it); - } // signal interested parties mPresetListChangeSignal(); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 3a2542bda0..7bbaa778c6 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -46,8 +46,8 @@ public: void setPresetNamesInComboBox(const std::string& subdirectory, LLComboBox* combo); void loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets); void savePreset(const std::string& subdirectory, const std::string & name); - void loadPreset(const std::string & name); - bool deletePreset(const std::string& name); + void loadPreset(const std::string& subdirectory, const std::string & name); + bool deletePreset(const std::string& subdirectory, const std::string& name); /// Emitted when a preset gets loaded or deleted. boost::signals2::connection setPresetListChangeCallback(const preset_list_signal_t::slot_type& cb); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 03360deaee..3ee67d8ac5 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -101,6 +101,7 @@ #include "llfloaterregioninfo.h" #include "llfloaterregionrestarting.h" #include "llfloaterreporter.h" +#include "llfloatersaveprefpreset.h" #include "llfloatersceneloadstats.h" #include "llfloaterscriptdebug.h" #include "llfloaterscriptedprefs.h" @@ -290,6 +291,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("save_pref_preset", "floater_save_pref_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml new file mode 100644 index 0000000000..5919d9e3d7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_save_pref_preset.xml @@ -0,0 +1,50 @@ + + + + Save Graphic Preset + Save Camera Preset + + + Preset: + + + + diff --git a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml index 697bfd58e7..652d85656c 100644 --- a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml @@ -12,29 +12,60 @@ layout="topleft" name="presets_pulldown" width="225"> - Graphic Presets + + + + + + + -- cgit v1.2.3 From afd12a6e784574e69ef3b3e7cac14573fe7c3197 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 3 Dec 2014 09:38:10 -0500 Subject: STORM-2082 Send signal to pulldown panel to refresh itself --- indra/newview/llpanelpresetspulldown.cpp | 2 -- indra/newview/llpresetsmanager.cpp | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index cd049712e1..093b5caad9 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -150,8 +150,6 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) instance->refreshEnabledGraphics(); } setVisible(FALSE); - // This line shouldn't be necessary but it is. - populatePanel(); } } } diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index ddcd54162c..260f2c9547 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -242,6 +242,9 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st std::string full_path(getPresetsDir(subdirectory) + gDirUtilp->getDirDelimiter() + LLURI::escape(name) + ".xml"); gSavedSettings.loadFromFile(full_path, false, true); + + // signal interested parties + mPresetListChangeSignal(); } bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std::string& name) -- cgit v1.2.3 From 6c534dff5f30e503d6f5b63cdeeb4c0e2a29ae28 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 3 Dec 2014 10:10:42 -0500 Subject: remove obsolete menu entries in favor of integrated render info display --- indra/newview/skins/default/xui/en/menu_viewer.xml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 21e15ba270..c96a0366ca 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2658,26 +2658,6 @@ - - - - - - - - Date: Wed, 3 Dec 2014 10:13:50 -0500 Subject: further improvements to avatar render info display and logging of associated server messages --- indra/newview/llavatarrenderinfoaccountant.cpp | 119 +++++++++++-------------- indra/newview/llavatarrenderinfoaccountant.h | 2 - indra/newview/llvoavatar.cpp | 54 +++++------ 3 files changed, 81 insertions(+), 94 deletions(-) diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index ca2674bf94..83ae0438d9 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -70,14 +70,14 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - LL_WARNS() << "HTTP error result for avatar weight GET: " << statusNum + LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight GET: " << statusNum << ", " << reason << " returned by region " << regionp->getName() << LL_ENDL; } else { - LL_WARNS() << "Avatar render weight GET error recieved but region not found for " + LL_WARNS("AvatarRenderInfo") << "Avatar render weight GET error recieved but region not found for " << mRegionHandle << ", error " << statusNum << ", " << reason @@ -91,10 +91,7 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - if (LLAvatarRenderInfoAccountant::logRenderInfo()) - { - LL_INFOS() << "LRI: Result for avatar weights request for region " << regionp->getName() << ":" << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights request for region '" << regionp->getName() << "':" << LL_ENDL; if (content.isMap()) { @@ -109,40 +106,57 @@ public: LLUUID target_agent_id = LLUUID(report_iter->first); const LLSD & agent_info_map = report_iter->second; LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); - if (avatarp && - avatarp->isAvatar() && - agent_info_map.isMap()) + if ( avatarp + && avatarp->isAvatar() + && agent_info_map.isMap()) { // Extract the data for this avatar - if (LLAvatarRenderInfoAccountant::logRenderInfo()) - { - LL_INFOS() << "LRI: Agent " << target_agent_id - << ": " << agent_info_map << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Agent " << target_agent_id + << ": " << agent_info_map << LL_ENDL; if (agent_info_map.has(KEY_WEIGHT)) { ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); } } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: agent entry invalid" + << " agent " << target_agent_id + << " map " << agent_info_map + << LL_ENDL; + } report_iter++; } } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response agents content is not map" << LL_ENDL; + } + } // has "agents" else if (content.has(KEY_ERROR)) { const LLSD & error = content[KEY_ERROR]; - LL_WARNS() << "Avatar render info GET error: " + LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " << error[KEY_IDENTIFIER] << ": " << error[KEY_MESSAGE] << " from region " << regionp->getName() << LL_ENDL; } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: no agent key in get response" << LL_ENDL; + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response is not map" << LL_ENDL; } } else { - LL_INFOS() << "Avatar render weight info recieved but region not found for " + LL_WARNS("AvatarRenderInfo") << "Avatar render weight info recieved but region not found for " << mRegionHandle << LL_ENDL; } } @@ -165,14 +179,14 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - LL_WARNS() << "HTTP error result for avatar weight POST: " << statusNum + LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight POST: " << statusNum << ", " << reason << " returned by region " << regionp->getName() << LL_ENDL; } else { - LL_WARNS() << "Avatar render weight POST error recieved but region not found for " + LL_WARNS("AvatarRenderInfo") << "Avatar render weight POST error recieved but region not found for " << mRegionHandle << ", error " << statusNum << ", " << reason @@ -185,18 +199,15 @@ public: LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - if (LLAvatarRenderInfoAccountant::logRenderInfo()) - { - LL_INFOS() << "LRI: Result for avatar weights POST for region " << regionp->getName() - << ": " << content << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights POST for region " << regionp->getName() + << ": " << content << LL_ENDL; if (content.isMap()) { if (content.has(KEY_ERROR)) { const LLSD & error = content[KEY_ERROR]; - LL_WARNS() << "Avatar render info POST error: " + LL_WARNS("AvatarRenderInfo") << "Avatar render info POST error: " << error[KEY_IDENTIFIER] << ": " << error[KEY_MESSAGE] << " from region " << regionp->getName() @@ -206,7 +217,7 @@ public: } else { - LL_INFOS() << "Avatar render weight POST result recieved but region not found for " + LL_INFOS("AvatarRenderInfo") << "Avatar render weight POST result recieved but region not found for " << mRegionHandle << LL_ENDL; } } @@ -223,13 +234,10 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio std::string url = regionp->getCapability("AvatarRenderInfo"); if (!url.empty()) { - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Sending avatar render info to region " - << regionp->getName() - << " from " << url - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Checking for avatar render info to send to region " + << regionp->getName() + << " from " << url + << LL_ENDL; // Build the render info to POST to the region LLSD report = LLSD::emptyMap(); @@ -252,14 +260,8 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio info[KEY_WEIGHT] = avatar->getVisualComplexity(); agents[avatar->getID().asString()] = info; - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Sending avatar render info for " << avatar->getID() - << ": " << info << LL_ENDL; - LL_INFOS() << "LRI: other info geometry " << avatar->getAttachmentGeometryBytes() - << ", area " << avatar->getAttachmentSurfaceArea() - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Sending avatar render info for " << avatar->getID() + << ": " << info << LL_ENDL; } } iter++; @@ -268,6 +270,9 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio report[KEY_AGENTS] = agents; if (agents.size() > 0) { + LL_INFOS("AvatarRenderInfo") << "LRI: Sending info for " << agents.size() + << " avatars to region " << regionp->getName() + << LL_ENDL; LLHTTPClient::post(url, report, new LLAvatarRenderInfoPostResponder(regionp->getHandle())); } } @@ -283,13 +288,10 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi std::string url = regionp->getCapability("AvatarRenderInfo"); if (!url.empty()) { - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Requesting avatar render info for region " - << regionp->getName() - << " from " << url - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Requesting avatar render info for region " + << regionp->getName() + << " from " << url + << LL_ENDL; // First send a request to get the latest data LLHTTPClient::get(url, new LLAvatarRenderInfoGetResponder(regionp->getHandle())); @@ -308,11 +310,8 @@ void LLAvatarRenderInfoAccountant::idle() S32 num_avs = LLCharacter::sInstances.size(); - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Scanning all regions and checking for render info updates" - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "LRI: Scanning all regions and checking for render info updates" + << LL_ENDL; // Check all regions and see if it's time to fetch/send data for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); @@ -344,12 +343,9 @@ void LLAvatarRenderInfoAccountant::idle() // are returned for a new LLViewerRegion, and is the earliest time to get render info void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& region_id) { - if (logRenderInfo()) - { - LL_INFOS() << "LRI: Viewer has new region capabilities, clearing global render info timer" - << " and timer for region " << region_id - << LL_ENDL; - } + LL_INFOS("AvatarRenderInfo") << "LRI: Viewer has new region capabilities, clearing global render info timer" + << " and timer for region " << region_id + << LL_ENDL; // Reset the global timer so it will scan regions immediately sRenderInfoReportTimer.reset(); @@ -360,10 +356,3 @@ void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& reg regionp->getRenderInfoRequestTimer().reset(); } } - -// static -bool LLAvatarRenderInfoAccountant::logRenderInfo() -{ - static LLCachedControl render_mute_logging_enabled(gSavedSettings, "RenderAutoMuteLogging", false); - return render_mute_logging_enabled; -} diff --git a/indra/newview/llavatarrenderinfoaccountant.h b/indra/newview/llavatarrenderinfoaccountant.h index d68f2dccfb..62c899f7a4 100644 --- a/indra/newview/llavatarrenderinfoaccountant.h +++ b/indra/newview/llavatarrenderinfoaccountant.h @@ -46,8 +46,6 @@ public: static void idle(); - static bool logRenderInfo(); - private: // Send data updates about once per minute, only need per-frame resolution static LLFrameTimer sRenderInfoReportTimer; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3a83943209..816b2c8b67 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7948,7 +7948,6 @@ void LLVOAvatar::getImpostorValues(LLVector4a* extents, LLVector3& angle, F32& d angle.mV[2] = da; } - void LLVOAvatar::idleUpdateRenderCost() { if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_AVATAR_DRAW_INFO)) @@ -7962,30 +7961,35 @@ void LLVOAvatar::idleUpdateRenderCost() if ( !mText ) { initDebugTextHud(); + mText->setFadeDistance(15.0, 5.0); // limit clutter in large crowds } else { mText->clearString(); // clear debug text } - static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); - info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); - if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this + calculateUpdateRenderCost(); // Update mVisualComplexity if needed + + static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); + info_line = llformat("%d arc", mVisualComplexity); + + if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this { - green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); - red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); + green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); + red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); info_color.set(red_level, green_level, 0.0, 1.0); - info_style = ( mAttachmentGeometryBytes > max_attachment_bytes + info_style = ( mVisualComplexity > max_render_cost ? LLFontGL::BOLD : LLFontGL::NORMAL ); + } else { - info_color.setToWhite(); + info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; - mText->addLine(info_line, info_color); - + LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; + mText->addLine(info_line, info_color, info_style); + static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); info_line = llformat("%.2f m^2", mAttachmentSurfaceArea); @@ -7994,40 +7998,36 @@ void LLVOAvatar::idleUpdateRenderCost() green_level = 1.f-llclamp((mAttachmentSurfaceArea-max_attachment_area)/max_attachment_area, 0.f, 1.f); red_level = llmin(mAttachmentSurfaceArea/max_attachment_area, 1.f); info_color.set(red_level, green_level, 0.0, 1.0); - info_style = ( max_attachment_area > mAttachmentSurfaceArea + info_style = ( mAttachmentSurfaceArea > max_attachment_area ? LLFontGL::BOLD : LLFontGL::NORMAL ); } else { - info_color.setToWhite(); + info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } LL_DEBUGS() << "adding max area " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); - calculateUpdateRenderCost(); // Update mVisualComplexity if needed - - static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - info_line = llformat("%d arc", mVisualComplexity); - - if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this + static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); + info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); + if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this { - green_level = 1.f-llclamp(((F32) mVisualComplexity-(F32)max_render_cost)/(F32)max_render_cost, 0.f, 1.f); - red_level = llmin((F32) mVisualComplexity/(F32)max_render_cost, 1.f); + green_level = 1.f-llclamp(((F32) mAttachmentGeometryBytes-(F32)max_attachment_bytes)/(F32)max_attachment_bytes, 0.f, 1.f); + red_level = llmin((F32) mAttachmentGeometryBytes/(F32)max_attachment_bytes, 1.f); info_color.set(red_level, green_level, 0.0, 1.0); - info_style = ( mVisualComplexity > max_render_cost + info_style = ( mAttachmentGeometryBytes > max_attachment_bytes ? LLFontGL::BOLD : LLFontGL::NORMAL ); - } else { - info_color.setToWhite(); + info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; - mText->addLine(info_line, info_color, info_style); - + LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; + mText->addLine(info_line, info_color); + updateText(); // corrects position } } -- cgit v1.2.3 From 5be238b127ff30f09105ad6f0d9b8ee3dec8b40f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 4 Dec 2014 14:27:15 -0500 Subject: STORM-2082 Revert name of Reset button from Undo back to Reset. Hopefully this will be renamed Recommended Settings. Display a test icon (artwork needed) in the pulldown panel --- indra/newview/llfloaterpreference.cpp | 8 -------- indra/newview/llpanelpresetspulldown.cpp | 5 +++-- indra/newview/llpresetsmanager.h | 1 - .../skins/default/xui/en/panel_preferences_graphics1.xml | 16 ++-------------- .../skins/default/xui/en/panel_presets_pulldown.xml | 8 +++----- 5 files changed, 8 insertions(+), 30 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7b9c4c3035..7b252ebd4f 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -342,7 +342,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this)); mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); - mCommitCallbackRegistrar.add("Pref.Recommended", boost::bind(&LLFloaterPreference::setRecommended, 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)); @@ -798,13 +797,6 @@ void LLFloaterPreference::setHardwareDefaults() if (panel) panel->setHardwareDefaults(); } -} - -void LLFloaterPreference::setRecommended() -{ - LLFeatureManager::getInstance()->applyRecommendedSettings(); - - refreshEnabledGraphics(); LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); } diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 093b5caad9..1918623cab 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -89,8 +89,9 @@ void LLPanelPresetsPulldown::populatePanel() if (name == gSavedSettings.getString("PresetGraphicActive")) { - row["columns"][1]["column"] = "active_name"; - row["columns"][1]["value"] = "X"; + row["columns"][1]["column"] = "icon"; + row["columns"][1]["type"] = "icon"; + row["columns"][1]["value"] = "Inv_Landmark"; } scroll->addElement(row); diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 1bac2c65e1..d7d84b5746 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -64,7 +64,6 @@ public: preset_name_list_t mPresetNames; -//protected: LLPresetsManager(); ~LLPresetsManager(); 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 6df4a4f2ea..24f3dd803f 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -37,7 +37,7 @@ - diff --git a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml index fdcbce05d2..b87dda2315 100644 --- a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml +++ b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml @@ -2,8 +2,8 @@ Date: Fri, 12 Dec 2014 11:13:11 -0500 Subject: STORM-2082 Merge Hardware floater into main graphics preferences display Change notifications so they are emitted only when an error occurs Put active preset at top of list Add Maximum ARC slider Merge two small methods into slider update code --- indra/newview/CMakeLists.txt | 2 - indra/newview/app_settings/settings.xml | 11 ++ indra/newview/llfloaterdeleteprefpreset.cpp | 6 +- indra/newview/llfloaterhardwaresettings.cpp | 201 ------------------- indra/newview/llfloaterhardwaresettings.h | 84 -------- indra/newview/llfloaterpreference.cpp | 168 +++++++++++----- indra/newview/llfloaterpreference.h | 4 +- indra/newview/llfloatersaveprefpreset.cpp | 8 +- indra/newview/llpanelpresetspulldown.cpp | 2 +- indra/newview/llpresetsmanager.cpp | 21 +- indra/newview/llpresetsmanager.h | 5 +- indra/newview/llviewerfloaterreg.cpp | 2 - .../newview/skins/default/xui/en/notifications.xml | 8 +- .../default/xui/en/panel_preferences_graphics1.xml | 218 +++++++++++++++++++-- indra/newview/skins/default/xui/en/strings.xml | 3 +- 15 files changed, 362 insertions(+), 381 deletions(-) delete mode 100755 indra/newview/llfloaterhardwaresettings.cpp delete mode 100755 indra/newview/llfloaterhardwaresettings.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 57fa11a0bf..192be979fb 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -243,7 +243,6 @@ set(viewer_SOURCE_FILES llfloatergroupinvite.cpp llfloatergroups.cpp llfloaterhandler.cpp - llfloaterhardwaresettings.cpp llfloaterhelpbrowser.cpp llfloaterhud.cpp llfloaterimagepreview.cpp @@ -852,7 +851,6 @@ set(viewer_HEADER_FILES llfloatergroupinvite.h llfloatergroups.h llfloaterhandler.h - llfloaterhardwaresettings.h llfloaterhelpbrowser.h llfloaterhud.h llfloaterimagepreview.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6016839875..276a65edc5 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15562,6 +15562,17 @@ Value + MaximumARC + + Comment + Controls RenderAutoMuteRenderWeightLimit in a non-linear fashion + Persist + 1 + Type + U32 + Value + 0 + diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index 2f7d0552a3..f147a5ee90 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -74,10 +74,12 @@ void LLFloaterDeletePrefPreset::onBtnDelete() { LLPresetsManager::getInstance()->savePreset(mSubdirectory, PRESETS_DEFAULT); } - + } + else + { LLSD args; args["NAME"] = name; - LLNotificationsUtil::add("PresetDeleted", args); + LLNotificationsUtil::add("PresetNotDeleted", args); } } diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp deleted file mode 100755 index 035eb307c2..0000000000 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @file llfloaterhardwaresettings.cpp - * @brief Menu of all the different graphics hardware settings - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterhardwaresettings.h" - -// Viewer includes -#include "llfloaterpreference.h" -#include "llviewerwindow.h" -#include "llviewercontrol.h" -#include "llviewertexturelist.h" -#include "llfeaturemanager.h" -#include "llspinctrl.h" -#include "llstartup.h" -#include "lltextbox.h" -#include "llcombobox.h" -#include "pipeline.h" - -// Linden library includes -#include "llradiogroup.h" -#include "lluictrlfactory.h" -#include "llwindow.h" -#include "llsliderctrl.h" - -LLFloaterHardwareSettings::LLFloaterHardwareSettings(const LLSD& key) - : LLFloater(key), - - // these should be set on imminent refresh() call, - // but init them anyway - mUseVBO(0), - mUseAniso(0), - mFSAASamples(0), - mGamma(0.0), - mVideoCardMem(0), - mFogRatio(0.0), - mProbeHardwareOnStartup(FALSE) -{ -} - -LLFloaterHardwareSettings::~LLFloaterHardwareSettings() -{ -} - -void LLFloaterHardwareSettings::initCallbacks(void) -{ -} - -// menu maintenance functions - -void LLFloaterHardwareSettings::refresh() -{ - LLPanel::refresh(); - - mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable"); - mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic"); - mFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); - mGamma = gSavedSettings.getF32("RenderGamma"); - mVideoCardMem = gSavedSettings.getS32("TextureMemory"); - mFogRatio = gSavedSettings.getF32("RenderFogRatio"); - mProbeHardwareOnStartup = gSavedSettings.getBOOL("ProbeHardwareOnStartup"); - - getChild("fsaa")->setValue((LLSD::Integer) mFSAASamples); - refreshEnabledState(); -} - -void LLFloaterHardwareSettings::refreshEnabledState() -{ - F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); - S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); - S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); - getChild("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); - getChild("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); - - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || - !gGLManager.mHasVertexBufferObject) - { - getChildView("vbo")->setEnabled(FALSE); - } - - if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") || - !gGLManager.mHasVertexBufferObject) - { - getChildView("texture compression")->setEnabled(FALSE); - } - - // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance - LLSpinCtrl* gamma_ctrl = getChild("gamma"); - gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); - getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); - - // anti-aliasing - { - LLUICtrl* fsaa_ctrl = getChild("fsaa"); - LLTextBox* fsaa_text = getChild("antialiasing label"); - LLView* fsaa_restart = getChildView("antialiasing restart"); - - // Enable or disable the control, the "Antialiasing:" label and the restart warning - // based on code support for the feature on the current hardware. - - if (gPipeline.canUseAntiAliasing()) - { - fsaa_ctrl->setEnabled(TRUE); - - // borrow the text color from the gamma control for consistency - fsaa_text->setColor(gamma_ctrl->getEnabledTextColor()); - - fsaa_restart->setVisible(!gSavedSettings.getBOOL("RenderDeferred")); - } - else - { - fsaa_ctrl->setEnabled(FALSE); - fsaa_ctrl->setValue((LLSD::Integer) 0); - - // borrow the text color from the gamma control for consistency - fsaa_text->setColor(gamma_ctrl->getDisabledTextColor()); - - fsaa_restart->setVisible(FALSE); - } - } -} - -//============================================================================ - -BOOL LLFloaterHardwareSettings::postBuild() -{ - childSetAction("OK", onBtnOK, this); - -// Don't do this on Mac as their braindead GL versioning -// sets this when 8x and 16x are indeed available -// -#if !LL_DARWIN - if (gGLManager.mIsIntel || gGLManager.mGLVersion < 3.f) - { //remove FSAA settings above "4x" - LLComboBox* combo = getChild("fsaa"); - combo->remove("8x"); - combo->remove("16x"); - } -#endif - - refresh(); - center(); - - // load it up - initCallbacks(); - return TRUE; -} - - -void LLFloaterHardwareSettings::apply() -{ - refresh(); -} - - -void LLFloaterHardwareSettings::cancel() -{ - gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO); - gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso); - gSavedSettings.setU32("RenderFSAASamples", mFSAASamples); - gSavedSettings.setF32("RenderGamma", mGamma); - gSavedSettings.setS32("TextureMemory", mVideoCardMem); - gSavedSettings.setF32("RenderFogRatio", mFogRatio); - gSavedSettings.setBOOL("ProbeHardwareOnStartup", mProbeHardwareOnStartup ); - - closeFloater(); -} - -// static -void LLFloaterHardwareSettings::onBtnOK( void* userdata ) -{ - LLFloaterHardwareSettings *fp =(LLFloaterHardwareSettings *)userdata; - fp->apply(); - fp->closeFloater(false); -} - - diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h deleted file mode 100755 index 626771b1d2..0000000000 --- a/indra/newview/llfloaterhardwaresettings.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file llfloaterhardwaresettings.h - * @brief Menu of all the different graphics hardware settings - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATER_HARDWARE_SETTINGS_H -#define LL_LLFLOATER_HARDWARE_SETTINGS_H - -#include "llfloater.h" - -/// Menuing system for all of windlight's functionality -class LLFloaterHardwareSettings : public LLFloater -{ - friend class LLFloaterPreference; - -public: - - LLFloaterHardwareSettings(const LLSD& key); - /*virtual*/ ~LLFloaterHardwareSettings(); - - /*virtual*/ BOOL postBuild(); - - /// initialize all the callbacks for the menu - void initCallbacks(void); - - /// OK button - static void onBtnOK( void* userdata ); - - //// menu management - - /// show off our menu - static void show(); - - /// return if the menu exists or not - static bool isOpen(); - - /// sync up menu with parameters - void refresh(); - - /// Apply the changed values. - void apply(); - - /// don't apply the changed values - void cancel(); - - /// refresh the enabled values - void refreshEnabledState(); - -protected: - BOOL mUseVBO; - BOOL mUseAniso; - BOOL mUseFBO; - U32 mFSAASamples; - F32 mGamma; - S32 mVideoCardMem; - F32 mFogRatio; - BOOL mProbeHardwareOnStartup; - -private: -}; - -#endif - diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index e0c579f783..c7b4ae8ddc 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -48,7 +48,6 @@ //#include "llfirstuse.h" #include "llfloaterreg.h" #include "llfloaterabout.h" -#include "llfloaterhardwaresettings.h" #include "llfloatersidepanelcontainer.h" #include "llfloaterimsession.h" #include "llkeyboard.h" @@ -112,6 +111,7 @@ #include "llviewercontrol.h" #include "llpresetsmanager.h" #include "llfeaturemanager.h" +#include "llviewertexturelist.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -549,12 +549,6 @@ void LLFloaterPreference::apply() if (panel) panel->apply(); } - // hardware menu apply - LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings"); - if (hardware_settings) - { - hardware_settings->apply(); - } gViewerWindow->requestResolutionUpdate(); // for UIScaleFactor @@ -632,13 +626,6 @@ void LLFloaterPreference::cancel() // hide spellchecker settings folder LLFloaterReg::hideInstance("prefs_spellchecker"); - // cancel hardware menu - LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings"); - if (hardware_settings) - { - hardware_settings->cancel(); - } - // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); @@ -921,11 +908,6 @@ void LLFloaterPreference::refreshEnabledGraphics() instance->refresh(); //instance->refreshEnabledState(); } - LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::getTypedInstance("prefs_hardware_settings"); - if (hardware_settings) - { - hardware_settings->refreshEnabledState(); - } } void LLFloaterPreference::onClickClearCache() @@ -1201,7 +1183,61 @@ void LLFloaterPreference::refreshEnabledState() enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); ctrl_shadow->setEnabled(enabled); - + + // Hardware settings + F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); + S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); + S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); + getChild("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); + getChild("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("vbo")->setEnabled(FALSE); + } + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures") || + !gGLManager.mHasVertexBufferObject) + { + getChildView("texture compression")->setEnabled(FALSE); + } + + // if no windlight shaders, turn off nighttime brightness, gamma, and fog distance + LLUICtrl* gamma_ctrl = getChild("gamma"); + gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); + + /* Disabling this block of code because canUseAntiAliasing currently always returns true + // anti-aliasing + LLComboBox* fsaa_ctrl = getChild("fsaa"); + LLTextBox* fsaa_text = getChild("antialiasing label"); + LLTextBox* fsaa_restart = getChild("antialiasing restart"); + + // Enable or disable the control, the "Antialiasing:" label and the restart warning + // based on code support for the feature on the current hardware. + + if (gPipeline.canUseAntiAliasing()) + { + fsaa_ctrl->setEnabled(TRUE); + + LLColor4 color = LLUIColorTable::instance().getColor("LabelTextColor"); + fsaa_text->setColor(color); + + fsaa_restart->setVisible(!gSavedSettings.getBOOL("RenderDeferred")); + } + else + { + fsaa_ctrl->setEnabled(FALSE); + fsaa_ctrl->setValue((LLSD::Integer) 0); + + LLColor4 color = LLUIColorTable::instance().getColor("LabelDisabledColor"); + fsaa_text->setColor(color); + + fsaa_restart->setVisible(FALSE); + } + */ // now turn off any features that are unavailable disableUnavailableSettings(); @@ -1365,23 +1401,26 @@ void LLFloaterPreference::refresh() { LLPanel::refresh(); + getChild("fsaa")->setValue((LLSD::Integer) gSavedSettings.getU32("RenderFSAASamples")); + refreshEnabledState(); // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes - updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); - updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); - updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); - updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); - updateSliderText(getChild("AvatarMeshDetail2", true), getChild("AvatarMeshDetailText2", true)); - updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); - updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); - updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); - updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); - updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); - updateReflectionsText(getChild("Reflections", true), getChild("ReflectionsText", true)); - updateShadowDetailText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true)); + updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true), "ObjectMeshDetail"); + updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true), "FlexibleMeshDetail"); + updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true), "TreeMeshDetail"); + updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true), "AvatarMeshDetail"); + updateSliderText(getChild("AvatarMeshDetail2", true), getChild("AvatarMeshDetailText2", true), "AvatarMeshDetail2"); + updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true), "AvatarPhysicsDetail"); + updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true), "TerrainMeshDetail"); + updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true), "RenderPostProcess"); + updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true), "SkyMeshDetail"); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true), "TerrainDetail"); + updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true), "MaximumARC"); + updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true), "Reflections"); + updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true), "ShadowDetail"); } void LLFloaterPreference::onCommitWindowedMode() @@ -1633,24 +1672,7 @@ void LLFloaterPreference::refreshUI() refresh(); } -void LLFloaterPreference::updateReflectionsText(LLSliderCtrl* ctrl, LLTextBox* text_box) -{ - if (text_box == NULL || ctrl== NULL) - return; - - U32 value = (U32)ctrl->getValue().asInteger(); - text_box->setText(getString("Reflections" + llformat("%d", value))); -} -void LLFloaterPreference::updateShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box) -{ - if (text_box == NULL || ctrl== NULL) - return; - - U32 value = (U32)ctrl->getValue().asInteger(); - text_box->setText(getString("RenderShadowDetail" + llformat("%d", value))); -} - -void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) +void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box, const std::string& name) { if (text_box == NULL || ctrl== NULL) return; @@ -1663,7 +1685,21 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b llassert(range > 0); F32 midPoint = min + range / 3.0f; F32 highPoint = min + (2.0f * range / 3.0f); - + + 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; + } + // choose the right text if (value < midPoint) { @@ -1677,6 +1713,22 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b { text_box->setText(LLTrans::getString("GraphicsQualityHigh")); } + + if ("MaximumARC" == name) + { + F32 control_value = value; + if (0.0f == control_value) + { + text_box->setText(LLTrans::getString("Off")); + } + else + { + // 13 is the maximum value of this control set in panel_preferences_graphics1.xml + control_value = exp(13.0f - control_value) + 20000.0f; + } + + gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)control_value); + } } void LLFloaterPreference::onChangeMaturity() @@ -2152,6 +2204,18 @@ static LLPanelInjector t_pref_privacy("panel_preferenc BOOL LLPanelPreferenceGraphics::postBuild() { +// Don't do this on Mac as their braindead GL versioning +// sets this when 8x and 16x are indeed available +// +#if !LL_DARWIN + if (gGLManager.mIsIntel || gGLManager.mGLVersion < 3.f) + { //remove FSAA settings above "4x" + LLComboBox* combo = getChild("fsaa"); + combo->remove("8x"); + combo->remove("16x"); + } +#endif + LLComboBox* combo = getChild("graphic_preset_combo"); combo->setLabel(LLTrans::getString("preset_combo_label")); @@ -2171,7 +2235,7 @@ void LLPanelPreferenceGraphics::setPresetNamesInComboBox() { LLComboBox* combo = getChild("graphic_preset_combo"); - EDefaultOptions option = DEFAULT_POSITION_TOP; + EDefaultOptions option = DEFAULT_SHOW; LLPresetsManager::getInstance()->setPresetNamesInComboBox(PRESETS_GRAPHIC, combo, option); } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index d43c41272a..eebc0849ee 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -156,9 +156,7 @@ public: // if the quality radio buttons are changed void onChangeQuality(const LLSD& data); - void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); - void updateReflectionsText(LLSliderCtrl* ctrl, LLTextBox* text_box); - void updateShadowDetailText(LLSliderCtrl* ctrl, LLTextBox* text_box); + void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box, const std::string& name); void refreshUI(); void onCommitParcelMediaAutoPlayEnable(); diff --git a/indra/newview/llfloatersaveprefpreset.cpp b/indra/newview/llfloatersaveprefpreset.cpp index 02281d8b3c..610c701d8d 100644 --- a/indra/newview/llfloatersaveprefpreset.cpp +++ b/indra/newview/llfloatersaveprefpreset.cpp @@ -70,7 +70,7 @@ void LLFloaterSavePrefPreset::onOpen(const LLSD& key) setTitle(floater_title); - EDefaultOptions option = DEFAULT_POSITION_TOP; + EDefaultOptions option = DEFAULT_SHOW; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); onPresetNameEdited(); @@ -80,11 +80,11 @@ void LLFloaterSavePrefPreset::onBtnSave() { std::string name = mPresetCombo->getSimple(); - if (LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) + if (!LLPresetsManager::getInstance()->savePreset(mSubdirectory, name)) { LLSD args; args["NAME"] = name; - LLNotificationsUtil::add("PresetSaved", args); + LLNotificationsUtil::add("PresetNotSaved", args); } closeFloater(); @@ -92,7 +92,7 @@ void LLFloaterSavePrefPreset::onBtnSave() void LLFloaterSavePrefPreset::onPresetsListChange() { - EDefaultOptions option = DEFAULT_POSITION_TOP; + EDefaultOptions option = DEFAULT_SHOW; LLPresetsManager::getInstance()->setPresetNamesInComboBox(mSubdirectory, mPresetCombo, option); } diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 1918623cab..4756f3bd75 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -71,7 +71,7 @@ BOOL LLPanelPresetsPulldown::postBuild() void LLPanelPresetsPulldown::populatePanel() { std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_POSITION_NORMAL); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_SHOW); LLScrollListCtrl* scroll = getChild("preset_list"); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 971a5ecf52..1c14cc6ece 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -99,20 +99,26 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_nam { std::string path = gDirUtilp->add(dir, file); std::string name = gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true); + // Two things are happening here: + // 1 - Always put the active preset at the top of the list + // 2 - Possibly hide the default preset if (PRESETS_DEFAULT != name) { - mPresetNames.push_back(name); + if (name != gSavedSettings.getString("PresetGraphicActive")) + { + mPresetNames.push_back(name); + } + else + { + mPresetNames.insert(mPresetNames.begin(), name); + } } else { switch (default_option) { - case DEFAULT_POSITION_TOP: - mPresetNames.insert(mPresetNames.begin(), name); - break; - - case DEFAULT_POSITION_NORMAL: - mPresetNames.push_back(name); + case DEFAULT_SHOW: + mPresetNames.push_back(LLTrans::getString(PRESETS_DEFAULT)); break; case DEFAULT_HIDE: @@ -164,6 +170,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, const std::st ("RenderDeferredSSAO") ("RenderDepthOfField") ("RenderShadowDetail") + ("RenderAutoMuteRenderWeightLimit") ("RenderAnisotropic") ("RenderFSAASamples") diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 180cca5bc4..bf6a531d48 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -39,9 +39,8 @@ static const std::string PRESETS_CAMERA = "camera"; enum EDefaultOptions { - DEFAULT_POSITION_TOP, // Put "Default" as the first item in the combobox - DEFAULT_POSITION_NORMAL, // No special positioning - DEFAULT_HIDE // Do not display "Default" in the combobox + DEFAULT_SHOW, + DEFAULT_HIDE // Do not display "Default" in a list }; class LLPresetsManager : public LLSingleton diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 3ee67d8ac5..8acb56d650 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -69,7 +69,6 @@ #include "llfloatergesture.h" #include "llfloatergodtools.h" #include "llfloatergroups.h" -#include "llfloaterhardwaresettings.h" #include "llfloaterhelpbrowser.h" #include "llfloaterhud.h" #include "llfloaterimagepreview.h" @@ -274,7 +273,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("places", "floater_places.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_proxy", "floater_preferences_proxy.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("prefs_hardware_settings", "floater_hardware_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_spellchecker_import", "floater_spellcheck_import.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_translation", "floater_translation_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("prefs_spellchecker", "floater_spellcheck.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 1618ea0ec7..340777faf3 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7659,16 +7659,16 @@ Attachment has been saved. -Preset [NAME] has been saved. +Error saving preset [NAME]. -Preset [NAME] has been deleted. +Error deleting preset [NAME]. + + + + + Low + + None + + + Hardware + + + + + + + + + + (0 = default brightness, lower = brighter) + + + + + + + + + + Antialiasing: + + + + + + + + + + (requires viewer restart) + @@ -958,18 +1158,6 @@ - + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 1c655c6559..023c6e5bbb 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4044,5 +4044,6 @@ Try enclosing path to the editor with double quotes. -Empty list- - + Default + Off -- cgit v1.2.3 From e713ef765f268af1cba0f7b04f1e331332630e97 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 13 Dec 2014 06:28:12 -0500 Subject: STORM-2082 Write out settings to preset file if settings changed on the login page Code improvements from bitbucket comments --- indra/newview/llfloaterpreference.cpp | 75 +++++++++++++--------- indra/newview/llfloaterpreference.h | 2 +- .../default/xui/en/panel_preferences_graphics1.xml | 5 +- 3 files changed, 47 insertions(+), 35 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index c7b4ae8ddc..6e5b75e80b 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -864,13 +864,10 @@ void LLFloaterPreference::onBtnOK() pPathfindingConsole->onRegionBoundaryCross(); } - if (LLStartUp::getStartupState() == STATE_STARTED) - { - // 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")); - } + // 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 @@ -1208,6 +1205,7 @@ void LLFloaterPreference::refreshEnabledState() gamma_ctrl->setEnabled(!gPipeline.canUseWindLightShaders()); getChildView("(brightness, lower is brighter)")->setEnabled(!gPipeline.canUseWindLightShaders()); getChildView("fog")->setEnabled(!gPipeline.canUseWindLightShaders()); + getChildView("antialiasing restart")->setVisible(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")); /* Disabling this block of code because canUseAntiAliasing currently always returns true // anti-aliasing @@ -1408,19 +1406,19 @@ void LLFloaterPreference::refresh() // sliders and their text boxes // mPostProcess = gSavedSettings.getS32("RenderGlowResolutionPow"); // slider text boxes - updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true), "ObjectMeshDetail"); - updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true), "FlexibleMeshDetail"); - updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true), "TreeMeshDetail"); - updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true), "AvatarMeshDetail"); - updateSliderText(getChild("AvatarMeshDetail2", true), getChild("AvatarMeshDetailText2", true), "AvatarMeshDetail2"); - updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true), "AvatarPhysicsDetail"); - updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true), "TerrainMeshDetail"); - updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true), "RenderPostProcess"); - updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true), "SkyMeshDetail"); - updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true), "TerrainDetail"); - updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true), "MaximumARC"); - updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true), "Reflections"); - updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true), "ShadowDetail"); + updateSliderText(getChild("ObjectMeshDetail", true), getChild("ObjectMeshDetailText", true)); + updateSliderText(getChild("FlexibleMeshDetail", true), getChild("FlexibleMeshDetailText", true)); + updateSliderText(getChild("TreeMeshDetail", true), getChild("TreeMeshDetailText", true)); + updateSliderText(getChild("AvatarMeshDetail", true), getChild("AvatarMeshDetailText", true)); + updateSliderText(getChild("AvatarMeshDetail2", true), getChild("AvatarMeshDetailText2", true)); + updateSliderText(getChild("AvatarPhysicsDetail", true), getChild("AvatarPhysicsDetailText", true)); + updateSliderText(getChild("TerrainMeshDetail", true), getChild("TerrainMeshDetailText", true)); + updateSliderText(getChild("RenderPostProcess", true), getChild("PostProcessText", true)); + updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); + updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); + updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); + updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true)); + updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1672,19 +1670,12 @@ void LLFloaterPreference::refreshUI() refresh(); } -void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box, const std::string& name) +void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box) { if (text_box == NULL || ctrl== NULL) return; - // get range and points when text should change - F32 value = (F32)ctrl->getValue().asReal(); - F32 min = ctrl->getMinValue(); - F32 max = ctrl->getMaxValue(); - F32 range = max - min; - llassert(range > 0); - F32 midPoint = min + range / 3.0f; - F32 highPoint = min + (2.0f * range / 3.0f); + std::string name = ctrl->getName(); if ("ShadowDetail" == name) { @@ -1700,6 +1691,15 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b return; } + // get range and points when text should change + F32 value = (F32)ctrl->getValue().asReal(); + F32 min = ctrl->getMinValue(); + F32 max = ctrl->getMaxValue(); + F32 range = max - min; + llassert(range > 0); + F32 midPoint = min + range / 3.0f; + F32 highPoint = min + (2.0f * range / 3.0f); + // choose the right text if (value < midPoint) { @@ -1723,8 +1723,21 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b } else { - // 13 is the maximum value of this control set in panel_preferences_graphics1.xml - control_value = exp(13.0f - control_value) + 20000.0f; + // 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); + + // calculate adjustment factor + F32 scale = (maxv - minv) / (maxp - minp); + + control_value = exp(minv + scale * (control_value - minp)); + + // Invert result + control_value = 500000.0f - control_value; } gSavedSettings.setU32("RenderAutoMuteRenderWeightLimit", (U32)control_value); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index eebc0849ee..12230c2877 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -156,7 +156,7 @@ public: // if the quality radio buttons are changed void onChangeQuality(const LLSD& data); - void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box, const std::string& name); + void updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_box); void refreshUI(); void onCommitParcelMediaAutoPlayEnable(); 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 43b9d6003f..4636313f94 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -550,13 +550,13 @@ follows="left|top" height="16" initial_value="0" - increment=".1" + increment="1" label="Maximum ARC:" label_width="185" layout="topleft" left="30" min_val="0" - max_val="13" + max_val="100" name="MaximumARC" show_text="false" top_delta="16" @@ -1158,6 +1158,5 @@ - -- cgit v1.2.3 From c655ae00a1e9d3540a9280181766bd4f646e1cce Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 13 Dec 2014 20:53:27 -0500 Subject: STORM-2082 When a control is greyed out make sure it's associated text is greyed out. Sky: has two dependencies; grey it out when either one is not available. Remove Basic Shaders from Basic tab --- indra/newview/llfloaterpreference.cpp | 35 ++++++++++++++++++++-- .../default/xui/en/panel_preferences_graphics1.xml | 26 +++++----------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6e5b75e80b..814e552027 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1088,12 +1088,14 @@ void LLFloaterPreference::buildPopupLists() void LLFloaterPreference::refreshEnabledState() { LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); // Reflections BOOL reflections = gSavedSettings.getBOOL("VertexShaderEnable") && gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps; ctrl_reflections->setEnabled(reflections); + reflections_text->setEnabled(reflections); // Bump & Shiny LLCheckBoxCtrl* bumpshiny_ctrl = getChild("BumpShiny"); @@ -1129,6 +1131,7 @@ void LLFloaterPreference::refreshEnabledState() // Global Shader Enable LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); LLSliderCtrl* terrain_detail = getChild("TerrainDetail"); // can be linked with control var + LLTextBox* terrain_text = getChild("TerrainDetailText"); ctrl_shader_enable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); @@ -1137,19 +1140,26 @@ void LLFloaterPreference::refreshEnabledState() { terrain_detail->setValue(1); terrain_detail->setEnabled(FALSE); + terrain_text->setEnabled(false); } else { - terrain_detail->setEnabled(TRUE); + terrain_detail->setEnabled(TRUE); + terrain_text->setEnabled(true); } // WindLight LLCheckBoxCtrl* ctrl_wind_light = getChild("WindLightUseAtmosShaders"); - + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("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); + sky->setEnabled(ctrl_wind_light->get() && shaders); + sky_text->setEnabled(ctrl_wind_light->get() && shaders); + //Deferred/SSAO/Shadows LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); @@ -1168,6 +1178,7 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); LLUICtrl* ctrl_shadow = getChild("ShadowDetail"); + LLTextBox* shadow_text = getChild("RenderShadowDetailText"); // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO") && (ctrl_deferred->get() ? TRUE : FALSE); @@ -1180,6 +1191,7 @@ void LLFloaterPreference::refreshEnabledState() enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderShadowDetail"); ctrl_shadow->setEnabled(enabled); + shadow_text->setEnabled(enabled); // Hardware settings F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); @@ -1249,6 +1261,7 @@ void LLFloaterPreference::refreshEnabledState() void LLFloaterPreference::disableUnavailableSettings() { LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLTextBox* reflections_text = getChild("ReflectionsText"); LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); LLCheckBoxCtrl* ctrl_shader_enable = getChild("BasicShaders"); @@ -1257,8 +1270,11 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); LLUICtrl* ctrl_shadows = getChild("ShadowDetail"); + LLTextBox* shadows_text = getChild("RenderShadowDetailText"); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); + LLSliderCtrl* sky = getChild("SkyMeshDetail"); + LLTextBox* sky_text = getChild("SkyMeshDetailText"); // if vertex shaders off, disable all shader related products if (!LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")) @@ -1268,9 +1284,13 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_wind_light->setEnabled(FALSE); ctrl_wind_light->setValue(FALSE); - + + sky->setEnabled(false); + sky_text->setEnabled(false); + ctrl_reflections->setEnabled(FALSE); ctrl_reflections->setValue(0); + reflections_text->setEnabled(false); ctrl_avatar_vp->setEnabled(FALSE); ctrl_avatar_vp->setValue(FALSE); @@ -1280,6 +1300,7 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1299,9 +1320,13 @@ void LLFloaterPreference::disableUnavailableSettings() ctrl_wind_light->setEnabled(FALSE); ctrl_wind_light->setValue(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); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1321,6 +1346,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); @@ -1346,6 +1372,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); } // disabled reflections @@ -1353,6 +1380,7 @@ void LLFloaterPreference::disableUnavailableSettings() { ctrl_reflections->setEnabled(FALSE); ctrl_reflections->setValue(FALSE); + reflections_text->setEnabled(false); } // disabled av @@ -1367,6 +1395,7 @@ void LLFloaterPreference::disableUnavailableSettings() //deferred needs AvatarVP, disable deferred ctrl_shadows->setEnabled(FALSE); ctrl_shadows->setValue(0); + shadows_text->setEnabled(false); ctrl_ssao->setEnabled(FALSE); ctrl_ssao->setValue(FALSE); 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 4636313f94..a53097a117 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -264,28 +264,13 @@ Low - - - - @@ -438,7 +423,7 @@ width="300" > + parameter="TerrainDetail" /> Low @@ -629,6 +615,7 @@ height="16" layout="topleft" name="TerrainMeshDetailText" + text_readonly_color="LabelDisabledColor" top_delta="0" left_delta="304" width="128"> @@ -844,6 +831,7 @@ height="16" layout="topleft" name="ReflectionsText" + text_readonly_color="LabelDisabledColor" top_delta="0" left_delta="284" width="128"> @@ -866,7 +854,6 @@ Low @@ -970,6 +957,7 @@ layout="topleft" left_delta="264" name="RenderShadowDetailText" + text_readonly_color="LabelDisabledColor" top_delta="0" width="128"> None -- cgit v1.2.3 From 8f5ddebf0abfbcf73f25313214b06b98f2c7889c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 14 Dec 2014 19:17:52 -0500 Subject: STORM-2082 Remove ugly list of control names. Instead, obtain the list from the View data Remove a few remants used by the old hardware floater --- indra/newview/llfloaterpreference.cpp | 42 +++++++++++++++++++++++++----- indra/newview/llfloaterpreference.h | 2 +- indra/newview/llpresetsmanager.cpp | 49 +++++++---------------------------- 3 files changed, 46 insertions(+), 47 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 814e552027..9df7f82275 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -340,7 +340,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.ClickEnablePopup", boost::bind(&LLFloaterPreference::onClickEnablePopup, this)); mCommitCallbackRegistrar.add("Pref.ClickDisablePopup", boost::bind(&LLFloaterPreference::onClickDisablePopup, this)); mCommitCallbackRegistrar.add("Pref.LogPath", boost::bind(&LLFloaterPreference::onClickLogPath, this)); - mCommitCallbackRegistrar.add("Pref.HardwareSettings", boost::bind(&LLFloaterPreference::onOpenHardwareSettings, this)); mCommitCallbackRegistrar.add("Pref.HardwareDefaults", boost::bind(&LLFloaterPreference::setHardwareDefaults, this)); mCommitCallbackRegistrar.add("Pref.VertexShaderEnable", boost::bind(&LLFloaterPreference::onVertexShaderEnable, this)); mCommitCallbackRegistrar.add("Pref.WindowedMod", boost::bind(&LLFloaterPreference::onCommitWindowedMode, this)); @@ -788,6 +787,42 @@ void LLFloaterPreference::setHardwareDefaults() LLPresetsManager::getInstance()->savePreset(PRESETS_GRAPHIC, PRESETS_DEFAULT); } +void LLFloaterPreference::getControlNames(std::vector& names) +{ + LLView* view = findChild("display"); + if (view) + { + std::list stack; + stack.push_back(view); + while(!stack.empty()) + { + // Process view on top of the stack + LLView* curview = stack.front(); + stack.pop_front(); + + LLUICtrl* ctrl = dynamic_cast(curview); + if (ctrl) + { + LLControlVariable* control = ctrl->getControlVariable(); + if (control) + { + std::string control_name = control->getName(); + if (std::find(names.begin(), names.end(), control_name) == names.end()) + { + names.push_back(control_name); + } + } + } + + for (child_list_t::const_iterator iter = curview->getChildList()->begin(); + iter != curview->getChildList()->end(); ++iter) + { + stack.push_back(*iter); + } + } + } +} + //virtual void LLFloaterPreference::onClose(bool app_quitting) { @@ -799,11 +834,6 @@ void LLFloaterPreference::onClose(bool app_quitting) } } -void LLFloaterPreference::onOpenHardwareSettings() -{ - LLFloater* floater = LLFloaterReg::showInstance("prefs_hardware_settings"); - addDependentFloater(floater, FALSE); -} // static void LLFloaterPreference::onBtnOK() { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 12230c2877..f6b5f5229d 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -93,6 +93,7 @@ public: void saveAvatarProperties( void ); void selectPrivacyPanel(); void selectChatPanel(); + void getControlNames(std::vector& names); protected: void onBtnOK(); @@ -110,7 +111,6 @@ protected: // if the custom settings box is clicked void onChangeCustom(); void updateMeterText(LLUICtrl* ctrl); - void onOpenHardwareSettings(); // callback for defaults void setHardwareDefaults(); void setRecommended(); diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 1c14cc6ece..05a135b19c 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -36,6 +36,8 @@ #include "lltrans.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" +#include "llfloaterpreference.h" +#include "llfloaterreg.h" LLPresetsManager::LLPresetsManager() { @@ -137,51 +139,18 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, const std::st llassert(!name.empty()); std::vector name_list; - // This ugliness is the current list of all the control variables in the graphics and hardware - // preferences floaters or the settings for camera views. - // Additions or subtractions to the control variables in the floaters must also be reflected here. + if(PRESETS_GRAPHIC == subdirectory) { gSavedSettings.setString("PresetGraphicActive", name); - name_list = boost::assign::list_of - ("RenderQualityPerformance") - ("RenderFarClip") - ("RenderMaxPartCount") - ("RenderGlowResolutionPow") - ("RenderTerrainDetail") - ("RenderAvatarLODFactor") - ("RenderAvatarMaxVisible") - ("RenderUseImpostors") - ("RenderTerrainLODFactor") - ("RenderTreeLODFactor") - ("RenderVolumeLODFactor") - ("RenderFlexTimeFactor") - ("RenderTransparentWater") - ("RenderObjectBump") - ("RenderLocalLights") - ("VertexShaderEnable") - ("RenderAvatarVP") - ("RenderAvatarCloth") - ("RenderReflectionDetail") - ("WindLightUseAtmosShaders") - ("WLSkyDetail") - ("RenderDeferred") - ("RenderDeferredSSAO") - ("RenderDepthOfField") - ("RenderShadowDetail") - ("RenderAutoMuteRenderWeightLimit") - - ("RenderAnisotropic") - ("RenderFSAASamples") - ("RenderGamma") - ("RenderVBOEnable") - ("RenderCompressTextures") - ("TextureMemory") - ("RenderFogRatio") - - ("PresetGraphicActive"); + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->getControlNames(name_list); + name_list.push_back("PresetGraphicActive"); } + } if(PRESETS_CAMERA == subdirectory) { -- cgit v1.2.3 From fe627f64742cbec698df0a907cb8aaea297df599 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 15 Dec 2014 15:59:49 -0500 Subject: MAINT-4716: correct reading of and debug display for avatar render cost info --- indra/newview/llappviewer.cpp | 2 +- indra/newview/llavatarrenderinfoaccountant.cpp | 470 ++++++++++++++----------- indra/newview/llavatarrenderinfoaccountant.h | 33 +- indra/newview/llviewerregion.cpp | 3 +- indra/newview/llviewerregion.h | 6 +- indra/newview/llvoavatar.cpp | 59 +++- 6 files changed, 337 insertions(+), 236 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3a5008507a..4ad8181055 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5090,7 +5090,7 @@ void LLAppViewer::idle() } // Update AV render info - LLAvatarRenderInfoAccountant::idle(); + LLAvatarRenderInfoAccountant::getInstance()->idle(); { LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE); diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 83ae0438d9..8631f245a9 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -28,14 +28,16 @@ // Precompiled header #include "llviewerprecompiledheaders.h" -// associated header -#include "llavatarrenderinfoaccountant.h" // STL headers // std headers // external library headers // other Linden headers #include "llcharacter.h" -#include "llhttpclient.h" +#include "httprequest.h" +#include "httphandler.h" +#include "httpresponse.h" +#include "llcorehttputil.h" +#include "llappcorehttp.h" #include "lltimer.h" #include "llviewercontrol.h" #include "llviewermenu.h" @@ -43,6 +45,8 @@ #include "llviewerregion.h" #include "llvoavatar.h" #include "llworld.h" +// associated header +#include "llavatarrenderinfoaccountant.h" static const std::string KEY_AGENTS = "agents"; // map @@ -53,228 +57,259 @@ static const std::string KEY_MESSAGE = "message"; static const std::string KEY_ERROR = "error"; -// Send data updates about once per minute, only need per-frame resolution -LLFrameTimer LLAvatarRenderInfoAccountant::sRenderInfoReportTimer; +static const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds +static const F32 SECS_BETWEEN_REGION_REQUEST = 15.0; // Look for new avs every 15 seconds +static const F32 SECS_BETWEEN_REGION_REPORTS = 60.0; // Update each region every 60 seconds + + +// The policy class for HTTP traffic; this is the right value for all capability requests. +static LLCore::HttpRequest::policy_t http_policy(LLAppCoreHttp::AP_REPORTING); + +// Priority for HTTP requests. Use 0U. +static LLCore::HttpRequest::priority_t http_priority(0U); +LLAvatarRenderInfoAccountant::LLAvatarRenderInfoAccountant() + : mHttpRequest(new LLCore::HttpRequest) + , mHttpHeaders(new LLCore::HttpHeaders) + , mHttpOptions(new LLCore::HttpOptions) +{ + mHttpOptions->setTransferTimeout(SECS_BETWEEN_REGION_SCANS); + + mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); + mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); +} + +LLAvatarRenderInfoAccountant::~LLAvatarRenderInfoAccountant() +{ + mHttpOptions->release(); + mHttpHeaders->release(); + // delete mHttpRequest; ??? +} // HTTP responder class for GET request for avatar render weight information -class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder +class LLAvatarRenderInfoGetHandler : public LLCore::HttpHandler { +private: + LOG_CLASS(LLAvatarRenderInfoGetHandler); + public: - LLAvatarRenderInfoGetResponder(U64 region_handle) : mRegionHandle(region_handle) + LLAvatarRenderInfoGetHandler() : LLCore::HttpHandler() { } - virtual void error(U32 statusNum, const std::string& reason) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) + void onCompleted(LLCore::HttpHandle handle, + LLCore::HttpResponse* response) { - LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight GET: " << statusNum - << ", " << reason - << " returned by region " << regionp->getName() - << LL_ENDL; - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight GET error recieved but region not found for " - << mRegionHandle - << ", error " << statusNum - << ", " << reason - << LL_ENDL; - } - - } - - virtual void result(const LLSD& content) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) - { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights request for region '" << regionp->getName() << "':" << LL_ENDL; - - if (content.isMap()) - { - if (content.has(KEY_AGENTS)) + LLCore::HttpStatus status = response->getStatus(); + if (status) + { + LLSD avatar_render_info; + if (LLCoreHttpUtil::responseToLLSD(response, false /* quiet logging */, + avatar_render_info)) { - const LLSD & agents = content[KEY_AGENTS]; - if (agents.isMap()) + if (avatar_render_info.isMap()) { - LLSD::map_const_iterator report_iter = agents.beginMap(); - while (report_iter != agents.endMap()) + if (avatar_render_info.has(KEY_AGENTS)) { - LLUUID target_agent_id = LLUUID(report_iter->first); - const LLSD & agent_info_map = report_iter->second; - LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); - if ( avatarp - && avatarp->isAvatar() - && agent_info_map.isMap()) - { // Extract the data for this avatar - - LL_DEBUGS("AvatarRenderInfo") << "LRI: Agent " << target_agent_id - << ": " << agent_info_map << LL_ENDL; - - if (agent_info_map.has(KEY_WEIGHT)) + const LLSD & agents = avatar_render_info[KEY_AGENTS]; + if (agents.isMap()) + { + for (LLSD::map_const_iterator agent_iter = agents.beginMap(); + agent_iter != agents.endMap(); + agent_iter++ + ) { - ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); - } + LLUUID target_agent_id = LLUUID(agent_iter->first); + LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); + if (avatarp && avatarp->isAvatar()) + { + const LLSD & agent_info_map = agent_iter->second; + if (agent_info_map.isMap()) + { + LL_DEBUGS("AvatarRenderInfo") << " Agent " << target_agent_id + << ": " << agent_info_map << LL_ENDL; + + if (agent_info_map.has(KEY_WEIGHT)) + { + ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "agent entry invalid" + << " agent " << target_agent_id + << " map " << agent_info_map + << LL_ENDL; + } + } + else + { + LL_DEBUGS("AvatarRenderInfo") << "Unknown agent " << target_agent_id << LL_ENDL; + } + } // for agent_iter } else { - LL_WARNS("AvatarRenderInfo") << "LRI: agent entry invalid" - << " agent " << target_agent_id - << " map " << agent_info_map - << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response agents avatar_render_info is not map" << LL_ENDL; } - report_iter++; + } // has "agents" + else if (avatar_render_info.has(KEY_ERROR)) + { + const LLSD & error = avatar_render_info[KEY_ERROR]; + LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " + << error[KEY_IDENTIFIER] + << ": " << error[KEY_MESSAGE] + << LL_ENDL; + } + else + { + LL_WARNS("AvatarRenderInfo") << "no agent key in get response" << LL_ENDL; } } else { - LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response agents content is not map" << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response is not map" << LL_ENDL; } - - } // has "agents" - else if (content.has(KEY_ERROR)) - { - const LLSD & error = content[KEY_ERROR]; - LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " - << error[KEY_IDENTIFIER] - << ": " << error[KEY_MESSAGE] - << " from region " << regionp->getName() - << LL_ENDL; - } + } else { - LL_WARNS("AvatarRenderInfo") << "LRI: no agent key in get response" << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response parse failure" << LL_ENDL; } - } - else - { - LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response is not map" << LL_ENDL; - } - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight info recieved but region not found for " - << mRegionHandle << LL_ENDL; + } + else + { + // Something went wrong. Translate the status to + // a meaningful message. + LL_WARNS("AvatarRenderInfo") << "GET failed Status: " + << status.toTerseString() + << ", Reason: " << status.toString() + << LL_ENDL; + } + + delete this; // release the handler object } - } - -private: - U64 mRegionHandle; }; // HTTP responder class for POST request for avatar render weight information -class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder +class LLAvatarRenderInfoPostHandler : public LLCore::HttpHandler { -public: - LLAvatarRenderInfoPostResponder(U64 region_handle) : mRegionHandle(region_handle) - { - } + private: + LOG_CLASS(LLAvatarRenderInfoPostHandler); - virtual void error(U32 statusNum, const std::string& reason) + public: + LLAvatarRenderInfoPostHandler() : LLCore::HttpHandler() { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) - { - LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight POST: " << statusNum - << ", " << reason - << " returned by region " << regionp->getName() - << LL_ENDL; - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight POST error recieved but region not found for " - << mRegionHandle - << ", error " << statusNum - << ", " << reason - << LL_ENDL; - } } - virtual void result(const LLSD& content) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) + void onCompleted(LLCore::HttpHandle handle, + LLCore::HttpResponse* response) { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights POST for region " << regionp->getName() - << ": " << content << LL_ENDL; - - if (content.isMap()) + LLCore::HttpStatus status = response->getStatus(); + if (status) { - if (content.has(KEY_ERROR)) - { - const LLSD & error = content[KEY_ERROR]; - LL_WARNS("AvatarRenderInfo") << "Avatar render info POST error: " - << error[KEY_IDENTIFIER] - << ": " << error[KEY_MESSAGE] - << " from region " << regionp->getName() - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "post succeeded" << LL_ENDL; } + else + { + // Something went wrong. Translate the status to + // a meaningful message. + LL_WARNS("AvatarRenderInfo") << "POST failed Status: " + << status.toTerseString() + << ", Reason: " << status.toString() + << LL_ENDL; + } + + delete this; // release the handler object } - else - { - LL_INFOS("AvatarRenderInfo") << "Avatar render weight POST result recieved but region not found for " - << mRegionHandle << LL_ENDL; - } - } - -private: - U64 mRegionHandle; }; -// static // Send request for one region, no timer checks +// called when the void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regionp) { - std::string url = regionp->getCapability("AvatarRenderInfo"); - if (!url.empty()) + if ( regionp->getRenderInfoReportTimer().hasExpired() ) // Time to make request { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Checking for avatar render info to send to region " - << regionp->getName() - << " from " << url - << LL_ENDL; - - // Build the render info to POST to the region - LLSD report = LLSD::emptyMap(); - LLSD agents = LLSD::emptyMap(); - - std::vector::iterator iter = LLCharacter::sInstances.begin(); - while( iter != LLCharacter::sInstances.end() ) + U32 num_avs = 0; + + std::string url = regionp->getCapability("AvatarRenderInfo"); + if (!url.empty()) { - LLVOAvatar* avatar = dynamic_cast(*iter); - if (avatar && - avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) - !avatar->isDead() && // Not dead yet - avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region + // Build the render info to POST to the region + LLSD agents = LLSD::emptyMap(); + + std::vector::iterator iter = LLCharacter::sInstances.begin(); + while( iter != LLCharacter::sInstances.end() ) { - avatar->calculateUpdateRenderCost(); // Make sure the numbers are up-to-date - - LLSD info = LLSD::emptyMap(); - if (avatar->getVisualComplexity() > 0) + LLVOAvatar* avatar = dynamic_cast(*iter); + if (avatar && + avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) + !avatar->isDead() && // Not dead yet + avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region { - info[KEY_WEIGHT] = avatar->getVisualComplexity(); - agents[avatar->getID().asString()] = info; + avatar->calculateUpdateRenderCost(); // Make sure the numbers are up-to-date - LL_DEBUGS("AvatarRenderInfo") << "LRI: Sending avatar render info for " << avatar->getID() - << ": " << info << LL_ENDL; + LLSD info = LLSD::emptyMap(); + if (avatar->getVisualComplexity() > 0) + { + info[KEY_WEIGHT] = avatar->getVisualComplexity(); + agents[avatar->getID().asString()] = info; + + LL_DEBUGS("AvatarRenderInfo") << "Sending avatar render info for " << avatar->getID() + << ": " << info << LL_ENDL; + num_avs++; + } } + iter++; } - iter++; - } - report[KEY_AGENTS] = agents; - if (agents.size() > 0) + if (num_avs > 0) + { + LLSD report = LLSD::emptyMap(); + report[KEY_AGENTS] = agents; + + LLCore::HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); + LLAvatarRenderInfoPostHandler* handler = new LLAvatarRenderInfoPostHandler; + + handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, + http_policy, + http_priority, + url, + report, + mHttpOptions, + mHttpHeaders, + handler); + if (LLCORE_HTTP_HANDLE_INVALID == handle) + { + LLCore::HttpStatus status(mHttpRequest->getStatus()); + LL_WARNS("AvatarRenderInfo") << "HTTP POST request failed" + << " Status: " << status.toTerseString() + << " Reason: '" << status.toString() << "'" + << LL_ENDL; + delete handler; + } + else + { + LL_INFOS("AvatarRenderInfo") << "Sent render costs for " << num_avs + << " avatars to region " << regionp->getName() + << LL_ENDL; + + + } + } + else + { + LL_DEBUGS("AvatarRenderInfo") << "no agent info to send" << LL_ENDL; + } + } + else { - LL_INFOS("AvatarRenderInfo") << "LRI: Sending info for " << agents.size() - << " avatars to region " << regionp->getName() - << LL_ENDL; - LLHTTPClient::post(url, report, new LLAvatarRenderInfoPostResponder(regionp->getHandle())); + LL_WARNS("AvatarRenderInfo") << "AvatarRenderInfo cap is empty" << LL_ENDL; } + + // Reset this regions timer, moving to longer intervals if there are lots of avatars around + regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_REPORTS + (2.f * num_avs)); } } @@ -285,16 +320,39 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio // Send request for one region, no timer checks void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regionp) { - std::string url = regionp->getCapability("AvatarRenderInfo"); - if (!url.empty()) + if (regionp->getRenderInfoRequestTimer().hasExpired()) { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Requesting avatar render info for region " - << regionp->getName() - << " from " << url - << LL_ENDL; + std::string url = regionp->getCapability("AvatarRenderInfo"); + if (!url.empty()) + { + + LLAvatarRenderInfoGetHandler* handler = new LLAvatarRenderInfoGetHandler; + // First send a request to get the latest data + LLCore::HttpHandle handle = mHttpRequest->requestGet(http_policy, + http_priority, + url, + NULL, + NULL, + handler); + if (LLCORE_HTTP_HANDLE_INVALID != handle) + { + LL_INFOS("AvatarRenderInfo") << "Requested avatar render info for region " + << regionp->getName() + << LL_ENDL; + } + else + { + LL_WARNS("AvatarRenderInfo") << "Failed to launch HTTP GET request. Try again." + << LL_ENDL; + delete handler; + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "no AvatarRenderInfo cap for " << regionp->getName() << LL_ENDL; + } - // First send a request to get the latest data - LLHTTPClient::get(url, new LLAvatarRenderInfoGetResponder(regionp->getHandle())); + regionp->getRenderInfoRequestTimer().resetWithExpiry(SECS_BETWEEN_REGION_REQUEST); } } @@ -303,56 +361,60 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi // Called every frame - send render weight requests to every region void LLAvatarRenderInfoAccountant::idle() { - if (sRenderInfoReportTimer.hasExpired()) - { - const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds - const F32 SECS_BETWEEN_REGION_REQUEST = 60.0; // Update each region every 60 seconds + mHttpRequest->update(0); // give any pending http operations a chance to call completion methods - S32 num_avs = LLCharacter::sInstances.size(); - - LL_DEBUGS("AvatarRenderInfo") << "LRI: Scanning all regions and checking for render info updates" + if (mRenderInfoScanTimer.hasExpired()) + { + LL_DEBUGS("AvatarRenderInfo") << "Scanning regions for render info updates" << LL_ENDL; - // Check all regions and see if it's time to fetch/send data + // Check all regions for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + iter != LLWorld::getInstance()->getRegionList().end(); + ++iter) { LLViewerRegion* regionp = *iter; - if (regionp && - regionp->isAlive() && - regionp->capabilitiesReceived() && // Region has capability URLs available - regionp->getRenderInfoRequestTimer().hasExpired()) // Time to make request + if ( regionp + && regionp->isAlive() + && regionp->capabilitiesReceived()) { + // each of these is further governed by and resets its own timer sendRenderInfoToRegion(regionp); getRenderInfoFromRegion(regionp); - - // Reset this regions timer, moving to longer intervals if there are lots of avatars around - regionp->getRenderInfoRequestTimer().resetWithExpiry(SECS_BETWEEN_REGION_REQUEST + (2.f * num_avs)); } } // We scanned all the regions, reset the request timer. - sRenderInfoReportTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS); + mRenderInfoScanTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS); } } +void LLAvatarRenderInfoAccountant::resetRenderInfoScanTimer() +{ + // this will force the next frame to rescan + mRenderInfoScanTimer.reset(); +} // static -// Make sRenderInfoReportTimer expire so the next call to idle() will scan and query a new region -// called via LLViewerRegion::setCapabilitiesReceived() boost signals when the capabilities +// Called via LLViewerRegion::setCapabilitiesReceived() boost signals when the capabilities // are returned for a new LLViewerRegion, and is the earliest time to get render info -void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& region_id) +void LLAvatarRenderInfoAccountant::scanNewRegion(const LLUUID& region_id) { - LL_INFOS("AvatarRenderInfo") << "LRI: Viewer has new region capabilities, clearing global render info timer" - << " and timer for region " << region_id - << LL_ENDL; + LL_INFOS("AvatarRenderInfo") << region_id << LL_ENDL; - // Reset the global timer so it will scan regions immediately - sRenderInfoReportTimer.reset(); + // Reset the global timer so it will scan regions on the next call to ::idle + LLAvatarRenderInfoAccountant::getInstance()->resetRenderInfoScanTimer(); LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (regionp) - { // Reset the region's timer so it will request data immediately + { // Reset the region's timers so we will: + // * request render info from it immediately + // * report on the following scan regionp->getRenderInfoRequestTimer().reset(); + regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_SCANS); + } + else + { + LL_WARNS("AvatarRenderInfo") << "unable to resolve region "< { -public: - LLAvatarRenderInfoAccountant() {}; - ~LLAvatarRenderInfoAccountant() {}; + private: + LOG_CLASS(LLAvatarRenderInfoAccountant); - static void sendRenderInfoToRegion(LLViewerRegion * regionp); - static void getRenderInfoFromRegion(LLViewerRegion * regionp); + public: + LLAvatarRenderInfoAccountant(); + ~LLAvatarRenderInfoAccountant(); - static void expireRenderInfoReportTimer(const LLUUID& region_id); + void sendRenderInfoToRegion(LLViewerRegion * regionp); + void getRenderInfoFromRegion(LLViewerRegion * regionp); - static void idle(); + void idle(); // called once per frame -private: - // Send data updates about once per minute, only need per-frame resolution - static LLFrameTimer sRenderInfoReportTimer; + void resetRenderInfoScanTimer(); + + static void scanNewRegion(const LLUUID& region_id); + + private: + // frequency of region scans, + // further limited by per region Request and Report timers + LLFrameTimer mRenderInfoScanTimer; + + // + LLCore::HttpRequest* mHttpRequest; + LLCore::HttpHeaders* mHttpHeaders; + LLCore::HttpOptions* mHttpOptions; }; #endif /* ! defined(LL_llavatarrenderinfoaccountant_H) */ diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 11cbf3fc24..31493ca6ce 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -475,8 +475,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE mImpl->mVOCachePartition = getVOCachePartition(); - mRenderInfoRequestTimer.resetWithExpiry(0.f); // Set timer to be expired - setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer, _1)); + setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::scanNewRegion, _1)); } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 1e225553b8..fbe229e00f 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -431,7 +431,8 @@ public: static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. static S32 sLastCameraUpdated; - LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; + LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; + LLFrameTimer & getRenderInfoReportTimer() { return mRenderInfoReportTimer; }; struct CompareRegionByLastUpdate { @@ -536,7 +537,8 @@ private: // the materials capability throttle LLFrameTimer mMaterialsCapThrottleTimer; -LLFrameTimer mRenderInfoRequestTimer; + LLFrameTimer mRenderInfoRequestTimer; + LLFrameTimer mRenderInfoReportTimer; }; inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 816b2c8b67..7e9f098172 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3121,12 +3121,10 @@ bool LLVOAvatar::isVisuallyMuted() else { // Determine if visually muted or not - U32 max_cost = (U32) (max_render_cost); - muted = LLMuteList::getInstance()->isMuted(getID()) || (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || (mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f) || - (mVisualComplexity > max_cost && max_render_cost > 0); + (mVisualComplexity > max_render_cost && max_render_cost > 0); // Could be part of the grand || collection above, but yanked out to make the logic visible if (!muted) @@ -7967,11 +7965,17 @@ void LLVOAvatar::idleUpdateRenderCost() { mText->clearString(); // clear debug text } - + + /* + * NOTE: the logic for whether or not each of the values below + * controls muting MUST match that in the isVisuallyMuted method. + */ + + // Render Cost (ARC) calculateUpdateRenderCost(); // Update mVisualComplexity if needed static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - info_line = llformat("%d arc", mVisualComplexity); + info_line = llformat("%d ARC", mVisualComplexity); if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this { @@ -7980,16 +7984,37 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(red_level, green_level, 0.0, 1.0); info_style = ( mVisualComplexity > max_render_cost ? LLFontGL::BOLD : LLFontGL::NORMAL ); + } + else + { + info_color.set(LLColor4::grey); + info_style = LLFontGL::NORMAL; + } + mText->addLine(info_line, info_color, info_style); + + // TEMPORARY Reported Cost + info_line = llformat("%d reported ARC", mReportedVisualComplexity); + mText->addLine(info_line, info_color /* same as real ARC */, LLFontGL::ITALIC); + + // Visual rank + info_line = llformat("%d rank", mVisibilityRank); + if (sMaxVisible != 0) // zero means no limit, so don't bother coloring based on this + { + green_level = 1.f-llclamp(((F32)sMaxVisible-(F32)mVisibilityRank)/(F32)sMaxVisible, 0.f, 1.f); + red_level = llmin((F32) mVisibilityRank/(F32)sMaxVisible, 1.f); + info_color.set(red_level, green_level, 0.0, 1.0); + info_style = ( mVisibilityRank > sMaxVisible + ? LLFontGL::BOLD : LLFontGL::NORMAL ); } else { info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); + // Attachment Surface Area static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); info_line = llformat("%.2f m^2", mAttachmentSurfaceArea); @@ -8007,9 +8032,9 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max area " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); + // Attachment byte limit static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this @@ -8025,8 +8050,7 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; - mText->addLine(info_line, info_color); + mText->addLine(info_line, info_color, info_style); updateText(); // corrects position } @@ -8049,7 +8073,8 @@ void LLVOAvatar::calculateUpdateRenderCost() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict + = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); ETextureIndex tex_index = baked_dict->mTextureIndex; if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT))) { @@ -8061,11 +8086,11 @@ void LLVOAvatar::calculateUpdateRenderCost() } - for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) + for (attachment_map_t::const_iterator attachment_point = mAttachmentPoints.begin(); + attachment_point != mAttachmentPoints.end(); + ++attachment_point) { - LLViewerJointAttachment* attachment = iter->second; + LLViewerJointAttachment* attachment = attachment_point->second; for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) @@ -8095,10 +8120,12 @@ void LLVOAvatar::calculateUpdateRenderCost() } } - for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter) + for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin(); + volume_texture != textures.end(); + ++volume_texture) { // add the cost of each individual texture in the linkset - cost += iter->second; + cost += volume_texture->second; } } } -- cgit v1.2.3 From 0ea78f7af8f2ca2833607f418d62923240597fbd Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 15 Dec 2014 15:59:49 -0500 Subject: MAINT-4716: correct reading of avatar render cost info (experimental DO NOT PULL) --- indra/newview/llappviewer.cpp | 2 +- indra/newview/llavatarrenderinfoaccountant.cpp | 470 ++++++++++++++----------- indra/newview/llavatarrenderinfoaccountant.h | 33 +- indra/newview/llviewerregion.cpp | 3 +- indra/newview/llviewerregion.h | 6 +- indra/newview/llvoavatar.cpp | 59 +++- 6 files changed, 337 insertions(+), 236 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3a5008507a..4ad8181055 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5090,7 +5090,7 @@ void LLAppViewer::idle() } // Update AV render info - LLAvatarRenderInfoAccountant::idle(); + LLAvatarRenderInfoAccountant::getInstance()->idle(); { LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE); diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 83ae0438d9..8631f245a9 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -28,14 +28,16 @@ // Precompiled header #include "llviewerprecompiledheaders.h" -// associated header -#include "llavatarrenderinfoaccountant.h" // STL headers // std headers // external library headers // other Linden headers #include "llcharacter.h" -#include "llhttpclient.h" +#include "httprequest.h" +#include "httphandler.h" +#include "httpresponse.h" +#include "llcorehttputil.h" +#include "llappcorehttp.h" #include "lltimer.h" #include "llviewercontrol.h" #include "llviewermenu.h" @@ -43,6 +45,8 @@ #include "llviewerregion.h" #include "llvoavatar.h" #include "llworld.h" +// associated header +#include "llavatarrenderinfoaccountant.h" static const std::string KEY_AGENTS = "agents"; // map @@ -53,228 +57,259 @@ static const std::string KEY_MESSAGE = "message"; static const std::string KEY_ERROR = "error"; -// Send data updates about once per minute, only need per-frame resolution -LLFrameTimer LLAvatarRenderInfoAccountant::sRenderInfoReportTimer; +static const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds +static const F32 SECS_BETWEEN_REGION_REQUEST = 15.0; // Look for new avs every 15 seconds +static const F32 SECS_BETWEEN_REGION_REPORTS = 60.0; // Update each region every 60 seconds + + +// The policy class for HTTP traffic; this is the right value for all capability requests. +static LLCore::HttpRequest::policy_t http_policy(LLAppCoreHttp::AP_REPORTING); + +// Priority for HTTP requests. Use 0U. +static LLCore::HttpRequest::priority_t http_priority(0U); +LLAvatarRenderInfoAccountant::LLAvatarRenderInfoAccountant() + : mHttpRequest(new LLCore::HttpRequest) + , mHttpHeaders(new LLCore::HttpHeaders) + , mHttpOptions(new LLCore::HttpOptions) +{ + mHttpOptions->setTransferTimeout(SECS_BETWEEN_REGION_SCANS); + + mHttpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); + mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); +} + +LLAvatarRenderInfoAccountant::~LLAvatarRenderInfoAccountant() +{ + mHttpOptions->release(); + mHttpHeaders->release(); + // delete mHttpRequest; ??? +} // HTTP responder class for GET request for avatar render weight information -class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder +class LLAvatarRenderInfoGetHandler : public LLCore::HttpHandler { +private: + LOG_CLASS(LLAvatarRenderInfoGetHandler); + public: - LLAvatarRenderInfoGetResponder(U64 region_handle) : mRegionHandle(region_handle) + LLAvatarRenderInfoGetHandler() : LLCore::HttpHandler() { } - virtual void error(U32 statusNum, const std::string& reason) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) + void onCompleted(LLCore::HttpHandle handle, + LLCore::HttpResponse* response) { - LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight GET: " << statusNum - << ", " << reason - << " returned by region " << regionp->getName() - << LL_ENDL; - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight GET error recieved but region not found for " - << mRegionHandle - << ", error " << statusNum - << ", " << reason - << LL_ENDL; - } - - } - - virtual void result(const LLSD& content) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) - { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights request for region '" << regionp->getName() << "':" << LL_ENDL; - - if (content.isMap()) - { - if (content.has(KEY_AGENTS)) + LLCore::HttpStatus status = response->getStatus(); + if (status) + { + LLSD avatar_render_info; + if (LLCoreHttpUtil::responseToLLSD(response, false /* quiet logging */, + avatar_render_info)) { - const LLSD & agents = content[KEY_AGENTS]; - if (agents.isMap()) + if (avatar_render_info.isMap()) { - LLSD::map_const_iterator report_iter = agents.beginMap(); - while (report_iter != agents.endMap()) + if (avatar_render_info.has(KEY_AGENTS)) { - LLUUID target_agent_id = LLUUID(report_iter->first); - const LLSD & agent_info_map = report_iter->second; - LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); - if ( avatarp - && avatarp->isAvatar() - && agent_info_map.isMap()) - { // Extract the data for this avatar - - LL_DEBUGS("AvatarRenderInfo") << "LRI: Agent " << target_agent_id - << ": " << agent_info_map << LL_ENDL; - - if (agent_info_map.has(KEY_WEIGHT)) + const LLSD & agents = avatar_render_info[KEY_AGENTS]; + if (agents.isMap()) + { + for (LLSD::map_const_iterator agent_iter = agents.beginMap(); + agent_iter != agents.endMap(); + agent_iter++ + ) { - ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); - } + LLUUID target_agent_id = LLUUID(agent_iter->first); + LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); + if (avatarp && avatarp->isAvatar()) + { + const LLSD & agent_info_map = agent_iter->second; + if (agent_info_map.isMap()) + { + LL_DEBUGS("AvatarRenderInfo") << " Agent " << target_agent_id + << ": " << agent_info_map << LL_ENDL; + + if (agent_info_map.has(KEY_WEIGHT)) + { + ((LLVOAvatar *) avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "agent entry invalid" + << " agent " << target_agent_id + << " map " << agent_info_map + << LL_ENDL; + } + } + else + { + LL_DEBUGS("AvatarRenderInfo") << "Unknown agent " << target_agent_id << LL_ENDL; + } + } // for agent_iter } else { - LL_WARNS("AvatarRenderInfo") << "LRI: agent entry invalid" - << " agent " << target_agent_id - << " map " << agent_info_map - << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response agents avatar_render_info is not map" << LL_ENDL; } - report_iter++; + } // has "agents" + else if (avatar_render_info.has(KEY_ERROR)) + { + const LLSD & error = avatar_render_info[KEY_ERROR]; + LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " + << error[KEY_IDENTIFIER] + << ": " << error[KEY_MESSAGE] + << LL_ENDL; + } + else + { + LL_WARNS("AvatarRenderInfo") << "no agent key in get response" << LL_ENDL; } } else { - LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response agents content is not map" << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response is not map" << LL_ENDL; } - - } // has "agents" - else if (content.has(KEY_ERROR)) - { - const LLSD & error = content[KEY_ERROR]; - LL_WARNS("AvatarRenderInfo") << "Avatar render info GET error: " - << error[KEY_IDENTIFIER] - << ": " << error[KEY_MESSAGE] - << " from region " << regionp->getName() - << LL_ENDL; - } + } else { - LL_WARNS("AvatarRenderInfo") << "LRI: no agent key in get response" << LL_ENDL; + LL_WARNS("AvatarRenderInfo") << "malformed get response parse failure" << LL_ENDL; } - } - else - { - LL_WARNS("AvatarRenderInfo") << "LRI: malformed get response is not map" << LL_ENDL; - } - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight info recieved but region not found for " - << mRegionHandle << LL_ENDL; + } + else + { + // Something went wrong. Translate the status to + // a meaningful message. + LL_WARNS("AvatarRenderInfo") << "GET failed Status: " + << status.toTerseString() + << ", Reason: " << status.toString() + << LL_ENDL; + } + + delete this; // release the handler object } - } - -private: - U64 mRegionHandle; }; // HTTP responder class for POST request for avatar render weight information -class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder +class LLAvatarRenderInfoPostHandler : public LLCore::HttpHandler { -public: - LLAvatarRenderInfoPostResponder(U64 region_handle) : mRegionHandle(region_handle) - { - } + private: + LOG_CLASS(LLAvatarRenderInfoPostHandler); - virtual void error(U32 statusNum, const std::string& reason) + public: + LLAvatarRenderInfoPostHandler() : LLCore::HttpHandler() { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) - { - LL_WARNS("AvatarRenderInfo") << "HTTP error result for avatar weight POST: " << statusNum - << ", " << reason - << " returned by region " << regionp->getName() - << LL_ENDL; - } - else - { - LL_WARNS("AvatarRenderInfo") << "Avatar render weight POST error recieved but region not found for " - << mRegionHandle - << ", error " << statusNum - << ", " << reason - << LL_ENDL; - } } - virtual void result(const LLSD& content) - { - LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); - if (regionp) + void onCompleted(LLCore::HttpHandle handle, + LLCore::HttpResponse* response) { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Result for avatar weights POST for region " << regionp->getName() - << ": " << content << LL_ENDL; - - if (content.isMap()) + LLCore::HttpStatus status = response->getStatus(); + if (status) { - if (content.has(KEY_ERROR)) - { - const LLSD & error = content[KEY_ERROR]; - LL_WARNS("AvatarRenderInfo") << "Avatar render info POST error: " - << error[KEY_IDENTIFIER] - << ": " << error[KEY_MESSAGE] - << " from region " << regionp->getName() - << LL_ENDL; - } + LL_DEBUGS("AvatarRenderInfo") << "post succeeded" << LL_ENDL; } + else + { + // Something went wrong. Translate the status to + // a meaningful message. + LL_WARNS("AvatarRenderInfo") << "POST failed Status: " + << status.toTerseString() + << ", Reason: " << status.toString() + << LL_ENDL; + } + + delete this; // release the handler object } - else - { - LL_INFOS("AvatarRenderInfo") << "Avatar render weight POST result recieved but region not found for " - << mRegionHandle << LL_ENDL; - } - } - -private: - U64 mRegionHandle; }; -// static // Send request for one region, no timer checks +// called when the void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regionp) { - std::string url = regionp->getCapability("AvatarRenderInfo"); - if (!url.empty()) + if ( regionp->getRenderInfoReportTimer().hasExpired() ) // Time to make request { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Checking for avatar render info to send to region " - << regionp->getName() - << " from " << url - << LL_ENDL; - - // Build the render info to POST to the region - LLSD report = LLSD::emptyMap(); - LLSD agents = LLSD::emptyMap(); - - std::vector::iterator iter = LLCharacter::sInstances.begin(); - while( iter != LLCharacter::sInstances.end() ) + U32 num_avs = 0; + + std::string url = regionp->getCapability("AvatarRenderInfo"); + if (!url.empty()) { - LLVOAvatar* avatar = dynamic_cast(*iter); - if (avatar && - avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) - !avatar->isDead() && // Not dead yet - avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region + // Build the render info to POST to the region + LLSD agents = LLSD::emptyMap(); + + std::vector::iterator iter = LLCharacter::sInstances.begin(); + while( iter != LLCharacter::sInstances.end() ) { - avatar->calculateUpdateRenderCost(); // Make sure the numbers are up-to-date - - LLSD info = LLSD::emptyMap(); - if (avatar->getVisualComplexity() > 0) + LLVOAvatar* avatar = dynamic_cast(*iter); + if (avatar && + avatar->getRezzedStatus() >= 2 && // Mostly rezzed (maybe without baked textures downloaded) + !avatar->isDead() && // Not dead yet + avatar->getObjectHost() == regionp->getHost()) // Ensure it's on the same region { - info[KEY_WEIGHT] = avatar->getVisualComplexity(); - agents[avatar->getID().asString()] = info; + avatar->calculateUpdateRenderCost(); // Make sure the numbers are up-to-date - LL_DEBUGS("AvatarRenderInfo") << "LRI: Sending avatar render info for " << avatar->getID() - << ": " << info << LL_ENDL; + LLSD info = LLSD::emptyMap(); + if (avatar->getVisualComplexity() > 0) + { + info[KEY_WEIGHT] = avatar->getVisualComplexity(); + agents[avatar->getID().asString()] = info; + + LL_DEBUGS("AvatarRenderInfo") << "Sending avatar render info for " << avatar->getID() + << ": " << info << LL_ENDL; + num_avs++; + } } + iter++; } - iter++; - } - report[KEY_AGENTS] = agents; - if (agents.size() > 0) + if (num_avs > 0) + { + LLSD report = LLSD::emptyMap(); + report[KEY_AGENTS] = agents; + + LLCore::HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); + LLAvatarRenderInfoPostHandler* handler = new LLAvatarRenderInfoPostHandler; + + handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, + http_policy, + http_priority, + url, + report, + mHttpOptions, + mHttpHeaders, + handler); + if (LLCORE_HTTP_HANDLE_INVALID == handle) + { + LLCore::HttpStatus status(mHttpRequest->getStatus()); + LL_WARNS("AvatarRenderInfo") << "HTTP POST request failed" + << " Status: " << status.toTerseString() + << " Reason: '" << status.toString() << "'" + << LL_ENDL; + delete handler; + } + else + { + LL_INFOS("AvatarRenderInfo") << "Sent render costs for " << num_avs + << " avatars to region " << regionp->getName() + << LL_ENDL; + + + } + } + else + { + LL_DEBUGS("AvatarRenderInfo") << "no agent info to send" << LL_ENDL; + } + } + else { - LL_INFOS("AvatarRenderInfo") << "LRI: Sending info for " << agents.size() - << " avatars to region " << regionp->getName() - << LL_ENDL; - LLHTTPClient::post(url, report, new LLAvatarRenderInfoPostResponder(regionp->getHandle())); + LL_WARNS("AvatarRenderInfo") << "AvatarRenderInfo cap is empty" << LL_ENDL; } + + // Reset this regions timer, moving to longer intervals if there are lots of avatars around + regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_REPORTS + (2.f * num_avs)); } } @@ -285,16 +320,39 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio // Send request for one region, no timer checks void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regionp) { - std::string url = regionp->getCapability("AvatarRenderInfo"); - if (!url.empty()) + if (regionp->getRenderInfoRequestTimer().hasExpired()) { - LL_DEBUGS("AvatarRenderInfo") << "LRI: Requesting avatar render info for region " - << regionp->getName() - << " from " << url - << LL_ENDL; + std::string url = regionp->getCapability("AvatarRenderInfo"); + if (!url.empty()) + { + + LLAvatarRenderInfoGetHandler* handler = new LLAvatarRenderInfoGetHandler; + // First send a request to get the latest data + LLCore::HttpHandle handle = mHttpRequest->requestGet(http_policy, + http_priority, + url, + NULL, + NULL, + handler); + if (LLCORE_HTTP_HANDLE_INVALID != handle) + { + LL_INFOS("AvatarRenderInfo") << "Requested avatar render info for region " + << regionp->getName() + << LL_ENDL; + } + else + { + LL_WARNS("AvatarRenderInfo") << "Failed to launch HTTP GET request. Try again." + << LL_ENDL; + delete handler; + } + } + else + { + LL_WARNS("AvatarRenderInfo") << "no AvatarRenderInfo cap for " << regionp->getName() << LL_ENDL; + } - // First send a request to get the latest data - LLHTTPClient::get(url, new LLAvatarRenderInfoGetResponder(regionp->getHandle())); + regionp->getRenderInfoRequestTimer().resetWithExpiry(SECS_BETWEEN_REGION_REQUEST); } } @@ -303,56 +361,60 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi // Called every frame - send render weight requests to every region void LLAvatarRenderInfoAccountant::idle() { - if (sRenderInfoReportTimer.hasExpired()) - { - const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds - const F32 SECS_BETWEEN_REGION_REQUEST = 60.0; // Update each region every 60 seconds + mHttpRequest->update(0); // give any pending http operations a chance to call completion methods - S32 num_avs = LLCharacter::sInstances.size(); - - LL_DEBUGS("AvatarRenderInfo") << "LRI: Scanning all regions and checking for render info updates" + if (mRenderInfoScanTimer.hasExpired()) + { + LL_DEBUGS("AvatarRenderInfo") << "Scanning regions for render info updates" << LL_ENDL; - // Check all regions and see if it's time to fetch/send data + // Check all regions for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + iter != LLWorld::getInstance()->getRegionList().end(); + ++iter) { LLViewerRegion* regionp = *iter; - if (regionp && - regionp->isAlive() && - regionp->capabilitiesReceived() && // Region has capability URLs available - regionp->getRenderInfoRequestTimer().hasExpired()) // Time to make request + if ( regionp + && regionp->isAlive() + && regionp->capabilitiesReceived()) { + // each of these is further governed by and resets its own timer sendRenderInfoToRegion(regionp); getRenderInfoFromRegion(regionp); - - // Reset this regions timer, moving to longer intervals if there are lots of avatars around - regionp->getRenderInfoRequestTimer().resetWithExpiry(SECS_BETWEEN_REGION_REQUEST + (2.f * num_avs)); } } // We scanned all the regions, reset the request timer. - sRenderInfoReportTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS); + mRenderInfoScanTimer.resetWithExpiry(SECS_BETWEEN_REGION_SCANS); } } +void LLAvatarRenderInfoAccountant::resetRenderInfoScanTimer() +{ + // this will force the next frame to rescan + mRenderInfoScanTimer.reset(); +} // static -// Make sRenderInfoReportTimer expire so the next call to idle() will scan and query a new region -// called via LLViewerRegion::setCapabilitiesReceived() boost signals when the capabilities +// Called via LLViewerRegion::setCapabilitiesReceived() boost signals when the capabilities // are returned for a new LLViewerRegion, and is the earliest time to get render info -void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& region_id) +void LLAvatarRenderInfoAccountant::scanNewRegion(const LLUUID& region_id) { - LL_INFOS("AvatarRenderInfo") << "LRI: Viewer has new region capabilities, clearing global render info timer" - << " and timer for region " << region_id - << LL_ENDL; + LL_INFOS("AvatarRenderInfo") << region_id << LL_ENDL; - // Reset the global timer so it will scan regions immediately - sRenderInfoReportTimer.reset(); + // Reset the global timer so it will scan regions on the next call to ::idle + LLAvatarRenderInfoAccountant::getInstance()->resetRenderInfoScanTimer(); LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id); if (regionp) - { // Reset the region's timer so it will request data immediately + { // Reset the region's timers so we will: + // * request render info from it immediately + // * report on the following scan regionp->getRenderInfoRequestTimer().reset(); + regionp->getRenderInfoReportTimer().resetWithExpiry(SECS_BETWEEN_REGION_SCANS); + } + else + { + LL_WARNS("AvatarRenderInfo") << "unable to resolve region "< { -public: - LLAvatarRenderInfoAccountant() {}; - ~LLAvatarRenderInfoAccountant() {}; + private: + LOG_CLASS(LLAvatarRenderInfoAccountant); - static void sendRenderInfoToRegion(LLViewerRegion * regionp); - static void getRenderInfoFromRegion(LLViewerRegion * regionp); + public: + LLAvatarRenderInfoAccountant(); + ~LLAvatarRenderInfoAccountant(); - static void expireRenderInfoReportTimer(const LLUUID& region_id); + void sendRenderInfoToRegion(LLViewerRegion * regionp); + void getRenderInfoFromRegion(LLViewerRegion * regionp); - static void idle(); + void idle(); // called once per frame -private: - // Send data updates about once per minute, only need per-frame resolution - static LLFrameTimer sRenderInfoReportTimer; + void resetRenderInfoScanTimer(); + + static void scanNewRegion(const LLUUID& region_id); + + private: + // frequency of region scans, + // further limited by per region Request and Report timers + LLFrameTimer mRenderInfoScanTimer; + + // + LLCore::HttpRequest* mHttpRequest; + LLCore::HttpHeaders* mHttpHeaders; + LLCore::HttpOptions* mHttpOptions; }; #endif /* ! defined(LL_llavatarrenderinfoaccountant_H) */ diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 11cbf3fc24..31493ca6ce 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -475,8 +475,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE mImpl->mVOCachePartition = getVOCachePartition(); - mRenderInfoRequestTimer.resetWithExpiry(0.f); // Set timer to be expired - setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer, _1)); + setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::scanNewRegion, _1)); } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 1e225553b8..fbe229e00f 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -431,7 +431,8 @@ public: static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. static S32 sLastCameraUpdated; - LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; + LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; + LLFrameTimer & getRenderInfoReportTimer() { return mRenderInfoReportTimer; }; struct CompareRegionByLastUpdate { @@ -536,7 +537,8 @@ private: // the materials capability throttle LLFrameTimer mMaterialsCapThrottleTimer; -LLFrameTimer mRenderInfoRequestTimer; + LLFrameTimer mRenderInfoRequestTimer; + LLFrameTimer mRenderInfoReportTimer; }; inline BOOL LLViewerRegion::getRegionProtocol(U64 protocol) const diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 816b2c8b67..7e9f098172 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3121,12 +3121,10 @@ bool LLVOAvatar::isVisuallyMuted() else { // Determine if visually muted or not - U32 max_cost = (U32) (max_render_cost); - muted = LLMuteList::getInstance()->isMuted(getID()) || (mAttachmentGeometryBytes > max_attachment_bytes && max_attachment_bytes > 0) || (mAttachmentSurfaceArea > max_attachment_area && max_attachment_area > 0.f) || - (mVisualComplexity > max_cost && max_render_cost > 0); + (mVisualComplexity > max_render_cost && max_render_cost > 0); // Could be part of the grand || collection above, but yanked out to make the logic visible if (!muted) @@ -7967,11 +7965,17 @@ void LLVOAvatar::idleUpdateRenderCost() { mText->clearString(); // clear debug text } - + + /* + * NOTE: the logic for whether or not each of the values below + * controls muting MUST match that in the isVisuallyMuted method. + */ + + // Render Cost (ARC) calculateUpdateRenderCost(); // Update mVisualComplexity if needed static LLCachedControl max_render_cost(gSavedSettings, "RenderAutoMuteRenderWeightLimit", 0); - info_line = llformat("%d arc", mVisualComplexity); + info_line = llformat("%d ARC", mVisualComplexity); if (max_render_cost != 0) // zero means don't care, so don't bother coloring based on this { @@ -7980,16 +7984,37 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(red_level, green_level, 0.0, 1.0); info_style = ( mVisualComplexity > max_render_cost ? LLFontGL::BOLD : LLFontGL::NORMAL ); + } + else + { + info_color.set(LLColor4::grey); + info_style = LLFontGL::NORMAL; + } + mText->addLine(info_line, info_color, info_style); + + // TEMPORARY Reported Cost + info_line = llformat("%d reported ARC", mReportedVisualComplexity); + mText->addLine(info_line, info_color /* same as real ARC */, LLFontGL::ITALIC); + + // Visual rank + info_line = llformat("%d rank", mVisibilityRank); + if (sMaxVisible != 0) // zero means no limit, so don't bother coloring based on this + { + green_level = 1.f-llclamp(((F32)sMaxVisible-(F32)mVisibilityRank)/(F32)sMaxVisible, 0.f, 1.f); + red_level = llmin((F32) mVisibilityRank/(F32)sMaxVisible, 1.f); + info_color.set(red_level, green_level, 0.0, 1.0); + info_style = ( mVisibilityRank > sMaxVisible + ? LLFontGL::BOLD : LLFontGL::NORMAL ); } else { info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max cost " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); + // Attachment Surface Area static LLCachedControl max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 0); info_line = llformat("%.2f m^2", mAttachmentSurfaceArea); @@ -8007,9 +8032,9 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max area " << info_line << LL_ENDL; mText->addLine(info_line, info_color, info_style); + // Attachment byte limit static LLCachedControl max_attachment_bytes(gSavedSettings, "RenderAutoMuteByteLimit", 0); info_line = llformat("%.1f KB", mAttachmentGeometryBytes/1024.f); if (max_attachment_bytes != 0) // zero means don't care, so don't bother coloring based on this @@ -8025,8 +8050,7 @@ void LLVOAvatar::idleUpdateRenderCost() info_color.set(LLColor4::grey); info_style = LLFontGL::NORMAL; } - LL_DEBUGS() << "adding max bytes " << info_line << LL_ENDL; - mText->addLine(info_line, info_color); + mText->addLine(info_line, info_color, info_style); updateText(); // corrects position } @@ -8049,7 +8073,8 @@ void LLVOAvatar::calculateUpdateRenderCost() for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict + = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); ETextureIndex tex_index = baked_dict->mTextureIndex; if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(LLWearableType::WT_SKIRT))) { @@ -8061,11 +8086,11 @@ void LLVOAvatar::calculateUpdateRenderCost() } - for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); - ++iter) + for (attachment_map_t::const_iterator attachment_point = mAttachmentPoints.begin(); + attachment_point != mAttachmentPoints.end(); + ++attachment_point) { - LLViewerJointAttachment* attachment = iter->second; + LLViewerJointAttachment* attachment = attachment_point->second; for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) @@ -8095,10 +8120,12 @@ void LLVOAvatar::calculateUpdateRenderCost() } } - for (LLVOVolume::texture_cost_t::iterator iter = textures.begin(); iter != textures.end(); ++iter) + for (LLVOVolume::texture_cost_t::iterator volume_texture = textures.begin(); + volume_texture != textures.end(); + ++volume_texture) { // add the cost of each individual texture in the linkset - cost += iter->second; + cost += volume_texture->second; } } } -- cgit v1.2.3 From 6de394342d2a3bd15ab8889e04619591a09fd6c6 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 7 Jan 2015 18:38:31 -0500 Subject: STORM-2082 Add back labels for quality and speed slider Change two sliders back to comboboxes. Rename label "Other" to "General" Move Max ARC to top of that list Move Shaders block to above Mesh block --- indra/newview/llfloaterpreference.cpp | 24 +- .../skins/default/xui/en/floater_preferences.xml | 8 - .../default/xui/en/panel_preferences_graphics1.xml | 487 ++++++++++++--------- 3 files changed, 278 insertions(+), 241 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 9df7f82275..6e340864bc 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1117,7 +1117,7 @@ void LLFloaterPreference::buildPopupLists() void LLFloaterPreference::refreshEnabledState() { - LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLComboBox* ctrl_reflections = getChild("Reflections"); LLTextBox* reflections_text = getChild("ReflectionsText"); // Reflections @@ -1207,7 +1207,7 @@ void LLFloaterPreference::refreshEnabledState() LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); - LLUICtrl* ctrl_shadow = getChild("ShadowDetail"); + LLComboBox* ctrl_shadow = getChild("ShadowDetail"); LLTextBox* shadow_text = getChild("RenderShadowDetailText"); // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it @@ -1290,7 +1290,7 @@ void LLFloaterPreference::refreshEnabledState() void LLFloaterPreference::disableUnavailableSettings() { - LLUICtrl* ctrl_reflections = getChild("Reflections"); + LLComboBox* ctrl_reflections = getChild("Reflections"); LLTextBox* reflections_text = getChild("ReflectionsText"); LLCheckBoxCtrl* ctrl_avatar_vp = getChild("AvatarVertexProgram"); LLCheckBoxCtrl* ctrl_avatar_cloth = getChild("AvatarCloth"); @@ -1299,7 +1299,7 @@ void LLFloaterPreference::disableUnavailableSettings() LLCheckBoxCtrl* ctrl_avatar_impostors = getChild("AvatarImpostors"); LLCheckBoxCtrl* ctrl_deferred = getChild("UseLightShaders"); LLCheckBoxCtrl* ctrl_deferred2 = getChild("UseLightShaders2"); - LLUICtrl* ctrl_shadows = getChild("ShadowDetail"); + LLComboBox* ctrl_shadows = getChild("ShadowDetail"); LLTextBox* shadows_text = getChild("RenderShadowDetailText"); LLCheckBoxCtrl* ctrl_ssao = getChild("UseSSAO"); LLCheckBoxCtrl* ctrl_dof = getChild("UseDoF"); @@ -1476,8 +1476,6 @@ void LLFloaterPreference::refresh() updateSliderText(getChild("SkyMeshDetail", true), getChild("SkyMeshDetailText", true)); updateSliderText(getChild("TerrainDetail", true), getChild("TerrainDetailText", true)); updateSliderText(getChild("MaximumARC", true), getChild("MaximumARCText", true)); - updateSliderText(getChild("Reflections", true), getChild("ReflectionsText", true)); - updateSliderText(getChild("ShadowDetail", true), getChild("RenderShadowDetailText", true)); } void LLFloaterPreference::onCommitWindowedMode() @@ -1736,20 +1734,6 @@ void LLFloaterPreference::updateSliderText(LLSliderCtrl* ctrl, LLTextBox* text_b 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(); F32 min = ctrl->getMinValue(); diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index edc205927c..638a4e2da8 100755 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -11,14 +11,6 @@ single_instance="true" title="PREFERENCES" width="658"> - Minimal - Terrain and trees - All static objects - All avatars and objects - Everything - None - Sun/Moon - Sun/Moon + Projectors + + + + + + General @@ -471,14 +499,14 @@ control_name="MaximumARC" follows="left|top" height="16" - initial_value="0" + initial_value="101" increment="1" label="Maximum ARC:" label_width="165" layout="topleft" left="50" - min_val="0" - max_val="100" + min_val="1" + max_val="101" name="MaximumARC" show_text="false" top_delta="16" @@ -1185,14 +1213,15 @@ diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 023c6e5bbb..c09129c867 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -4046,4 +4046,5 @@ Try enclosing path to the editor with double quotes. -Empty list- Default Off + (None) -- cgit v1.2.3 From 56f43a390015f3ba721554ef9a0e436b6bfad5f9 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 20 Jan 2015 13:35:26 -0500 Subject: STORM-2082 Still trying to work out the dirtyChilds issue. Also made some small UI adjustments. --- indra/newview/llfloaterdeleteprefpreset.cpp | 2 ++ indra/newview/llfloaterpreference.cpp | 32 ++++++---------------- indra/newview/llfloaterpreference.h | 2 ++ indra/newview/llpresetsmanager.cpp | 13 ++++++--- indra/newview/llpresetsmanager.h | 1 + .../default/xui/en/panel_preferences_graphics1.xml | 17 ++++++------ 6 files changed, 31 insertions(+), 36 deletions(-) diff --git a/indra/newview/llfloaterdeleteprefpreset.cpp b/indra/newview/llfloaterdeleteprefpreset.cpp index 5cd37d61fc..68b107a1aa 100644 --- a/indra/newview/llfloaterdeleteprefpreset.cpp +++ b/indra/newview/llfloaterdeleteprefpreset.cpp @@ -73,6 +73,8 @@ void LLFloaterDeletePrefPreset::onBtnDelete() args["NAME"] = name; LLNotificationsUtil::add("PresetNotDeleted", args); } + + closeFloater(); } void LLFloaterDeletePrefPreset::onPresetsListChange() diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6dd030b280..34c34ffd65 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -107,7 +107,6 @@ #include "lllogininstance.h" // to check if logged in yet #include "llsdserialize.h" -#include "llpanelpresetspulldown.h" #include "llpresetsmanager.h" #include "llviewercontrol.h" #include "llpresetsmanager.h" @@ -1168,14 +1167,12 @@ void LLFloaterPreference::refreshEnabledState() BOOL shaders = ctrl_shader_enable->get(); if (shaders) { -llwarns << "DBG terrain OFF" << llendl; terrain_detail->setValue(1); terrain_detail->setEnabled(FALSE); terrain_text->setEnabled(FALSE); } else { -llwarns << "DBG terrain ON" << llendl; terrain_detail->setEnabled(TRUE); terrain_text->setEnabled(TRUE); } @@ -2282,7 +2279,9 @@ BOOL LLPanelPreferenceGraphics::postBuild() } #endif + resetDirtyChilds(); setPresetText(); + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPreferenceGraphics::onPresetsListChange, this)); return LLPanelPreference::postBuild(); @@ -2290,8 +2289,8 @@ BOOL LLPanelPreferenceGraphics::postBuild() void LLPanelPreferenceGraphics::draw() { - LLPanelPreference::draw(); setPresetText(); + LLPanelPreference::draw(); } void LLPanelPreferenceGraphics::onPresetsListChange() @@ -2307,13 +2306,9 @@ void LLPanelPreferenceGraphics::setPresetText() if (hasDirtyChilds()) { gSavedSettings.setString("PresetGraphicActive", ""); - - LLPanelPresetsPulldown* instance = LLFloaterReg::findTypedInstance("presets_pulldown"); - if (instance) - { -llwarns << "DBG populate" << llendl; - instance->populatePanel(); - } + // This doesn't seem to cause an infinite recursion. This trigger is needed to cause the pulldown + // panel to update. + LLPresetsManager::getInstance()->triggerChangeSignal(); } std::string preset_graphic_active = gSavedSettings.getString("PresetGraphicActive"); @@ -2326,8 +2321,6 @@ llwarns << "DBG populate" << llendl; { preset_text->setText(LLTrans::getString("none_paren_cap")); } - - preset_text->resetDirty(); } bool LLPanelPreferenceGraphics::hasDirtyChilds() @@ -2345,16 +2338,7 @@ bool LLPanelPreferenceGraphics::hasDirtyChilds() { if (ctrl->isDirty()) { - LLControlVariable* control = ctrl->getControlVariable(); - if (control) - { - std::string control_name = control->getName(); - if ((control_name != "RenderDeferred") && (control_name != "RenderTerrainDetail")) - { -llwarns << "DBG " << control_name << llendl; - return true; - } - } + return true; } } // Push children onto the end of the work stack @@ -2363,7 +2347,7 @@ llwarns << "DBG " << control_name << llendl; { view_stack.push_back(*iter); } - } + } return false; } diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index f73560e3c5..bb6e848178 100755 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -259,7 +259,9 @@ public: protected: bool hasDirtyChilds(); + private: + void onPresetsListChange(); }; diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp index 05138ee0c3..a08f77eeb1 100644 --- a/indra/newview/llpresetsmanager.cpp +++ b/indra/newview/llpresetsmanager.cpp @@ -47,6 +47,11 @@ LLPresetsManager::~LLPresetsManager() { } +void LLPresetsManager::triggerChangeSignal() +{ + mPresetListChangeSignal(); +} + void LLPresetsManager::createMissingDefault() { std::string default_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, PRESETS_DIR, PRESETS_GRAPHIC, "default.xml"); @@ -86,7 +91,7 @@ std::string LLPresetsManager::getPresetsDir(const std::string& subdirectory) void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir, preset_name_list_t& presets, EDefaultOptions default_option) { - LL_INFOS("AppInit") << "Loading presets from " << dir << LL_ENDL; + LL_INFOS("AppInit") << "Loading list of preset names from " << dir << LL_ENDL; mPresetNames.clear(); @@ -190,7 +195,7 @@ bool LLPresetsManager::savePreset(const std::string& subdirectory, const std::st gSavedSettings.setString("PresetGraphicActive", name); // signal interested parties - mPresetListChangeSignal(); + triggerChangeSignal(); return true; } @@ -240,7 +245,7 @@ void LLPresetsManager::loadPreset(const std::string& subdirectory, const std::st { gSavedSettings.setString("PresetGraphicActive", name); } - mPresetListChangeSignal(); + triggerChangeSignal(); } } @@ -265,7 +270,7 @@ bool LLPresetsManager::deletePreset(const std::string& subdirectory, const std:: } // signal interested parties - mPresetListChangeSignal(); + triggerChangeSignal(); return true; } diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h index 50fe9f4216..a47c07dfba 100644 --- a/indra/newview/llpresetsmanager.h +++ b/indra/newview/llpresetsmanager.h @@ -52,6 +52,7 @@ public: typedef boost::signals2::signal preset_list_signal_t; void createMissingDefault(); + void triggerChangeSignal(); 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); 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 b5a1c1eda6..6bc549ce94 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -235,7 +235,8 @@ @@ -254,7 +255,7 @@ layout="topleft" mouse_opaque="false" name="Basic" - top="30" + top="10" width="517">