diff options
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r-- | indra/newview/llviewermenu.cpp | 275 |
1 files changed, 170 insertions, 105 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f859ced342..162acb74f1 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -45,15 +45,15 @@ // newview includes #include "llagent.h" #include "llagentaccess.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentui.h" #include "llagentwearables.h" #include "llagentpilot.h" #include "llcompilequeue.h" #include "llconsole.h" -#include "lldaycyclemanager.h" #include "lldebugview.h" -#include "llenvmanager.h" +#include "llenvironment.h" #include "llfilepicker.h" #include "llfirstuse.h" #include "llfloaterabout.h" @@ -120,21 +120,19 @@ #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" #include "lltrans.h" -#include "lleconomy.h" #include "lltoolgrab.h" #include "llwindow.h" #include "llpathfindingmanager.h" #include "llstartup.h" #include "boost/unordered_map.hpp" #include <boost/regex.hpp> +#include <boost/algorithm/string.hpp> #include "llcleanup.h" +#include "llviewershadermgr.h" using namespace LLAvatarAppearanceDefines; @@ -505,13 +503,13 @@ void init_menus() gViewerWindow->setMenuBackgroundColor(false, LLGridManager::getInstance()->isInProductionGrid()); - // Assume L$10 for now, the server will tell us the real cost at login // *TODO:Also fix cost in llfolderview.cpp for Inventory menus - const std::string upload_cost("10"); - gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); + gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str); + gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str); + gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str); gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE); @@ -2273,8 +2271,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; } }; @@ -2286,8 +2284,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; } }; @@ -7080,7 +7078,21 @@ BOOL object_is_wearable() { return FALSE; } - return gAgentAvatarp->canAttachMoreObjects(); + if (!gAgentAvatarp->canAttachMoreObjects()) + { + return FALSE; + } + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); + iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) + { + LLSelectNode* node = *iter; + if (node->mPermissions->getOwner() == gAgent.getID()) + { + return TRUE; + } + } + return FALSE; } @@ -7378,6 +7390,8 @@ void handle_dump_attachments(void*) // these are used in the gl menus to set control values, generically. class LLToggleControl : public view_listener_t { +protected: + bool handleEvent(const LLSD& userdata) { std::string control_name = userdata.asString(); @@ -7454,6 +7468,24 @@ class LLAdvancedClickRenderBenchmark: public view_listener_t } }; +// these are used in the gl menus to set control values that require shader recompilation +class LLToggleShaderControl : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string control_name = userdata.asString(); + BOOL checked = gSavedSettings.getBOOL( control_name ); + gSavedSettings.setBOOL( control_name, !checked ); + LLPipeline::refreshCachedSettings(); + //gPipeline.updateRenderDeferred(); + //gPipeline.releaseGLBuffers(); + //gPipeline.createGLBuffers(); + //gPipeline.resetVertexBuffers(); + LLViewerShaderMgr::instance()->setShaders(); + return !checked; + } +}; + void menu_toggle_attached_lights(void* user_data) { LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); @@ -8255,6 +8287,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(); @@ -8471,42 +8511,73 @@ 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; + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNRISE); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); } - - if (tod == "sunrise") + else if (event_name == "noon") { - LLEnvManagerNew::instance().setUseSkyPreset("Sunrise"); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDDAY); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); } - else if (tod == "noon") + else if (event_name == "sunset") { - LLEnvManagerNew::instance().setUseSkyPreset("Midday"); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_SUNSET); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); } - else if (tod == "sunset") + else if (event_name == "midnight") { - LLEnvManagerNew::instance().setUseSkyPreset("Sunset"); + LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::KNOWN_SKY_MIDNIGHT); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + LLEnvironment::instance().updateEnvironment(); + defocusEnvFloaters(); } - else if (tod == "midnight") + else if (event_name == "region") { - LLEnvManagerNew::instance().setUseSkyPreset("Midnight"); + 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 == "adjust_tool") { - 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); + LLFloaterReg::showInstance("env_adjust_snapshot"); + } + else if (event_name == "my_environs") + { + LLFloaterReg::showInstance("my_environments"); } return true; @@ -8518,39 +8589,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 (tod == "region"); + return LLEnvironment::instance().isCloudScrollPaused(); } - if (LLEnvManagerNew::instance().getUseFixedSky()) + LLSettingsSky::ptr_t sky = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL); + + if (!sky) { - if (tod == "sunrise") + return (event_name == "region"); + } + + std::string skyname = (sky) ? sky->getName() : ""; + LLUUID skyid = (sky) ? sky->getAssetId() : LLUUID::null; + + if (event_name == "sunrise") { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Sunrise"); + result = (skyid == LLEnvironment::KNOWN_SKY_SUNRISE); } - else if (tod == "noon") + else if (event_name == "noon") { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Midday"); + result = (skyid == LLEnvironment::KNOWN_SKY_MIDDAY); } - else if (tod == "sunset") + else if (event_name == "sunset") { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Sunset"); + result = (skyid == LLEnvironment::KNOWN_SKY_SUNSET); } - else if (tod == "midnight") + else if (event_name == "midnight") { - result = (LLEnvManagerNew::instance().getSkyPresetName() == "Midnight"); + result = (skyid == LLEnvironment::KNOWN_SKY_MIDNIGHT); } - else if (tod == "region") + else if (event_name == "region") { return false; } else { - LL_WARNS() << "Unknown time-of-day item: " << tod << LL_ENDL; - } + LL_WARNS() << "Unknown time-of-day item: " << event_name << LL_ENDL; } return result; } @@ -8564,39 +8642,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 { @@ -8611,30 +8677,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; } @@ -8662,18 +8704,31 @@ class LLUploadCostCalculator : public view_listener_t bool handleEvent(const LLSD& userdata) { - std::string menu_name = userdata.asString(); + std::vector<std::string> fields; + std::string str = userdata.asString(); + boost::split(fields, str, boost::is_any_of(",")); + if (fields.size()<1) + { + return false; + } + std::string menu_name = fields[0]; + std::string asset_type_str = "texture"; + if (fields.size()>1) + { + asset_type_str = fields[1]; + } + LL_DEBUGS("Benefits") << "userdata " << userdata << " menu_name " << menu_name << " asset_type_str " << asset_type_str << LL_ENDL; + calculateCost(asset_type_str); gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr); return true; } - void calculateCost(); + void calculateCost(const std::string& asset_type_str); public: LLUploadCostCalculator() { - calculateCost(); } }; @@ -8699,19 +8754,27 @@ class LLToggleUIHints : public view_listener_t } }; -void LLUploadCostCalculator::calculateCost() +void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) { - S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + S32 upload_cost = -1; - // getPriceUpload() returns -1 if no data available yet. - if(upload_cost >= 0) + if (asset_type_str == "texture") { - mCostStr = llformat("%d", upload_cost); + upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); } - else + else if (asset_type_str == "animation") + { + upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); + } + else if (asset_type_str == "sound") + { + upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost(); + } + if (upload_cost < 0) { - mCostStr = llformat("%d", gSavedSettings.getU32("DefaultUploadCost")); + LL_WARNS() << "Unable to find upload cost for asset_type_str " << asset_type_str << LL_ENDL; } + mCostStr = std::to_string(upload_cost); } void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) @@ -9206,6 +9269,7 @@ void initialize_menus() enable.add("Object.EnableSit", boost::bind(&enable_object_sit, _1)); view_listener_t::addMenu(new LLObjectEnableReturn(), "Object.EnableReturn"); + enable.add("Object.EnableDuplicate", boost::bind(&LLSelectMgr::canDuplicate, LLSelectMgr::getInstance())); view_listener_t::addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse"); enable.add("Avatar.EnableMute", boost::bind(&enable_object_mute)); @@ -9245,6 +9309,7 @@ void initialize_menus() view_listener_t::addMenu(new LLShowAgentProfile(), "ShowAgentProfile"); view_listener_t::addMenu(new LLToggleAgentProfile(), "ToggleAgentProfile"); view_listener_t::addMenu(new LLToggleControl(), "ToggleControl"); + view_listener_t::addMenu(new LLToggleShaderControl(), "ToggleShaderControl"); view_listener_t::addMenu(new LLCheckControl(), "CheckControl"); view_listener_t::addMenu(new LLGoToObject(), "GoToObject"); commit.add("PayObject", boost::bind(&handle_give_money_dialog)); |