diff options
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r-- | indra/newview/llviewermenu.cpp | 225 |
1 files changed, 114 insertions, 111 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 6c52f118ad..68a91968ea 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -51,9 +51,8 @@ #include "llagentpilot.h" #include "llcompilequeue.h" #include "llconsole.h" -#include "lldaycyclemanager.h" #include "lldebugview.h" -#include "llenvmanager.h" +#include "llenvironment.h" #include "llfacebookconnect.h" #include "llfilepicker.h" #include "llfirstuse.h" @@ -121,9 +120,6 @@ #include "llworldmap.h" #include "pipeline.h" #include "llviewerjoystick.h" -#include "llwaterparammanager.h" -#include "llwlanimator.h" -#include "llwlparammanager.h" #include "llfloatercamera.h" #include "lluilistener.h" #include "llappearancemgr.h" @@ -136,6 +132,7 @@ #include "boost/unordered_map.hpp" #include <boost/regex.hpp> #include "llcleanup.h" +#include "llviewershadermgr.h" using namespace LLAvatarAppearanceDefines; @@ -2277,8 +2274,8 @@ class LLAdvancedEnableRenderDeferred: public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = gGLManager.mHasFramebufferObject && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1 && - LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0; + bool new_value = gGLManager.mHasFramebufferObject && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1 && + LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0; return new_value; } }; @@ -2290,8 +2287,8 @@ class LLAdvancedEnableRenderDeferredOptions: public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = gGLManager.mHasFramebufferObject && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1 && - LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0 && gSavedSettings.getBOOL("RenderDeferred"); + bool new_value = gGLManager.mHasFramebufferObject && LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1 && + LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0 && gSavedSettings.getBOOL("RenderDeferred"); return new_value; } }; @@ -8261,6 +8258,14 @@ class LLViewToggleBeacon : public view_listener_t gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() ); } } + else if (beacon == "sunbeacon") + { + gSavedSettings.setBOOL("sunbeacon", !gSavedSettings.getBOOL("sunbeacon")); + } + else if (beacon == "moonbeacon") + { + gSavedSettings.setBOOL("moonbeacon", !gSavedSettings.getBOOL("moonbeacon")); + } else if (beacon == "renderbeacons") { LLPipeline::toggleRenderBeacons(); @@ -8477,44 +8482,71 @@ class LLToolsSelectTool : public view_listener_t /// WINDLIGHT callbacks class LLWorldEnvSettings : public view_listener_t { + void defocusEnvFloaters() + { + //currently there is only one instance of each floater + std::vector<std::string> env_floaters_names = { "env_edit_extdaycycle", "env_fixed_environmentent_water", "env_fixed_environmentent_sky" }; + for (std::vector<std::string>::const_iterator it = env_floaters_names.begin(); it != env_floaters_names.end(); ++it) + { + LLFloater* env_floater = LLFloaterReg::findTypedInstance<LLFloater>(*it); + if (env_floater) + { + env_floater->setFocus(FALSE); + } + } + } + bool handleEvent(const LLSD& userdata) { - std::string tod = userdata.asString(); + std::string event_name = userdata.asString(); - if (tod == "editor") + if (event_name == "sunrise") { - LLFloaterReg::toggleInstance("env_settings"); - return true; - } - - if (tod == "sunrise") - { - LLEnvManagerNew::instance().setUseSkyPreset("Sunrise"); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNRISE); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); } - else if (tod == "noon") + else if (event_name == "noon") { - LLEnvManagerNew::instance().setUseSkyPreset("Midday"); - } - else if (tod == "sunset") + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDDAY); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); + } + else if (event_name == "sunset") { - LLEnvManagerNew::instance().setUseSkyPreset("Sunset"); - } - else if (tod == "midnight") + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNSET); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); + } + else if (event_name == "midnight") { - LLEnvManagerNew::instance().setUseSkyPreset("Midnight"); - } - else + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDNIGHT); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); + } + else if (event_name == "region") { - LLEnvManagerNew &envmgr = LLEnvManagerNew::instance(); - // reset all environmental settings to track the region defaults, make this reset 'sticky' like the other sun settings. - bool use_fixed_sky = false; - bool use_region_settings = true; - envmgr.setUserPrefs(envmgr.getWaterPresetName(), - envmgr.getSkyPresetName(), - envmgr.getDayCycleName(), - use_fixed_sky, use_region_settings); - } - + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); + } + else if (event_name == "pause_clouds") + { + if (LLEnvironment::instance().isCloudScrollPaused()) + LLEnvironment::instance().resumeCloudScroll(); + else + LLEnvironment::instance().pauseCloudScroll(); + } + else if (event_name == "my_environs") + { + LLFloaterReg::showInstance("my_environments"); + } + return true; } }; @@ -8524,39 +8556,46 @@ class LLWorldEnableEnvSettings : public view_listener_t bool handleEvent(const LLSD& userdata) { bool result = false; - std::string tod = userdata.asString(); + std::string event_name = userdata.asString(); - if (LLEnvManagerNew::instance().getUseRegionSettings()) + if (event_name == "pause_clouds") + { + return LLEnvironment::instance().isCloudScrollPaused(); + } + + LLSettingsSky::ptr_t sky = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL); + + if (!sky) { - return (tod == "region"); + return (event_name == "region"); } - if (LLEnvManagerNew::instance().getUseFixedSky()) + std::string skyname = (sky) ? sky->getName() : ""; + LLUUID skyid = (sky) ? sky->getAssetId() : LLUUID::null; + + if (event_name == "sunrise") { - if (tod == "sunrise") - { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Sunrise"); - } - else if (tod == "noon") - { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Midday"); - } - else if (tod == "sunset") - { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Sunset"); - } - else if (tod == "midnight") - { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Midnight"); - } - else if (tod == "region") - { - return false; - } - else - { - LL_WARNS() << "Unknown time-of-day item: " << tod << LL_ENDL; - } + result = (skyid == LLEnvironment::KNOWN_SKY_SUNRISE); + } + else if (event_name == "noon") + { + result = (skyid == LLEnvironment::KNOWN_SKY_MIDDAY); + } + else if (event_name == "sunset") + { + result = (skyid == LLEnvironment::KNOWN_SKY_SUNSET); + } + else if (event_name == "midnight") + { + result = (skyid == LLEnvironment::KNOWN_SKY_MIDNIGHT); + } + else if (event_name == "region") + { + return false; + } + else + { + LL_WARNS() << "Unknown time-of-day item: " << event_name << LL_ENDL; } return result; } @@ -8570,39 +8609,27 @@ class LLWorldEnvPreset : public view_listener_t if (item == "new_water") { - LLFloaterReg::showInstance("env_edit_water", "new"); + LLFloaterReg::showInstance("env_fixed_environmentent_water", "new"); } else if (item == "edit_water") { - LLFloaterReg::showInstance("env_edit_water", "edit"); - } - else if (item == "delete_water") - { - LLFloaterReg::showInstance("env_delete_preset", "water"); - } + LLFloaterReg::showInstance("env_fixed_environmentent_water", "edit"); + } else if (item == "new_sky") { - LLFloaterReg::showInstance("env_edit_sky", "new"); - } + LLFloaterReg::showInstance("env_fixed_environmentent_sky", "new"); + } else if (item == "edit_sky") { - LLFloaterReg::showInstance("env_edit_sky", "edit"); - } - else if (item == "delete_sky") - { - LLFloaterReg::showInstance("env_delete_preset", "sky"); - } + LLFloaterReg::showInstance("env_fixed_environmentent_sky", "edit"); + } else if (item == "new_day_cycle") { - LLFloaterReg::showInstance("env_edit_day_cycle", "new"); + LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory")); } else if (item == "edit_day_cycle") { - LLFloaterReg::showInstance("env_edit_day_cycle", "edit"); - } - else if (item == "delete_day_cycle") - { - LLFloaterReg::showInstance("env_delete_preset", "day_cycle"); + LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory")); } else { @@ -8617,30 +8644,6 @@ class LLWorldEnableEnvPreset : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string item = userdata.asString(); - - if (item == "delete_water") - { - LLWaterParamManager::preset_name_list_t user_waters; - LLWaterParamManager::instance().getUserPresetNames(user_waters); - return !user_waters.empty(); - } - else if (item == "delete_sky") - { - LLWLParamManager::preset_name_list_t user_skies; - LLWLParamManager::instance().getUserPresetNames(user_skies); - return !user_skies.empty(); - } - else if (item == "delete_day_cycle") - { - LLDayCycleManager::preset_name_list_t user_days; - LLDayCycleManager::instance().getUserPresetNames(user_days); - return !user_days.empty(); - } - else - { - LL_WARNS() << "Unknown item" << LL_ENDL; - } return false; } |