summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp219
1 files changed, 131 insertions, 88 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 110e109a28..162acb74f1 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -52,9 +52,8 @@
#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"
@@ -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/regex.hpp>
#include <boost/algorithm/string.hpp>
#include "llcleanup.h"
+#include "llviewershadermgr.h"
using namespace LLAvatarAppearanceDefines;
@@ -2274,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;
}
};
@@ -2287,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;
}
};
@@ -7081,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;
}
@@ -7379,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();
@@ -7455,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");
@@ -8256,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();
@@ -8472,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;
@@ -8519,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;
}
@@ -8565,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
{
@@ -8612,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;
}
@@ -9228,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));
@@ -9267,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));