From 31c1cff64fe6e963722e580c8779d69cef4b14ba Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Jul 2011 00:42:28 +0300 Subject: STORM-1262 FIXED Removed the original Windlight Region Settings implementation. --- indra/newview/CMakeLists.txt | 8 - indra/newview/app_settings/settings.xml | 22 - indra/newview/llenvmanager.cpp | 544 +-------- indra/newview/llenvmanager.h | 98 +- indra/newview/llfloaterdaycycle.cpp | 525 -------- indra/newview/llfloaterdaycycle.h | 131 -- indra/newview/llfloatereditdaycycle.cpp | 2 +- indra/newview/llfloaterenvsettings.cpp | 254 ---- indra/newview/llfloaterenvsettings.h | 89 -- indra/newview/llfloaterregioninfo.cpp | 110 -- indra/newview/llfloaterregioninfo.h | 19 - indra/newview/llfloaterwater.cpp | 662 ---------- indra/newview/llfloaterwater.h | 110 -- indra/newview/llfloaterwindlight.cpp | 1003 --------------- indra/newview/llfloaterwindlight.h | 131 -- indra/newview/llviewerfloaterreg.cpp | 8 - indra/newview/llviewermenu.cpp | 20 - indra/newview/llwaterparammanager.cpp | 8 - indra/newview/llwaterparamset.cpp | 1 - indra/newview/llwaterparamset.h | 1 - indra/newview/llwldaycycle.cpp | 1 - indra/newview/llwlhandlers.h | 3 - indra/newview/llwlparammanager.cpp | 20 - indra/newview/llwlparamset.cpp | 1 - indra/newview/llwlparamset.h | 1 - .../default/xui/da/floater_day_cycle_options.xml | 96 -- .../skins/default/xui/da/floater_env_settings.xml | 31 - .../newview/skins/default/xui/da/floater_water.xml | 103 -- .../default/xui/da/floater_windlight_options.xml | 228 ---- .../default/xui/de/floater_day_cycle_options.xml | 94 -- .../skins/default/xui/de/floater_env_settings.xml | 26 - .../newview/skins/default/xui/de/floater_water.xml | 72 -- .../default/xui/de/floater_windlight_options.xml | 189 --- .../default/xui/en/floater_day_cycle_options.xml | 416 ------- .../skins/default/xui/en/floater_env_settings.xml | 172 --- .../newview/skins/default/xui/en/floater_water.xml | 503 -------- .../default/xui/en/floater_windlight_options.xml | 1278 -------------------- .../newview/skins/default/xui/en/notifications.xml | 114 -- indra/newview/skins/default/xui/en/strings.xml | 2 - .../default/xui/es/floater_day_cycle_options.xml | 94 -- .../skins/default/xui/es/floater_env_settings.xml | 28 - .../newview/skins/default/xui/es/floater_water.xml | 88 -- .../default/xui/es/floater_windlight_options.xml | 190 --- .../default/xui/fr/floater_day_cycle_options.xml | 94 -- .../skins/default/xui/fr/floater_env_settings.xml | 29 - .../newview/skins/default/xui/fr/floater_water.xml | 70 -- .../default/xui/fr/floater_windlight_options.xml | 189 --- .../default/xui/it/floater_day_cycle_options.xml | 94 -- .../skins/default/xui/it/floater_env_settings.xml | 29 - .../newview/skins/default/xui/it/floater_water.xml | 95 -- .../default/xui/it/floater_windlight_options.xml | 190 --- .../default/xui/ja/floater_day_cycle_options.xml | 94 -- .../skins/default/xui/ja/floater_env_settings.xml | 25 - .../newview/skins/default/xui/ja/floater_water.xml | 70 -- .../default/xui/ja/floater_windlight_options.xml | 189 --- .../default/xui/nl/floater_day_cycle_options.xml | 94 -- .../skins/default/xui/nl/floater_env_settings.xml | 24 - .../newview/skins/default/xui/nl/floater_water.xml | 89 -- .../default/xui/nl/floater_windlight_options.xml | 190 --- .../default/xui/pl/floater_day_cycle_options.xml | 96 -- .../skins/default/xui/pl/floater_env_settings.xml | 28 - .../newview/skins/default/xui/pl/floater_water.xml | 103 -- .../default/xui/pl/floater_windlight_options.xml | 228 ---- .../default/xui/pt/floater_day_cycle_options.xml | 67 - .../skins/default/xui/pt/floater_env_settings.xml | 27 - .../newview/skins/default/xui/pt/floater_water.xml | 86 -- .../default/xui/pt/floater_windlight_options.xml | 187 --- .../default/xui/zh/floater_day_cycle_options.xml | 95 -- .../skins/default/xui/zh/floater_env_settings.xml | 25 - .../newview/skins/default/xui/zh/floater_water.xml | 70 -- .../default/xui/zh/floater_windlight_options.xml | 167 --- indra/newview/tests/llfloaterdaycycle_stub.cpp | 20 - indra/newview/tests/llfloaterenvsettings_stub.cpp | 20 - indra/newview/tests/llfloaterwindlight_stub.cpp | 20 - indra/newview/tests/llwlparammanager_test.cpp | 3 - 75 files changed, 19 insertions(+), 10284 deletions(-) delete mode 100644 indra/newview/llfloaterdaycycle.cpp delete mode 100644 indra/newview/llfloaterdaycycle.h delete mode 100644 indra/newview/llfloaterenvsettings.cpp delete mode 100644 indra/newview/llfloaterenvsettings.h delete mode 100644 indra/newview/llfloaterwater.cpp delete mode 100644 indra/newview/llfloaterwater.h delete mode 100644 indra/newview/llfloaterwindlight.cpp delete mode 100644 indra/newview/llfloaterwindlight.h delete mode 100644 indra/newview/skins/default/xui/da/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/da/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/da/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/da/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/de/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/de/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/de/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/de/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/en/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/es/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/es/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/es/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/es/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/fr/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/fr/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/fr/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/it/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/it/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/it/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/it/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/ja/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/ja/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/ja/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/ja/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/nl/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/nl/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/nl/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/nl/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/pl/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/pl/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/pl/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/pt/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/pt/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/pt/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/pt/floater_windlight_options.xml delete mode 100644 indra/newview/skins/default/xui/zh/floater_day_cycle_options.xml delete mode 100644 indra/newview/skins/default/xui/zh/floater_env_settings.xml delete mode 100644 indra/newview/skins/default/xui/zh/floater_water.xml delete mode 100644 indra/newview/skins/default/xui/zh/floater_windlight_options.xml delete mode 100644 indra/newview/tests/llfloaterdaycycle_stub.cpp delete mode 100644 indra/newview/tests/llfloaterenvsettings_stub.cpp delete mode 100644 indra/newview/tests/llfloaterwindlight_stub.cpp (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e930b2ac71..367d3de0c9 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -180,13 +180,11 @@ set(viewer_SOURCE_FILES llfloaterbuyland.cpp llfloatercamera.cpp llfloatercolorpicker.cpp - llfloaterdaycycle.cpp llfloaterdeleteenvpreset.cpp llfloaterdisplayname.cpp llfloatereditdaycycle.cpp llfloatereditsky.cpp llfloatereditwater.cpp - llfloaterenvsettings.cpp llfloaterenvironmentsettings.cpp llfloaterevent.cpp llfloaterfonttest.cpp @@ -240,10 +238,8 @@ set(viewer_SOURCE_FILES llfloateruipreview.cpp llfloaterurlentry.cpp llfloatervoiceeffect.cpp - llfloaterwater.cpp llfloaterwebcontent.cpp llfloaterwhitelistentry.cpp - llfloaterwindlight.cpp llfloaterwindowsize.cpp llfloaterworldmap.cpp llfolderview.cpp @@ -740,13 +736,11 @@ set(viewer_HEADER_FILES llfloaterbuyland.h llfloatercamera.h llfloatercolorpicker.h - llfloaterdaycycle.h llfloaterdeleteenvpreset.h llfloaterdisplayname.h llfloatereditdaycycle.h llfloatereditsky.h llfloatereditwater.h - llfloaterenvsettings.h llfloaterenvironmentsettings.h llfloaterevent.h llfloaterfonttest.h @@ -800,10 +794,8 @@ set(viewer_HEADER_FILES llfloateruipreview.h llfloaterurlentry.h llfloatervoiceeffect.h - llfloaterwater.h llfloaterwebcontent.h llfloaterwhitelistentry.h - llfloaterwindlight.h llfloaterwindowsize.h llfloaterworldmap.h llfolderview.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index efe605e5e6..01daf1ceb2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10237,17 +10237,6 @@ Value 0.300000011921 - SkyEditPresets - - Comment - Whether to be able to edit the sky defaults or not - Persist - 1 - Type - Boolean - Value - 0 - SkyNightColorShift Comment @@ -12543,17 +12532,6 @@ Value 20 - WaterEditPresets - - Comment - Whether to be able to edit the water defaults or not - Persist - 1 - Type - Boolean - Value - 0 - WaterGLFogDensityScale Comment diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 4051a4d8db..c2720eaf28 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -35,536 +35,12 @@ #include "llenvmanager.h" #include "llagent.h" -#include "llviewerregion.h" - #include "lldaycyclemanager.h" -#include "llfloaterreg.h" -#include "llfloaterwindlight.h" -#include "llfloaterwater.h" -#include "llfloaterenvsettings.h" -#include "llwlparammanager.h" +#include "llviewercontrol.h" // for gSavedSettings +#include "llviewerregion.h" #include "llwaterparammanager.h" -#include "llfloaterregioninfo.h" -//#include "llwindlightscrubbers.h" // *HACK commented out since this code isn't released (yet) #include "llwlhandlers.h" -#include "llnotifications.h" - -extern LLControlGroup gSavedSettings; - -/*virtual*/ void LLEnvManager::initSingleton() -{ - LL_DEBUGS("Windlight") << "Initializing LLEnvManager" << LL_ENDL; - - mOrigSettingStore[LLEnvKey::SCOPE_LOCAL] = lindenDefaults(); - mCurNormalScope = (gSavedSettings.getBOOL("UseEnvironmentFromRegion") ? LLEnvKey::SCOPE_REGION : LLEnvKey::SCOPE_LOCAL); - mInterpNextChangeMessage = true; - mPendingOutgoingMessage = false; - mIsEditing = false; -} - -/******* - * Region Changes - *******/ - -void LLEnvManager::notifyLogin() -{ - changedRegion(false); -} -void LLEnvManager::notifyCrossing() -{ - changedRegion(true); -} -void LLEnvManager::notifyTP() -{ - changedRegion(false); -} -void LLEnvManager::changedRegion(bool interp) -{ - mInterpNextChangeMessage = interp; - mPendingOutgoingMessage = false; - - LLFloaterReg::hideInstance("old_env_settings"); - LLFloaterReg::hideInstance("env_settings"); - - resetInternalsToDefault(LLEnvKey::SCOPE_REGION); - - maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); -} - -/******* - * Editing settings / UI mode - *******/ - -void LLEnvManager::startEditingScope(LLEnvKey::EScope scope) -{ - LL_DEBUGS("Windlight") << "Starting editing scope " << scope << LL_ENDL; - - if (mIsEditing) - { - LL_WARNS("Windlight") << "Tried to start editing windlight settings while already editing some settings (possibly others)! Ignoring..." << LL_ENDL; - return; - } - if (!canEdit(scope)) - { - LL_WARNS("Windlight") << "Tried to start editing windlight settings while not allowed to! Ignoring..." << LL_ENDL; - return; - } - - mIsEditing = true; - mCurEditingScope = scope; - - // Back up local settings so that we can switch back to them later. - if (scope != LLEnvKey::SCOPE_LOCAL) - { - backUpLocalSettingsIfNeeded(); - } - - // show scope being edited - loadSettingsIntoManagers(scope, false); - - switch (scope) - { - case LLEnvKey::SCOPE_LOCAL: - // not implemented here (yet) - return; - case LLEnvKey::SCOPE_REGION: - /* LLPanelRegionTerrainInfo::instance()->setCommitControls(true); the windlight settings are no longer on the region terrain panel */ - break; - default: - return; - } -} - -void LLEnvManager::maybeClearEditingScope(LLEnvKey::EScope scope, bool user_initiated, bool was_commit) -{ - if (mIsEditing && mCurEditingScope == scope) - { - maybeClearEditingScope(user_initiated, was_commit); // handles UI, updating managers, etc. - } -} - -void LLEnvManager::maybeClearEditingScope(bool user_initiated, bool was_commit) -{ - bool clear_now = true; - if (mIsEditing && !was_commit) - { - if(user_initiated) - { - LLSD args; - args["SCOPE"] = getScopeString(mCurEditingScope); - LLNotifications::instance().add("EnvEditUnsavedChangesCancel", args, LLSD(), - boost::bind(&LLEnvManager::clearEditingScope, this, _1, _2)); - clear_now = false; - } - else - { - LLNotifications::instance().add("EnvEditExternalCancel", LLSD(), LLSD()); - } - } - - if(clear_now) - { - clearEditingScope(LLSD(), LLSD()); - } -} - -void LLEnvManager::clearEditingScope(const LLSD& notification, const LLSD& response) -{ - if(notification.isDefined() && response.isDefined() && LLNotification::getSelectedOption(notification, response) != 0) - { -#if 0 - // *TODO: select terrain panel here - mIsEditing = false; - LLFloaterReg::showTypedInstance("regioninfo"); -#endif - return; - } - - mIsEditing = false; - - updateUIFromEditability(); - /* LLPanelRegionTerrainInfo::instance()->cancelChanges(); the terrain panel no longer has windlight data - if this is needed, it should move. */ - - loadSettingsIntoManagers(mCurNormalScope, true); -} - -void LLEnvManager::updateUIFromEditability() -{ - // *TODO When the checkbox from LLFloaterEnvSettings is moved elsewhere, opening the local environment settings window should auto-display local settings - // Currently, disable all editing to ensure region settings are hidden from those that can't edit them (to preserve possibility of future tradable assets) - // Remove "!gSavedSettings.getBOOL(...)" when the desired behavior is implemented -// LLFloaterEnvSettings::instance()->setControlsEnabled(canEdit(LLEnvKey::SCOPE_LOCAL) && !gSavedSettings.getBOOL("UseEnvironmentFromRegion")); -// LLPanelRegionTerrainInfo::instance()->setEnvControls(canEdit(LLEnvKey::SCOPE_REGION)); - // enable estate UI iff canEdit(LLEnvKey::SCOPE_ESTATE), etc. -} - -bool LLEnvManager::regionCapable() -{ - return !gAgent.getRegion()->getCapability("EnvironmentSettings").empty(); -} - -const std::string LLEnvManager::getScopeString(LLEnvKey::EScope scope) -{ - switch(scope) - { - case LLEnvKey::SCOPE_LOCAL: - return LLTrans::getString("LocalSettings"); - case LLEnvKey::SCOPE_REGION: - return LLTrans::getString("RegionSettings"); - default: - return " (?)"; - } -} - -bool LLEnvManager::canEdit(LLEnvKey::EScope scope) -{ - // can't edit while a message is being sent or if already editing - if (mPendingOutgoingMessage || mIsEditing) - { - return false; - } - - // check permissions and caps - switch (scope) - { - case LLEnvKey::SCOPE_LOCAL: - return true; // always permitted to edit local - case LLEnvKey::SCOPE_REGION: - bool owner_or_god_or_manager; - { - LLViewerRegion* region = gAgent.getRegion(); - if (NULL == region || region->getCapability("EnvironmentSettings").empty()) - { - // not a windlight-aware region - return false; - } - owner_or_god_or_manager = gAgent.isGodlike() - || (region && (region->getOwner() == gAgent.getID())) - || (region && region->isEstateManager()); - } - return owner_or_god_or_manager; - default: - return false; - } -} - -/******* - * Incoming Messaging - *******/ - -void LLEnvManager::refreshFromStorage(LLEnvKey::EScope scope) -{ - // Back up local env. settings so that we can switch to them later. - if (scope != LLEnvKey::SCOPE_LOCAL) - { - backUpLocalSettingsIfNeeded(); - } - - switch (scope) - { - case LLEnvKey::SCOPE_LOCAL: - break; - case LLEnvKey::SCOPE_REGION: - if (!LLEnvironmentRequest::initiate()) - { - // don't have a cap for this, presume invalid response - processIncomingMessage(LLSD(), scope); - } - break; - default: - processIncomingMessage(LLSD(), scope); - break; - } -} - -bool LLEnvManager::processIncomingMessage(const LLSD& unvalidated_content, const LLEnvKey::EScope scope) -{ - if (scope != LLEnvKey::SCOPE_REGION) - { - return false; - } - - // Start out with defaults - resetInternalsToDefault(scope); - updateUIFromEditability(); - - // Validate - //std::set empty_set; - //LLWLPacketScrubber scrubber(scope, empty_set); - //LLSD windlight_llsd = scrubber.scrub(unvalidated_content); - - //bool valid = windlight_llsd.isDefined(); // successful scrub - - // *HACK - Don't have the validator, so just use content without validating. Should validate here for third-party grids. - LLSD windlight_llsd(unvalidated_content); - bool valid = true; - // end HACK - - mLastReceivedID = unvalidated_content[0]["messageID"].asUUID(); // if the message was valid, grab the UUID from it and save it for next outbound update message - LL_DEBUGS("Windlight Sync") << "mLastReceivedID: " << mLastReceivedID << LL_ENDL; - LL_DEBUGS("Windlight Sync") << "windlight_llsd: " << windlight_llsd << LL_ENDL; - - if (valid) - { - // TODO - the sun controls are moving; this should be updated - F32 sun_hour = 0; - LLPanelRegionTerrainInfo* terrain_panel = LLPanelRegionTerrainInfo::instance(); - - if (terrain_panel) - { - sun_hour = terrain_panel->getSunHour(); // this slider is kept up to date - } - else - { - llwarns << "Cannot instantiate the terrain panel (exiting?)" << llendl; - } - - LLWLParamManager::getInstance()->addAllSkies(scope, windlight_llsd[2]); - LLEnvironmentSettings newSettings(windlight_llsd[1], windlight_llsd[2], windlight_llsd[3], sun_hour); - mOrigSettingStore[scope] = newSettings; - } - else - { - LL_WARNS("Windlight Sync") << "Failed to parse windlight settings!" << LL_ENDL; - // presume defaults (already reset above) - } - - maybeClearEditingScope(scope, false, false); - - // refresh display with new settings, if applicable - if (mCurNormalScope == scope && !mIsEditing) // if mIsEditing still, must be editing some other scope, so don't load - { - loadSettingsIntoManagers(scope, mInterpNextChangeMessage); - } - else - { - LL_DEBUGS("Windlight Sync") << "Not loading settings (mCurNormalScope=" << mCurNormalScope << ", scope=" << scope << ", mIsEditing=" << mIsEditing << ")" << LL_ENDL; - } - - mInterpNextChangeMessage = true; // reset flag - - return valid; -} - - -/******* - * Outgoing Messaging - *******/ - -void LLEnvManager::commitSettings(LLEnvKey::EScope scope) -{ - LL_DEBUGS("Windlight Sync") << "commitSettings(scope = " << scope << ")" << LL_ENDL; - - bool success = true; - switch (scope) - { - case (LLEnvKey::SCOPE_LOCAL): - // not implemented - LLWLParamManager and LLWaterParamManager currently manage local storage themselves - break; - case (LLEnvKey::SCOPE_REGION): - mPendingOutgoingMessage = true; - LLSD metadata(LLSD::emptyMap()); - metadata["regionID"] = gAgent.getRegion()->getRegionID(); - metadata["messageID"] = mLastReceivedID; // add last received update ID to outbound message so simulator can handle concurrent updates - - saveSettingsFromManagers(scope); // save current settings into settings store before grabbing from settings store and sending - success = LLEnvironmentApply::initiateRequest(makePacket(LLEnvKey::SCOPE_REGION, metadata)); - if(success) - { - // while waiting for the return message, render old settings - // (as of Aug 09, we should get an updated RegionInfo packet, which triggers a re-request of Windlight data, which causes us to show new settings) - loadSettingsIntoManagers(LLEnvKey::SCOPE_REGION, true); - } - break; - } - - if(success) - { - // with mPendingOutgoingMessage = true, nothing is editable - updateUIFromEditability(); - maybeClearEditingScope(true, true); - } - else - { - mPendingOutgoingMessage = false; - } -} - -LLSD LLEnvManager::makePacket(LLEnvKey::EScope scope, const LLSD& metadata) -{ - return mOrigSettingStore[scope].makePacket(metadata); -} - -void LLEnvManager::commitSettingsFinished(LLEnvKey::EScope scope) -{ - mPendingOutgoingMessage = false; - - updateUIFromEditability(); -} - -void LLEnvManager::applyLocalSettingsToRegion() -{ - // Immediately apply current environment settings to region. - LLEnvManager::instance().commitSettings(LLEnvKey::SCOPE_REGION); -} - -/******* - * Loading defaults - *******/ - -void LLEnvManager::resetInternalsToDefault(LLEnvKey::EScope scope) -{ - if (LLEnvKey::SCOPE_LOCAL != scope) - { - LLWLParamManager::getInstance()->clearParamSetsOfScope(scope); - } - - mOrigSettingStore[scope] = lindenDefaults(); - LLWLParamManager::getInstance()->mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN); -} - -const LLEnvironmentSettings& LLEnvManager::lindenDefaults() -{ - static bool loaded = false; - static LLEnvironmentSettings defSettings; - - if (!loaded) - { - LLWaterParamSet defaultWater; - LLWaterParamManager::instance().getParamSet("default", defaultWater); - - // *TODO save default skies (remove hack in LLWLDayCycle::loadDayCycle when this is done) - - defSettings.saveParams( - LLWLDayCycle::loadCycleDataFromFile("default.xml"), // frames will refer to local presets, which is okay - LLSD(LLSD::emptyMap()), // should never lose the default sky presets (read-only) - defaultWater.getAll(), - 0.0); - - loaded = true; - } - - return defSettings; -} - -/******* - * Manipulation of Param Managers - *******/ - -void LLEnvManager::loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate) -{ - LL_DEBUGS("Windlight Sync") << "Loading settings (scope = " << scope << ")" << LL_ENDL; - - LLEnvironmentSettings settings = mOrigSettingStore[scope]; - - if(interpolate) - { - LLWLParamManager::getInstance()->mAnimator.startInterpolation(settings.getWaterParams()); - } - - LLWLParamManager::getInstance()->addAllSkies(scope, settings.getSkyMap()); - LLWLParamManager::getInstance()->mDay.loadDayCycle(settings.getWLDayCycle(), scope); - LLWLParamManager::getInstance()->resetAnimator(settings.getDayTime(), true); - - LLWaterParamManager::getInstance()->mCurParams.setAll(settings.getWaterParams()); -} - -void LLEnvManager::saveSettingsFromManagers(LLEnvKey::EScope scope) -{ - LL_DEBUGS("Windlight Sync") << "Saving settings (scope = " << scope << ")" << LL_ENDL; - switch (scope) - { - case LLEnvKey::SCOPE_LOCAL: - mOrigSettingStore[scope].saveParams( - LLWLParamManager::getInstance()->mDay.asLLSD(), - LLSD(LLSD::emptyMap()), // never overwrite - LLWaterParamManager::getInstance()->mCurParams.getAll(), - LLWLParamManager::getInstance()->mAnimator.mDayTime); - break; - case LLEnvKey::SCOPE_REGION: - { - // ensure only referenced region-scope skies are saved, resolve naming collisions, etc. - std::map final_references = LLWLParamManager::getInstance()->finalizeFromDayCycle(scope); - LLSD referenced_skies = LLWLParamManager::createSkyMap(final_references); - - LL_DEBUGS("Windlight Sync") << "Dumping referenced skies (" << final_references.size() << ") to LLSD: " << referenced_skies << LL_ENDL; - - mOrigSettingStore[scope].saveParams( - LLWLParamManager::getInstance()->mDay.asLLSD(), - referenced_skies, - LLWaterParamManager::getInstance()->mCurParams.getAll(), - LLWLParamManager::getInstance()->mAnimator.mDayTime); - } - break; - default: - return; - } -} - -void LLEnvManager::backUpLocalSettingsIfNeeded() -{ - // *HACK: Back up local env. settings so that we can switch to them later. - // Otherwise local day cycle is likely to be reset. - static bool sSavedLocalSettings = false; - - if (!sSavedLocalSettings) - { - LL_DEBUGS("Windlight") << "Backing up local environment settings" << LL_ENDL; - saveSettingsFromManagers(LLEnvKey::SCOPE_LOCAL); - sSavedLocalSettings = true; - } -} - -/******* - * Setting desired display level - *******/ - -void LLEnvManager::setNormallyDisplayedScope(LLEnvKey::EScope new_scope) -{ - // temp, just save the scope directly as a value in the future when there's more than two - bool want_region = (LLEnvKey::SCOPE_REGION == new_scope); - gSavedSettings.setBOOL("UseEnvironmentFromRegion", want_region); - - if (mCurNormalScope != new_scope) - { - LL_INFOS("Windlight") << "Switching to scope " << new_scope << LL_ENDL; - mCurNormalScope = new_scope; - notifyOptInChange(); - } -} - -LLEnvKey::EScope LLEnvManager::getNormallyDisplayedScope() const -{ - return mCurNormalScope; -} - -void LLEnvManager::notifyOptInChange() -{ - bool opt_in = gSavedSettings.getBOOL("UseEnvironmentFromRegion"); - - // Save local settings if switching to region - if(opt_in) - { - LL_INFOS("Windlight") << "Saving currently-displayed settings as current local settings..." << LL_ENDL; - saveSettingsFromManagers(LLEnvKey::SCOPE_LOCAL); - } - - maybeClearEditingScope(true, false); -} - -void LLEnvManager::dumpScopes() -{ - LLSD scope_dump; - - scope_dump = makePacket(LLEnvKey::SCOPE_LOCAL, LLSD()); - LL_DEBUGS("Windlight") << "Local scope:" << scope_dump << LL_ENDL; - - scope_dump = makePacket(LLEnvKey::SCOPE_REGION, LLSD()); - LL_DEBUGS("Windlight") << "Region scope:" << scope_dump << LL_ENDL; -} - - -//============================================================================= +#include "llwlparammanager.h" std::string LLEnvPrefs::getWaterPresetName() const { @@ -973,6 +449,20 @@ bool LLEnvManagerNew::canEditRegionSettings() return owner_or_god_or_manager; } +// static +const std::string LLEnvManagerNew::getScopeString(LLEnvKey::EScope scope) +{ + switch(scope) + { + case LLEnvKey::SCOPE_LOCAL: + return LLTrans::getString("LocalSettings"); + case LLEnvKey::SCOPE_REGION: + return LLTrans::getString("RegionSettings"); + default: + return " (?)"; + } +} + void LLEnvManagerNew::onRegionCrossing() { LL_DEBUGS("Windlight") << "Crossed region" << LL_ENDL; diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 343416634c..96af102c1a 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -133,103 +133,6 @@ private: F64 mDayTime; }; -// not thread-safe -class LLEnvManager : public LLSingleton -{ - LOG_CLASS(LLEnvManager); -public: - // sets scopes (currently, only region-scope) to startup states - // delay calling these until as close as possible to knowing whether the remote service is capable of holding windlight settings - void notifyCrossing(); - // these avoid interpolation on the next incoming message (if it comes) - void notifyLogin(); - void notifyTP(); - - // request settings again from remote storage (currently implemented only for region) - void refreshFromStorage(LLEnvKey::EScope scope); - // stores settings and starts transitions (as necessary) - // validates packet and returns whether it was valid - // loads defaults if not valid - // returns whether or not arguments were valid - bool processIncomingMessage(const LLSD& packet, LLEnvKey::EScope scope); - // saves settings in the given scope to persistent storage appropriate for that scope - void commitSettings(LLEnvKey::EScope scope); - // called back when the commit finishes - void commitSettingsFinished(LLEnvKey::EScope scope); - // Immediately apply current settings from managers to region. - void applyLocalSettingsToRegion(); - - /* - * notify of changes in god/not-god mode, estate ownership, etc. - * should be called every time after entering new region (after receiving new caps) - */ - void notifyPermissionChange(); - - bool regionCapable(); - static const std::string getScopeString(LLEnvKey::EScope scope); - bool canEdit(LLEnvKey::EScope scope); - // enables and populates UI - // populates display (param managers) with scope's settings - // silently fails if canEdit(scope) is false! - void startEditingScope(LLEnvKey::EScope scope); - // cancel and close UI as necessary - // reapplies unedited settings - // displays the settings from the scope that user has set (i.e. opt-in setting for now) - void maybeClearEditingScope(bool user_initiated, bool was_commit); - // clear the scope only if was editing that scope - void maybeClearEditingScope(LLEnvKey::EScope scope, bool user_initiated, bool was_commit); - // actually do the clearing - void clearEditingScope(const LLSD& notification, const LLSD& response); - - // clear and reload defaults into scope - void resetInternalsToDefault(LLEnvKey::EScope scope); - - // sets which scope is to be displayed - // fix me if/when adding more levels of scope - void setNormallyDisplayedScope(LLEnvKey::EScope scope); - // gets normally displayed scope - LLEnvKey::EScope getNormallyDisplayedScope() const; - - // for debugging purposes - void dumpScopes(); - -private: - // overriden initializer - friend class LLSingleton; - virtual void initSingleton(); - // helper function (when region changes, but before caps are received) - void changedRegion(bool interpolate); - // apply to current display and UI - void loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate); - // save from current display and UI into memory (mOrigSettingStore) - void saveSettingsFromManagers(LLEnvKey::EScope scope); - // If not done already, save current local environment settings, so that we can switch to them later. - void backUpLocalSettingsIfNeeded(); - - // Save copy of settings from the current ones in the param managers - LLEnvironmentSettings collateFromParamManagers(); - // bundle settings (already committed from UI) into an LLSD - LLSD makePacket(LLEnvKey::EScope scope, const LLSD& metadata); - - void updateUIFromEditability(); - - // only call when setting *changes*, not just when it might have changed - // saves local settings into mOrigSettingStore when necessary - void notifyOptInChange(); - - // calculate Linden default settings - static const LLEnvironmentSettings& lindenDefaults(); - - std::map mOrigSettingStore; // settings which have been committed from UI - - bool mInterpNextChangeMessage; - bool mPendingOutgoingMessage; - bool mIsEditing; - LLEnvKey::EScope mCurNormalScope; // scope being displayed when not editing (i.e. most of the time) - LLEnvKey::EScope mCurEditingScope; - LLUUID mLastReceivedID; -}; - /** * User environment preferences. */ @@ -329,6 +232,7 @@ public: boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); static bool canEditRegionSettings(); /// @return true if we have access to editing region environment + static const std::string getScopeString(LLEnvKey::EScope scope); // Public callbacks. void onRegionCrossing(); diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp deleted file mode 100644 index 9fcfc41f77..0000000000 --- a/indra/newview/llfloaterdaycycle.cpp +++ /dev/null @@ -1,525 +0,0 @@ -/** - * @file llfloaterdaycycle.cpp - * @brief LLFloaterDayCycle class definition - * - * $LicenseInfo:firstyear=2007&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 "llfloaterdaycycle.h" - -#include "pipeline.h" -#include "llsky.h" - -#include "llsliderctrl.h" -#include "llmultislider.h" -#include "llmultisliderctrl.h" -#include "llspinctrl.h" -#include "llcheckboxctrl.h" -#include "lluictrlfactory.h" -#include "llviewercamera.h" -#include "llcombobox.h" -#include "lllineeditor.h" -#include "llwlanimator.h" -#include "llnotifications.h" -#include "llnotificationsutil.h" - -#include "v4math.h" -#include "llviewerdisplay.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" - -#include "llwlparamset.h" -#include "llwlparammanager.h" -#include "llpostprocess.h" -#include "llfloaterwindlight.h" -//#include "llwindlightscrubbers.h" // *HACK commented out since this code isn't released (yet) -#include "llenvmanager.h" -#include "llfloaterreg.h" - -LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; -const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; -std::map LLFloaterDayCycle::sSliderToKey; -LLEnvKey::EScope LLFloaterDayCycle::sScope; -std::string LLFloaterDayCycle::sOriginalTitle; -LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN; - -LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key) -{ -} - -// virtual -BOOL LLFloaterDayCycle::postBuild() -{ - sOriginalTitle = getTitle(); - - // *HACK commented out since this code isn't released (yet) - //llassert(LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue() && - // LLWLPacketScrubber::MAX_REGION_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue()); - - // add the time slider - LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); - - sldr->addSlider(); - - // load it up - initCallbacks(); - - return TRUE; -} - -LLFloaterDayCycle::~LLFloaterDayCycle() -{ -} - -void LLFloaterDayCycle::onClickHelp(void* data) -{ - std::string xml_alert = *(std::string *) data; - LLNotifications::instance().add(xml_alert, LLSD(), LLSD()); -} - -void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) -{ - childSetAction(name, onClickHelp, new std::string(xml_alert)); -} - -void LLFloaterDayCycle::initCallbacks(void) -{ - initHelpBtn("WLDayCycleHelp", "HelpDayCycle"); - - // WL Day Cycle - childSetCommitCallback("WLTimeSlider", onTimeSliderMoved, NULL); - childSetCommitCallback("WLDayCycleKeys", onKeyTimeMoved, NULL); - childSetCommitCallback("WLCurKeyHour", onKeyTimeChanged, NULL); - childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL); - childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL); - - childSetAction("WLAddKey", onAddKey, NULL); - childSetAction("WLDeleteKey", onDeleteKey, NULL); -} - -void LLFloaterDayCycle::syncMenu() -{ - // set time - LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild("WLTimeSlider"); - sldr->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); - - // turn off Use Estate Time button if it's already being used - if( LLWLParamManager::getInstance()->mAnimator.getUseLindenTime()) - { - LLFloaterDayCycle::sDayCycle->childDisable("WLUseLindenTime"); - } - else - { - LLFloaterDayCycle::sDayCycle->childEnable("WLUseLindenTime"); - } -} - -void LLFloaterDayCycle::syncSliderTrack() -{ - // clear the slider - LLMultiSliderCtrl* kSldr = sDayCycle->getChild("WLDayCycleKeys"); - - kSldr->clear(); - sSliderToKey.clear(); - - // add sliders - - lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl; - - std::map::iterator mIt = - LLWLParamManager::getInstance()->mDay.mTimeMap.begin(); - for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++) - { - addSliderKey(mIt->first * sHoursPerDay, mIt->second); - } -} - -void LLFloaterDayCycle::syncTrack() -{ - lldebugs << "Syncing track (" << sSliderToKey.size() << ")" << llendl; - - // if no keys, do nothing - if(sSliderToKey.size() == 0) - { - lldebugs << "No keys, not syncing" << llendl; - return; - } - - LLMultiSliderCtrl* sldr; - sldr = sDayCycle->getChild( - "WLDayCycleKeys"); - llassert_always(sSliderToKey.size() == sldr->getValue().size()); - - LLMultiSliderCtrl* tSldr; - tSldr = sDayCycle->getChild( - "WLTimeSlider"); - - // create a new animation track - LLWLParamManager::getInstance()->mDay.clearKeyframes(); - - // add the keys one by one - std::map::iterator mIt = sSliderToKey.begin(); - for(; mIt != sSliderToKey.end(); mIt++) - { - LLWLParamManager::getInstance()->mDay.addKeyframe(mIt->second.time / sHoursPerDay, - mIt->second.keyframe); - } - - // set the param manager's track to the new one - LLWLParamManager::getInstance()->resetAnimator( - tSldr->getCurSliderValue() / sHoursPerDay, false); - - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); -} - -void LLFloaterDayCycle::refreshPresetsFromParamManager() -{ - LLComboBox* keyCombo = sDayCycle->getChild("WLKeyPresets"); - - if(keyCombo != NULL) - { - LLWLParamManager::preset_key_list_t preset_keys; - LLWLParamManager::instance().getPresetKeys(preset_keys); - for (LLWLParamManager::preset_key_list_t::const_iterator it = preset_keys.begin(); it != preset_keys.end(); ++it) - { - if (it->scope <= sScope) - { - const LLWLParamKey& key = *it; - llinfos << "Adding key: " << key.toString() << llendl; - keyCombo->add(key.toString(), LLSD(key.toStringVal())); - } - } - - // set defaults on combo boxes - keyCombo->selectFirstItem(); - } -} - -// static -LLFloaterDayCycle* LLFloaterDayCycle::instance() -{ - if (!sDayCycle) - { - lldebugs << "Instantiating Day Cycle floater" << llendl; - sDayCycle = LLFloaterReg::getTypedInstance("env_day_cycle"); - llassert(sDayCycle); - // sDayCycle->open(); - // sDayCycle->setFocus(TRUE); - } - return sDayCycle; -} - -bool LLFloaterDayCycle::isOpen() -{ - if (sDayCycle != NULL) - { - return true; - } - return false; -} - -void LLFloaterDayCycle::show(LLEnvKey::EScope scope) -{ - LLFloaterDayCycle* dayCycle = instance(); - if(scope != sScope && ((LLView*)dayCycle)->getVisible()) - { - LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); - return; - } - sScope = scope; - std::string title = sOriginalTitle + " (" + LLEnvManager::getScopeString(sScope) + ")"; - dayCycle->setTitle(title); - refreshPresetsFromParamManager(); - dayCycle->syncMenu(); - syncSliderTrack(); - - // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially) - const std::string& curSldr = sDayCycle->getChild("WLDayCycleKeys")->getCurSlider(); - if(strlen(curSldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map - { - sDayCycle->getChild("WLKeyPresets")->selectByValue(sSliderToKey[curSldr].keyframe.toStringVal()); - } - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); - //dayCycle->initCallbacks(); - - dayCycle->openFloater(); -} - -// virtual -void LLFloaterDayCycle::onClose(bool app_quitting) -{ - if (sDayCycle) - { - lldebugs << "Destorying Day Cycle floater" << llendl; - sDayCycle = NULL; - } -} - -void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) -{ - LLMultiSliderCtrl* sldr = sDayCycle->getChild( - "WLTimeSlider"); - - /// get the slider value - F32 val = sldr->getCurSliderValue() / sHoursPerDay; - - // set the value, turn off animation - LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - // then call update once - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); -} - -void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) -{ - LLComboBox* comboBox = sDayCycle->getChild("WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); - LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); - - if(sldr->getValue().size() == 0) { - return; - } - - // make sure we have a slider - const std::string& curSldr = sldr->getCurSlider(); - if(curSldr == "") { - return; - } - - F32 time = sldr->getCurSliderValue(); - - // check to see if a key exists - LLWLParamKey key = sSliderToKey[curSldr].keyframe; - sSliderToKey[curSldr].time = time; - - // if it exists, turn on check box - comboBox->selectByValue(key.toStringVal()); - - // now set the spinners - F32 hour = (F32)((S32)time); - F32 min = (time - hour) * 60; - - // handle imprecision - if(min >= 59) { - min = 0; - hour += 1; - } - - hourSpin->set(hour); - minSpin->set(min); - - syncTrack(); - -} - -void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) -{ - // if no keys, skipped - if(sSliderToKey.size() == 0) { - return; - } - - LLMultiSliderCtrl* sldr = sDayCycle->getChild( - "WLDayCycleKeys"); - LLSpinCtrl* hourSpin = sDayCycle->getChild( - "WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild( - "WLCurKeyMin"); - - F32 hour = hourSpin->get(); - F32 min = minSpin->get(); - F32 val = hour + min / 60.0f; - - const std::string& curSldr = sldr->getCurSlider(); - sldr->setCurSliderValue(val, TRUE); - F32 time = sldr->getCurSliderValue() / sHoursPerDay; - - // now set the key's time in the sliderToKey map - sSliderToKey[curSldr].time = time; - - syncTrack(); -} - -void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) -{ - // get the time - LLComboBox* comboBox = sDayCycle->getChild( - "WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild( - "WLDayCycleKeys"); - - // do nothing if no sliders - if(sldr->getValue().size() == 0) { - return; - } - - // change the map - - std::string stringVal = comboBox->getSelectedValue().asString(); - LLWLParamKey newKey(stringVal); - const std::string& curSldr = sldr->getCurSlider(); - - // if null, don't use - if(curSldr == "") { - return; - } - - sSliderToKey[curSldr].keyframe = newKey; - - syncTrack(); -} - -void LLFloaterDayCycle::onAddKey(void* userData) -{ - LLComboBox* comboBox = sDayCycle->getChild( - "WLKeyPresets"); - LLMultiSliderCtrl* kSldr = sDayCycle->getChild( - "WLDayCycleKeys"); - LLMultiSliderCtrl* tSldr = sDayCycle->getChild( - "WLTimeSlider"); - - llassert_always(sSliderToKey.size() == kSldr->getValue().size()); - - S32 max_sliders; - switch(sScope) - { - case LLEnvKey::SCOPE_LOCAL: - max_sliders = 20; // *HACK this should be LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES; - break; - case LLEnvKey::SCOPE_REGION: - max_sliders = 12; // *HACK this should be LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; - break; - default: - max_sliders = (S32)kSldr->getMaxValue(); - break; - } - - if ((S32)sSliderToKey.size() >= max_sliders) - { - LLSD args; - args["SCOPE"] = LLEnvManager::getScopeString(sScope); - args["MAX"] = max_sliders; - LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); - return; - } - - // get the values - LLWLParamKey newKeyframe(comboBox->getSelectedValue()); - - // add the slider key - addSliderKey(tSldr->getCurSliderValue(), newKeyframe); - - syncTrack(); -} - -void LLFloaterDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe) -{ - LLMultiSliderCtrl* kSldr = sDayCycle->getChild( - "WLDayCycleKeys"); - - // make a slider - const std::string& sldrName = kSldr->addSlider(time); - if(sldrName == "") { - return; - } - - // set the key - LLWLCycleSliderKey newKey(keyframe, kSldr->getCurSliderValue()); - - llassert_always(sldrName != LLStringUtil::null); - - // add to map - sSliderToKey.insert(std::pair(sldrName, newKey)); - - llassert_always(sSliderToKey.size() == kSldr->getValue().size()); - -} - -void LLFloaterDayCycle::deletePreset(LLWLParamKey keyframe) -{ - LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); - - /// delete any reference - std::map::iterator curr_preset, next_preset; - for(curr_preset = sSliderToKey.begin(); curr_preset != sSliderToKey.end(); curr_preset = next_preset) - { - next_preset = curr_preset; - ++next_preset; - if (curr_preset->second.keyframe == keyframe) - { - sldr->deleteSlider(curr_preset->first); - sSliderToKey.erase(curr_preset); - } - } -} - -void LLFloaterDayCycle::onDeleteKey(void* userData) -{ - if(sSliderToKey.size() == 0) - { - return; - } - else if(sSliderToKey.size() == 1) - { - LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD(), LLSD()); - return; - } - - LLComboBox* comboBox = sDayCycle->getChild( - "WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); - - // delete from map - const std::string& sldrName = sldr->getCurSlider(); - std::map::iterator mIt = sSliderToKey.find(sldrName); - sSliderToKey.erase(mIt); - - sldr->deleteCurSlider(); - - if(sSliderToKey.size() == 0) { - return; - } - - const std::string& name = sldr->getCurSlider(); - comboBox->selectByValue(sSliderToKey[name].keyframe.toLLSD()); - F32 time = sSliderToKey[name].time; - - LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); - - // now set the spinners - F32 hour = (F32)((S32)time); - F32 min = (time - hour) / 60; - hourSpin->set(hour); - minSpin->set(min); - - syncTrack(); - -} diff --git a/indra/newview/llfloaterdaycycle.h b/indra/newview/llfloaterdaycycle.h deleted file mode 100644 index 1454298269..0000000000 --- a/indra/newview/llfloaterdaycycle.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * @file llfloaterdaycycle.h - * @brief LLFloaterDayCycle class definition - * - * $LicenseInfo:firstyear=2007&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_LLFLOATERDAYCYCLE_H -#define LL_LLFLOATERDAYCYCLE_H - -#include "llfloater.h" - -#include -#include "llwlparamset.h" -#include "llwlanimator.h" -#include "llwlparammanager.h" - -struct WLColorControl; -struct WLFloatControl; - -/// convenience class for holding keyframes mapped to sliders -struct LLWLCycleSliderKey -{ -public: - LLWLCycleSliderKey(LLWLParamKey kf, F32 t) : keyframe(kf), time(t) {} - LLWLCycleSliderKey() : keyframe(), time(0.f) {} // Don't use this default constructor - - LLWLParamKey keyframe; - F32 time; -}; - -/// Menu for all of windlight's functionality. -/// Menuing system for adjusting the atmospheric settings of the world. -class LLFloaterDayCycle : public LLFloater -{ - LOG_CLASS(LLFloaterDayCycle); -public: - LLFloaterDayCycle(const LLSD &key); - virtual ~LLFloaterDayCycle(); - /*virtual*/ BOOL postBuild(); - - // map of sliders to parameters - static std::map sSliderToKey; - - /// help button stuff - static void onClickHelp(void* data); - void initHelpBtn(const std::string& name, const std::string& xml_alert); - - /// initialize all - void initCallbacks(void); - - /// one and one instance only - static LLFloaterDayCycle* instance(); - - /// on time slider moved - static void onTimeSliderMoved(LLUICtrl* ctrl, void* userData); - - /// what happens when you move the key frame - static void onKeyTimeMoved(LLUICtrl* ctrl, void* userData); - - /// what happens when you change the key frame's time - static void onKeyTimeChanged(LLUICtrl* ctrl, void* userData); - - /// if you change the combo box, change the frame - static void onKeyPresetChanged(LLUICtrl* ctrl, void* userData); - - /// add a new key on slider - static void onAddKey(void* userData); - - /// delete any and all reference to a preset - void deletePreset(LLWLParamKey keyframe); - - /// delete a key frame - static void onDeleteKey(void* userData); - - - //// menu management - - /// show off our menu - static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL); - - /// return if the menu exists or not - static bool isOpen(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); - - /// sync up sliders with day cycle structure - static void syncMenu(); - - // makes sure key slider has what's in day cycle - static void syncSliderTrack(); - - /// makes sure day cycle data structure has what's in menu - static void syncTrack(); - - /// refresh combox box from param manager - static void refreshPresetsFromParamManager(); - - /// add a slider to the track - static void addSliderKey(F32 time, LLWLParamKey keyframe); - -private: - static LLFloaterDayCycle* sDayCycle; // one instance on the inside - static const F32 sHoursPerDay; - static LLEnvKey::EScope sScope; - static std::string sOriginalTitle; - static LLWLAnimator::ETime sPreviousTimeType; -}; - - -#endif diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 165b271133..b63677b258 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -423,7 +423,7 @@ void LLFloaterEditDayCycle::onAddKey() if ((S32)mSliderToKey.size() >= max_sliders) { LLSD args; - args["SCOPE"] = LLEnvManager::getScopeString(scope); + args["SCOPE"] = LLEnvManagerNew::getScopeString(scope); args["MAX"] = max_sliders; LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); return; diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp deleted file mode 100644 index bb476e5d00..0000000000 --- a/indra/newview/llfloaterenvsettings.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/** - * @file llfloaterenvsettings.cpp - * @brief LLFloaterEnvSettings class definition - * - * $LicenseInfo:firstyear=2007&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 "llfloaterenvsettings.h" - -#include "llfloaterreg.h" -#include "llfloaterwindlight.h" -#include "llfloaterwater.h" -#include "llfloaterdaycycle.h" -#include "llfloaterregioninfo.h" -#include "lluictrlfactory.h" -#include "llsliderctrl.h" -#include "llcombobox.h" -#include "llcolorswatch.h" -#include "llwlanimator.h" -#include "llnotifications.h" - -#include "llwlparamset.h" -#include "llwlparammanager.h" -#include "llwaterparammanager.h" -#include "llmath.h" -#include "llviewerwindow.h" -#include "llviewercontrol.h" - -#include "llcheckboxctrl.h" - -#include "pipeline.h" - -#include - -// LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL; - -LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD &key) : LLFloater(key) -{ - lldebugs << "Creating env settings floater" << llendl; -} - -LLFloaterEnvSettings::~LLFloaterEnvSettings() -{ -} - -// virtual -BOOL LLFloaterEnvSettings::postBuild() -{ - // load it up - initCallbacks(); - syncMenu(); - - return TRUE; -} - -void LLFloaterEnvSettings::initCallbacks(void) -{ - // our three sliders - childSetCommitCallback("EnvTimeSlider", &LLFloaterEnvSettings::onChangeDayTime, NULL); - childSetCommitCallback("EnvCloudSlider", &LLFloaterEnvSettings::onChangeCloudCoverage, NULL); - childSetCommitCallback("EnvWaterFogSlider", &LLFloaterEnvSettings::onChangeWaterFogDensity, &LLWaterParamManager::instance().mFogDensity); - - // color picker - childSetCommitCallback("EnvWaterColor", &LLFloaterEnvSettings::onChangeWaterColor, &LLWaterParamManager::instance().mFogColor); - - // WL Top - childSetCommitCallback("EnvAdvancedSkyButton", &LLFloaterEnvSettings::onOpenAdvancedSky, NULL); - childSetCommitCallback("EnvAdvancedWaterButton", &LLFloaterEnvSettings::onOpenAdvancedWater, NULL); - childSetCommitCallback("EnvUseEstateTimeButton", &LLFloaterEnvSettings::onUseEstateTime, NULL); - getChild("EnvUseLocalTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseLocalTime)); - - getChild("EnvUseLocalTimeButton")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, &LLEnvManagerNew::instance())); - getChild("EnvUseEstateTimeButton")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, &LLEnvManagerNew::instance())); -} - - -// menu maintenance functions - -void LLFloaterEnvSettings::syncMenu() -{ - LLSliderCtrl* sldr; - sldr = getChild("EnvTimeSlider"); - - // sync the clock - F32 val = (F32)LLWLParamManager::getInstance()->mAnimator.getDayTime(); - std::string timeStr = LLWLAnimator::timeToString(val); - - LLTextBox* textBox; - textBox = getChild("EnvTimeText"); - - textBox->setValue(timeStr); - - // sync time slider which starts at 6 AM - val -= 0.25; - if(val < 0) - { - val++; - } - sldr->setValue(val); - - // sync cloud coverage - bool err; - childSetValue("EnvCloudSlider", LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_shadow", err)); - - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); - // sync water params - LLColor4 col = param_mgr->getFogColor(); - LLColorSwatchCtrl* colCtrl = getChild("EnvWaterColor"); - col.mV[3] = 1.0f; - colCtrl->set(col); - - childSetValue("EnvWaterFogSlider", param_mgr->mFogDensity.mExp); - param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp); - - // turn off Use Estate/Local Time buttons if already being used - - LLWLAnimator& anim = LLWLParamManager::getInstance()->mAnimator; - childSetEnabled("EnvUseEstateTimeButton", !anim.getIsRunning() || !anim.getUseLindenTime()); - childSetEnabled("EnvUseLocalTimeButton", !anim.getIsRunning() || !anim.getUseLocalTime()); - - if(!gPipeline.canUseVertexShaders()) - { - childDisable("EnvWaterColor"); - childDisable("EnvWaterColorText"); - //childDisable("EnvAdvancedWaterButton"); - } - else - { - childEnable("EnvWaterColor"); - childEnable("EnvWaterColorText"); - //childEnable("EnvAdvancedWaterButton"); - } - - // only allow access to these if they are using windlight - if(!gPipeline.canUseWindLightShaders()) - { - - childDisable("EnvCloudSlider"); - childDisable("EnvCloudText"); - //childDisable("EnvAdvancedSkyButton"); - } - else - { - childEnable("EnvCloudSlider"); - childEnable("EnvCloudText"); - //childEnable("EnvAdvancedSkyButton"); - } -} - -void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldr = static_cast(ctrl); - - // deactivate animator - LLWLParamManager::instance().mAnimator.deactivate(); - - F32 val = sldr->getValueF32() + 0.25f; - if(val > 1.0) - { - val--; - } - - LLWLParamManager::instance().mAnimator.setDayTime((F64)val); - LLWLParamManager::instance().mAnimator.update( - LLWLParamManager::instance().mCurParams); -} - -void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldr = static_cast(ctrl); - - // deactivate animator - //LLWLParamManager::instance()->mAnimator.mIsRunning = false; - //LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; - - F32 val = sldr->getValueF32(); - LLWLParamManager::instance().mCurParams.set("cloud_shadow", val); -} - -void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldr = static_cast(ctrl); - F32 val = sldr->getValueF32(); - - WaterExpFloatControl* expFloatControl = static_cast(userData); - expFloatControl->mExp = val; - LLWaterParamManager::instance().setDensitySliderValue(val); - - expFloatControl->update(LLWaterParamManager::instance().mCurParams); - LLWaterParamManager::instance().propagateParameters(); -} - -void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData) -{ - LLColorSwatchCtrl* swatch = static_cast(ctrl); - WaterColorControl* colorControl = static_cast(userData); - *colorControl = swatch->get(); - - colorControl->update(LLWaterParamManager::instance().mCurParams); - LLWaterParamManager::instance().propagateParameters(); -} - -void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData1, void* userData2) -{ - // *TODO: make sure title is displayed correctly. - LLFloaterReg::showInstance("env_windlight"); -} - -void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData1, void* userData2) -{ - // *TODO: make sure title is displayed correctly. - LLFloaterReg::showInstance("env_water"); -} - - -void LLFloaterEnvSettings::onUseEstateTime(void* userData1, void* userData2) -{ - LLFloaterWindLight* wl = LLFloaterReg::findTypedInstance("env_windlight"); - if(wl) - { - LLComboBox* box = wl->getChild("WLPresetsCombo"); - box->selectByValue(""); - } - - LLWLParamManager::instance().mAnimator.activate(LLWLAnimator::TIME_LINDEN); -} - -// static -void LLFloaterEnvSettings::onUseLocalTime() -{ - LLWLParamManager::getInstance()->mAnimator.setDayTime(LLWLAnimator::getLocalTime()); - LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LOCAL); -} diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h deleted file mode 100644 index b93bf07395..0000000000 --- a/indra/newview/llfloaterenvsettings.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @file llfloaterskysettings.h - * @brief LLFloaterEnvSettings class definition - * - * $LicenseInfo:firstyear=2007&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$ - */ - -/* - * Simple menu for adjusting the atmospheric settings of the world - */ - -#ifndef LL_LLFLOATERENVSETTINGS_H -#define LL_LLFLOATERENVSETTINGS_H - -#include "llfloater.h" - - -/// Menuing system for all of windlight's functionality -class LLFloaterEnvSettings : public LLFloater -{ - LOG_CLASS(LLFloaterEnvSettings); -public: - - LLFloaterEnvSettings(const LLSD &key); - /*virtual*/ ~LLFloaterEnvSettings(); - /*virtual*/ BOOL postBuild(); - - /// initialize all the callbacks for the menu - void initCallbacks(void); - - /// one and one instance only - LLFloaterEnvSettings* instance(); - - /// handle if time of day is changed - static void onChangeDayTime(LLUICtrl* ctrl, void* userData); - - /// handle if cloud coverage is changed - static void onChangeCloudCoverage(LLUICtrl* ctrl, void* userData); - - /// handle change in water fog density - static void onChangeWaterFogDensity(LLUICtrl* ctrl, void* expFloatControl); - - /// handle change in water fog color - static void onChangeWaterColor(LLUICtrl* ctrl, void* colorControl); - - /// open the advanced sky settings menu - static void onOpenAdvancedSky(void* userData1, void* userData2); - - /// open the advanced water settings menu - static void onOpenAdvancedWater(void* userData1, void* userData2); - - /// sync time with the server - static void onUseEstateTime(void* userData1, void* userData2); - - /// sync time with local clock - static void onUseLocalTime(); - - - //// menu management - - /// sync up sliders with parameters - void syncMenu(); - -private: - // one instance on the inside - -}; - - -#endif diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index d84f4c26c4..07c0878877 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -55,14 +55,12 @@ #include "lldaycyclemanager.h" #include "llenvmanager.h" #include "llfilepicker.h" -#include "llfloaterdaycycle.h" #include "llfloatergodtools.h" // for send_sim_wide_deletes() #include "llfloatertopobjects.h" // added to fix SL-32336 #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterregiondebugconsole.h" #include "llfloatertelehub.h" -#include "llfloaterwindlight.h" #include "llinventorymodel.h" #include "lllineeditor.h" #include "llnamelistctrl.h" @@ -93,9 +91,6 @@ #include "llagentui.h" #include "llmeshrepository.h" -// contains includes needed for WL estate settings -#include "llfloaterwater.h" - const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; @@ -1151,36 +1146,11 @@ BOOL LLPanelRegionTerrainInfo::validateTextureSizes() // LLPanelRegionTerrainInfo ///////////////////////////////////////////////////////////////////////////// // Initialize statics -LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::sPanelRegionTerrainInfo = NULL; - -// static -LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::instance() -{ - if (!sPanelRegionTerrainInfo) - { - sPanelRegionTerrainInfo = LLFloaterRegionInfo::getPanelRegionTerrain(); - lldebugs << llformat("Instantiating sPanelRegionTerrainInfo: %p", sPanelRegionTerrainInfo) << llendl; - } - return sPanelRegionTerrainInfo; -} - -// static -void LLPanelRegionTerrainInfo::onFloaterClose(bool app_quitting) -{ - if (sPanelRegionTerrainInfo) - { - lldebugs << "Setting LLPanelRegionTerrainInfo to NULL" << llendl; - sPanelRegionTerrainInfo = NULL; - } -} BOOL LLPanelRegionTerrainInfo::postBuild() { LLPanelRegionInfo::postBuild(); - sPanelRegionTerrainInfo = this; // singleton instance pointer - lldebugs << llformat("Setting sPanelRegionTerrainInfo to: %p", sPanelRegionTerrainInfo) << llendl; - initCtrl("water_height_spin"); initCtrl("terrain_raise_spin"); initCtrl("terrain_lower_spin"); @@ -1207,20 +1177,9 @@ BOOL LLPanelRegionTerrainInfo::postBuild() return LLPanelRegionInfo::postBuild(); } -F32 LLPanelRegionTerrainInfo::getSunHour() -{ - if (childIsEnabled("sun_hour_slider")) - { - return (F32)childGetValue("sun_hour_slider").asReal(); - } - return 0.f; -} - // virtual bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { - //LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false); - BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); BOOL owner_or_god_or_manager = owner_or_god @@ -1398,65 +1357,6 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con return false; } -#ifndef TMP_DISABLE_WLES -/////////////////////////////////////////////////////////////// -// Callbacks for Environment tab of Region panel - -void LLPanelRegionTerrainInfo::onOpenAdvancedSky(void* userData) -{ - LLFloaterWindLight::show(LLEnvKey::SCOPE_REGION); -} - -void LLPanelRegionTerrainInfo::onOpenAdvancedWater(void* userData) -{ - LLFloaterWater::show(LLEnvKey::SCOPE_REGION); -} - - -void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) -{ - if(LLFloaterWindLight::isOpen()) - { - // select the blank value in - LLFloaterWindLight* wl = LLFloaterWindLight::instance(); - LLComboBox* box = wl->getChild("WLPresetsCombo"); - box->selectByValue(""); - } - - LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN); -} - -/////////////////////////////////////////////////////// -// Advanced handling for WL region estate integration - -// Handle commit of WL settings to region -void LLPanelRegionTerrainInfo::onCommitRegionWL(void* userData) -{ - LLEnvManager::getInstance()->commitSettings(LLEnvKey::SCOPE_REGION); - LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); -} - -// Handle cancel of WL settings for region -void LLPanelRegionTerrainInfo::onCancelRegionWL(void* userData) -{ - LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); -} - -// Handle reversion of region WL settings to default -void LLPanelRegionTerrainInfo::onSetRegionToDefaultWL(void* userData) -{ - LLEnvManager::instance().resetInternalsToDefault(LLEnvKey::SCOPE_REGION); - LLEnvManager::instance().startEditingScope(LLEnvKey::SCOPE_REGION); -} - -// static -void LLPanelRegionTerrainInfo::onApplyCurrentWL(void* userData) -{ - // Immediately apply current environment settings to region. - LLEnvManager::instance().applyLocalSettingsToRegion(); -} -#endif // TMP_DISABLE_WLES - ///////////////////////////////////////////////////////////////////////////// // LLPanelEstateInfo // @@ -2120,16 +2020,6 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) return rv; } -// virtual -void LLFloaterRegionInfo::onClose(bool app_quitting) -{ - if(!app_quitting) - { - //LLEnvManager::getInstance()->maybeClearEditingScope(true, false); - LLPanelRegionTerrainInfo::onFloaterClose(app_quitting); - } -} - void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) { if (checkRemovalButton(child_ctrl->getName())) diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 810a71f463..4809937324 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -74,8 +74,6 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose(bool app_quitting); - static void processEstateOwnerRequest(LLMessageSystem* msg, void**); // get and process region info if necessary. @@ -227,11 +225,8 @@ public: LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {} ~LLPanelRegionTerrainInfo() {} - static LLPanelRegionTerrainInfo* instance(); virtual BOOL postBuild(); // LLPanel - static void onFloaterClose(bool app_quitting); - F32 getSunHour(); virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator void setEnvControls(bool available); // Whether environment settings are available for this region @@ -239,26 +234,12 @@ public: //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button - static LLPanelRegionTerrainInfo* sPanelRegionTerrainInfo; // static instance pointer for singleton - virtual BOOL sendUpdate(); - void onChangeUseEstateTime(); - void onChangeFixedSun(); - void onChangeSunHour(); - static void onClickDownloadRaw(void*); static void onClickUploadRaw(void*); static void onClickBakeTerrain(void*); bool callbackBakeTerrain(const LLSD& notification, const LLSD& response); - - static void onOpenAdvancedSky(void* userData); // open the advanced sky settings menu - static void onOpenAdvancedWater(void* userData); // open the advanced water settings menu - static void onUseEstateTime(void* userData); // sync time with the server - static void onCommitRegionWL(void* userData); // commit region information to server - static void onCancelRegionWL(void* userData); // cancel changes to region - static void onSetRegionToDefaultWL(void* userData); // revert region WL settings to default - static void onApplyCurrentWL(void* userData); // apply current settings to region }; ///////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp deleted file mode 100644 index 4d647f30f5..0000000000 --- a/indra/newview/llfloaterwater.cpp +++ /dev/null @@ -1,662 +0,0 @@ -/** - * @file llfloaterwater.cpp - * @brief LLFloaterWater class definition - * - * $LicenseInfo:firstyear=2007&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 "llfloaterwater.h" - -#include "pipeline.h" -#include "llsky.h" - -#include "llfloaterreg.h" -#include "llsliderctrl.h" -#include "llspinctrl.h" -#include "llcolorswatch.h" -#include "llcheckboxctrl.h" -#include "lltexturectrl.h" -#include "lluictrlfactory.h" -#include "llviewercamera.h" -#include "llcombobox.h" -#include "lllineeditor.h" -#include "llnotificationsutil.h" -#include "llfloaterdaycycle.h" -#include "llboost.h" -#include "llmultisliderctrl.h" -#include "llnotifications.h" - -#include "v4math.h" -#include "llviewerdisplay.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" -#include "llsavedsettingsglue.h" - -#include "llwaterparamset.h" -#include "llwaterparammanager.h" -#include "llpostprocess.h" - -#undef max - -std::set LLFloaterWater::sDefaultPresets; -LLEnvKey::EScope LLFloaterWater::sScope; -std::string LLFloaterWater::sOriginalTitle; - -LLFloaterWater::LLFloaterWater(const LLSD& key) - : LLFloater(key) -{ -} - -LLFloaterWater::~LLFloaterWater() -{ -} -BOOL LLFloaterWater::postBuild() -{ - sOriginalTitle=getTitle(); - std::string def_water = getString("WLDefaultWaterNames"); - - // no editing or deleting of the blank string - sDefaultPresets.insert(""); - boost_tokenizer tokens(def_water, boost::char_separator(":")); - for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) - { - std::string tok(*token_iter); - sDefaultPresets.insert(tok); - } - - // add the combo boxes - LLComboBox* comboBox = getChild("WaterPresetsCombo"); - - if(comboBox != NULL) { - - LLWaterParamManager::preset_name_list_t presets; - LLWaterParamManager::instance().getPresetNames(presets); - for (LLWaterParamManager::preset_name_list_t::const_iterator it = presets.begin(); it != presets.end(); ++it) - { - comboBox->add(*it); - } - - // set defaults on combo boxes - comboBox->selectByValue(LLEnvManagerNew::instance().getWaterPresetName()); - } - // load it up - initCallbacks(); - syncMenu(); - return TRUE; -} - -// static -void LLFloaterWater::show(LLEnvKey::EScope scope) -{ - LLFloaterWater* water = LLFloaterReg::getTypedInstance("env_water"); - llassert(water); - - if(scope != sScope && ((LLView*)water)->getVisible()) - { - LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); - return; - } - sScope = scope; - std::string scope_str = ""; - switch(sScope) - { - case LLEnvKey::SCOPE_LOCAL: - scope_str = LLTrans::getString("LocalSettings"); - break; - case LLEnvKey::SCOPE_REGION: - scope_str = LLTrans::getString("RegionSettings"); - break; - } - std::string title = sOriginalTitle + " (" + scope_str + ")"; - water->setTitle(title); - water->syncMenu(); - - LLEnvManager::instance().startEditingScope(scope); - - water->openFloater(); - -} - -void LLFloaterWater::initCallbacks(void) { - - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); - - getChild("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterWater::onWaterFogColorMoved, this, _1, ¶m_mgr->mFogColor)); - - // - getChild("WaterGlow")->setCommitCallback(boost::bind(&LLFloaterWater::onColorControlAMoved, this, _1, ¶m_mgr->mFogColor)); - - // fog density - getChild("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterWater::onExpFloatControlMoved, this, _1, ¶m_mgr->mFogDensity)); - getChild("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mUnderWaterFogMod)); - - // blue density - getChild("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlXMoved, this, _1, ¶m_mgr->mNormalScale)); - getChild("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlYMoved, this, _1, ¶m_mgr->mNormalScale)); - getChild("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlZMoved, this, _1, ¶m_mgr->mNormalScale)); - - // fresnel - getChild("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mFresnelScale)); - getChild("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mFresnelOffset)); - - // scale above/below - getChild("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mScaleAbove)); - getChild("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mScaleBelow)); - - // blur mult - getChild("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mBlurMultiplier)); - - // Load/save -// getChild("WaterLoadPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onLoadPreset, this)); - getChild("WaterNewPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onNewPreset, this)); - getChild("WaterSavePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onSavePreset, this)); - getChild("WaterDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onDeletePreset, this)); - - // wave direction - getChild("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, ¶m_mgr->mWave1Dir)); - getChild("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, ¶m_mgr->mWave1Dir)); - getChild("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, ¶m_mgr->mWave2Dir)); - getChild("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, ¶m_mgr->mWave2Dir)); - - getChild("WaterPresetsCombo")->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1)); - - LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); - textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - getChild("WaterNormalMap")->setCommitCallback(boost::bind(&LLFloaterWater::onNormalMapPicked, this, _1)); -} - -bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& response) -{ - std::string text = response["message"].asString(); - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - - if(text == "") - { - return false; - } - - if(option == 0) { - LLComboBox* comboBox = getChild( "WaterPresetsCombo"); - - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); - - // add the current parameters to the list - // see if it's there first - // if not there, add a new one - if (!param_mgr->hasParamSet(text)) - { - param_mgr->addParamSet(text, param_mgr->mCurParams); - comboBox->add(text); - comboBox->sortByName(); - - comboBox->setSelectedByValue(text, true); - - param_mgr->savePreset(text); - - // otherwise, send a message to the user - } - else - { - LLNotificationsUtil::add("ExistsWaterPresetAlert"); - } - } - return false; -} - -void LLFloaterWater::syncMenu() -{ - bool err; - - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); - - LLWaterParamSet & current_params = param_mgr->mCurParams; - - // blue horizon - param_mgr->mFogColor = current_params.getVector4(param_mgr->mFogColor.mName, err); - - LLColor4 col = param_mgr->getFogColor(); - getChild("WaterGlow")->setValue(col.mV[3]); - col.mV[3] = 1.0f; - LLColorSwatchCtrl* colCtrl = getChild("WaterFogColor"); - - colCtrl->set(col); - - // fog and wavelets - param_mgr->mFogDensity.mExp = - log(current_params.getFloat(param_mgr->mFogDensity.mName, err)) / - log(param_mgr->mFogDensity.mBase); - param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp); - getChild("WaterFogDensity")->setValue(param_mgr->mFogDensity.mExp); - - param_mgr->mUnderWaterFogMod.mX = - current_params.getFloat(param_mgr->mUnderWaterFogMod.mName, err); - getChild("WaterUnderWaterFogMod")->setValue(param_mgr->mUnderWaterFogMod.mX); - - param_mgr->mNormalScale = current_params.getVector3(param_mgr->mNormalScale.mName, err); - getChild("WaterNormalScaleX")->setValue(param_mgr->mNormalScale.mX); - getChild("WaterNormalScaleY")->setValue(param_mgr->mNormalScale.mY); - getChild("WaterNormalScaleZ")->setValue(param_mgr->mNormalScale.mZ); - - // Fresnel - param_mgr->mFresnelScale.mX = current_params.getFloat(param_mgr->mFresnelScale.mName, err); - getChild("WaterFresnelScale")->setValue(param_mgr->mFresnelScale.mX); - param_mgr->mFresnelOffset.mX = current_params.getFloat(param_mgr->mFresnelOffset.mName, err); - getChild("WaterFresnelOffset")->setValue(param_mgr->mFresnelOffset.mX); - - // Scale Above/Below - param_mgr->mScaleAbove.mX = current_params.getFloat(param_mgr->mScaleAbove.mName, err); - getChild("WaterScaleAbove")->setValue(param_mgr->mScaleAbove.mX); - param_mgr->mScaleBelow.mX = current_params.getFloat(param_mgr->mScaleBelow.mName, err); - getChild("WaterScaleBelow")->setValue(param_mgr->mScaleBelow.mX); - - // blur mult - param_mgr->mBlurMultiplier.mX = current_params.getFloat(param_mgr->mBlurMultiplier.mName, err); - getChild("WaterBlurMult")->setValue(param_mgr->mBlurMultiplier.mX); - - // wave directions - param_mgr->mWave1Dir = current_params.getVector2(param_mgr->mWave1Dir.mName, err); - getChild("WaterWave1DirX")->setValue(param_mgr->mWave1Dir.mX); - getChild("WaterWave1DirY")->setValue(param_mgr->mWave1Dir.mY); - - param_mgr->mWave2Dir = current_params.getVector2(param_mgr->mWave2Dir.mName, err); - getChild("WaterWave2DirX")->setValue(param_mgr->mWave2Dir.mX); - getChild("WaterWave2DirY")->setValue(param_mgr->mWave2Dir.mY); - - LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); - textCtrl->setImageAssetID(param_mgr->getNormalMapID()); -} - - -// vector control callbacks -void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - vectorControl->mX = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -// vector control callbacks -void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - vectorControl->mY = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -// vector control callbacks -void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - vectorControl->mZ = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - - -// vector control callbacks -void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - vectorControl->mX = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -// vector control callbacks -void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - vectorControl->mY = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -// color control callbacks -void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - colorControl->mR = sldrCtrl->getValueF32(); - - // move i if it's the max - if(colorControl->mR >= colorControl->mG - && colorControl->mR >= colorControl->mB - && colorControl->mHasSliderName) - { - colorControl->mI = colorControl->mR; - std::string name = colorControl->mSliderName; - name.append("I"); - - getChild(name)->setValue(colorControl->mR); - } - - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - colorControl->mG = sldrCtrl->getValueF32(); - - // move i if it's the max - if(colorControl->mG >= colorControl->mR - && colorControl->mG >= colorControl->mB - && colorControl->mHasSliderName) - { - colorControl->mI = colorControl->mG; - std::string name = colorControl->mSliderName; - name.append("I"); - - getChild(name)->setValue(colorControl->mG); - - } - - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - colorControl->mB = sldrCtrl->getValueF32(); - - // move i if it's the max - if(colorControl->mB >= colorControl->mR - && colorControl->mB >= colorControl->mG - && colorControl->mHasSliderName) - { - colorControl->mI = colorControl->mB; - std::string name = colorControl->mSliderName; - name.append("I"); - - getChild(name)->setValue(colorControl->mB); - } - - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - colorControl->mA = sldrCtrl->getValueF32(); - - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - - -void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - colorControl->mI = sldrCtrl->getValueF32(); - - // only for sliders where we pass a name - if(colorControl->mHasSliderName) - { - // set it to the top - F32 maxVal = std::max(std::max(colorControl->mR, colorControl->mG), colorControl->mB); - F32 iVal; - - iVal = colorControl->mI; - - // get the names of the other sliders - std::string rName = colorControl->mSliderName; - rName.append("R"); - std::string gName = colorControl->mSliderName; - gName.append("G"); - std::string bName = colorControl->mSliderName; - bName.append("B"); - - // handle if at 0 - if(iVal == 0) - { - colorControl->mR = 0; - colorControl->mG = 0; - colorControl->mB = 0; - - // if all at the start - // set them all to the intensity - } - else if (maxVal == 0) - { - colorControl->mR = iVal; - colorControl->mG = iVal; - colorControl->mB = iVal; - } - else - { - // add delta amounts to each - F32 delta = (iVal - maxVal) / maxVal; - colorControl->mR *= (1.0f + delta); - colorControl->mG *= (1.0f + delta); - colorControl->mB *= (1.0f + delta); - } - - // set the sliders to the new vals - getChild(rName)->setValue(colorControl->mR); - getChild(gName)->setValue(colorControl->mG); - getChild(bName)->setValue(colorControl->mB); - } - - // now update the current parameters and send them to shaders - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - F32 val = sldrCtrl->getValueF32(); - expFloatControl->mExp = val; - LLWaterParamManager::getInstance()->setDensitySliderValue(val); - - expFloatControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - floatControl->mX = sldrCtrl->getValueF32() / floatControl->mMult; - - floatControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::getInstance()->propagateParameters(); -} -void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) -{ - LLColorSwatchCtrl* swatch = static_cast(ctrl); - *colorControl = swatch->get(); - - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl) -{ - LLTextureCtrl* textCtrl = static_cast(ctrl); - LLUUID textID = textCtrl->getImageAssetID(); - LLWaterParamManager::getInstance()->setNormalMapID(textID); -} - -void LLFloaterWater::onNewPreset() -{ - LLNotificationsUtil::add("NewWaterPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWater::newPromptCallback, this, _1, _2)); -} - -void LLFloaterWater::onSavePreset() -{ - // get the name - LLComboBox* comboBox = getChild("WaterPresetsCombo"); - - // don't save the empty name - if(comboBox->getSelectedItemLabel() == "") - { - return; - } - - LLWaterParamManager::getInstance()->mCurParams.mName = - comboBox->getSelectedItemLabel(); - - // check to see if it's a default and shouldn't be overwritten - std::set::iterator sIt = sDefaultPresets.find( - comboBox->getSelectedItemLabel()); - if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("WaterEditPresets")) - { - LLNotificationsUtil::add("WLNoEditDefault"); - return; - } - - LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWater::saveAlertCallback, this, _1, _2)); -} - -bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - // if they choose save, do it. Otherwise, don't do anything - if(option == 0) - { - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); - - param_mgr->setParamSet( - param_mgr->mCurParams.mName, - param_mgr->mCurParams); - - // comment this back in to save to file - param_mgr->savePreset(param_mgr->mCurParams.mName); - } - return false; -} - -void LLFloaterWater::onDeletePreset() -{ - LLComboBox* combo_box = getChild("WaterPresetsCombo"); - - if(combo_box->getSelectedValue().asString() == "") - { - return; - } - - LLSD args; - args["SKY"] = combo_box->getSelectedValue().asString(); - LLNotificationsUtil::add("WLDeletePresetAlert", args, LLSD(), boost::bind(&LLFloaterWater::deleteAlertCallback, this, _1, _2)); -} - -bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - // if they choose delete, do it. Otherwise, don't do anything - if(option == 0) - { - LLComboBox* combo_box = getChild("WaterPresetsCombo"); - LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance("env_day_cycle"); - LLComboBox* key_combo = NULL; - - if (day_cycle) - { - key_combo = day_cycle->getChild("WaterKeyPresets"); - } - - std::string name = combo_box->getSelectedValue().asString(); - - // check to see if it's a default and shouldn't be deleted - std::set::iterator sIt = sDefaultPresets.find(name); - if(sIt != sDefaultPresets.end()) - { - LLNotificationsUtil::add("WaterNoEditDefault"); - return false; - } - - LLWaterParamManager::getInstance()->removeParamSet(name, true); - - // remove and choose another - S32 new_index = combo_box->getCurrentIndex(); - - combo_box->remove(name); - - if(key_combo != NULL) - { - key_combo->remove(name); - - // water is not part of day cycles, yet - //day_cycle->deletePreset(name); - } - - // pick the previously selected index after delete - if(new_index > 0) - { - new_index--; - } - - if(combo_box->getItemCount() > 0) - { - combo_box->setCurrentByIndex(new_index); - } - } - return false; -} - - -void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl) -{ - std::string data = ctrl->getValue().asString(); - if(!data.empty()) - { -#if 0 - LLWaterParamManager::instance().loadPreset(data); -#else - LLEnvManagerNew::instance().setUseWaterPreset(data); -#endif - syncMenu(); - } -} - diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h deleted file mode 100644 index 25858fba01..0000000000 --- a/indra/newview/llfloaterwater.h +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @file llfloaterwindlight.h - * @brief LLFloaterWater class definition - * - * $LicenseInfo:firstyear=2007&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$ - */ - -/* - * Menu for adjusting the atmospheric settings of the world - */ - -#ifndef LL_LLFLOATER_WATER_H -#define LL_LLFLOATER_WATER_H - -#include "llfloater.h" - -#include "llenvmanager.h" - -struct WaterVector2Control; -struct WaterVector3Control; -struct WaterColorControl; -struct WaterFloatControl; -struct WaterExpFloatControl; - -/// Menuing system for all of windlight's functionality -class LLFloaterWater : public LLFloater -{ -public: - - LLFloaterWater(const LLSD& key); - virtual ~LLFloaterWater(); - /*virtual*/ BOOL postBuild(); - /// initialize all - void initCallbacks(void); - - static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL); - - bool newPromptCallback(const LLSD& notification, const LLSD& response); - - /// general purpose callbacks for dealing with color controllers - void onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); - void onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); - void onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); - void onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); - void onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); - - void onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl); - void onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl); - void onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl); - - void onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl); - void onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl); - - void onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl); - - void onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl); - - void onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); - - /// handle if they choose a new normal map - void onNormalMapPicked(LLUICtrl* ctrl); - - /// when user hits the load preset button - void onNewPreset(); - - /// when user hits the save preset button - void onSavePreset(); - - /// prompts a user when overwriting a preset - bool saveAlertCallback(const LLSD& notification, const LLSD& response); - - /// when user hits the save preset button - void onDeletePreset(); - - /// prompts a user when overwriting a preset - bool deleteAlertCallback(const LLSD& notification, const LLSD& response); - - /// what to do when you change the preset name - void onChangePresetName(LLUICtrl* ctrl); - - /// sync up sliders with parameters - void syncMenu(); - -private: - static std::set sDefaultPresets; - static LLEnvKey::EScope sScope; - static std::string sOriginalTitle; -}; - - -#endif diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp deleted file mode 100644 index 43c61f2994..0000000000 --- a/indra/newview/llfloaterwindlight.cpp +++ /dev/null @@ -1,1003 +0,0 @@ -/** - * @file llfloaterwindlight.cpp - * @brief LLFloaterWindLight class definition - * - * $LicenseInfo:firstyear=2007&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 "llfloaterwindlight.h" - -#include "pipeline.h" -#include "llsky.h" - -#include "llfloaterreg.h" -#include "llsliderctrl.h" -#include "llmultislider.h" -#include "llmultisliderctrl.h" -#include "llspinctrl.h" -#include "llcheckboxctrl.h" -#include "lluictrlfactory.h" -#include "llviewercamera.h" -#include "llcombobox.h" -#include "lllineeditor.h" -#include "llfloaterdaycycle.h" -#include "llboost.h" -#include "llnotifications.h" - -#include "v4math.h" -#include "llviewerdisplay.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" -#include "llsavedsettingsglue.h" - -#include "llwlparamset.h" -#include "llwlparammanager.h" -#include "llpostprocess.h" - -#undef max - -// *TODO: Remove this class in favor of LLFloaterEditSky - -LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; -std::set LLFloaterWindLight::sDefaultPresets; -LLEnvKey::EScope LLFloaterWindLight::sScope; -std::string LLFloaterWindLight::sOriginalTitle; - -static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; - -LLFloaterWindLight::LLFloaterWindLight(const LLSD &key) : LLFloater(key) -{ -} - -BOOL LLFloaterWindLight::postBuild() -{ - sWindLight = this; - sOriginalTitle = getTitle(); - - // add the combo boxes - LLComboBox* comboBox = getChild("WLPresetsCombo"); - - if(comboBox != NULL) { - - LLWLParamManager::preset_key_list_t preset_keys; - LLWLParamManager::instance().getPresetKeys(preset_keys); - for (LLWLParamManager::preset_key_list_t::const_iterator it = preset_keys.begin(); it != preset_keys.end(); ++it) - { - const LLWLParamKey& key = *it; - std::string item_title = key.name; - if (key.scope == LLEnvKey::SCOPE_REGION) - { - item_title += std::string(" (") + LLTrans::getString("Region") + std::string(")"); - } - - comboBox->add(item_title, key.toLLSD()); - } - - // entry for when we're in estate time - comboBox->add(LLStringUtil::null); - - // set defaults on combo boxes - LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); - comboBox->selectByValue(env_mgr.getUseFixedSky() ? env_mgr.getSkyPresetName() : LLStringUtil::null); - } - - // add the list of presets - std::string def_days = getString("WLDefaultSkyNames"); - - // no editing or deleting of the blank string - LLWLParamKey blank("", LLEnvKey::SCOPE_LOCAL); - sDefaultPresets.insert(blank); - boost_tokenizer tokens(def_days, boost::char_separator(":")); - for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) - { - std::string tok(*token_iter); - LLWLParamKey key(tok, LLEnvKey::SCOPE_LOCAL); - sDefaultPresets.insert(key); - } - - // load it up - initCallbacks(); - - return TRUE; -} - -LLFloaterWindLight::~LLFloaterWindLight() -{ -} - -void LLFloaterWindLight::initCallbacks(void) -{ - LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); - - // blue horizon - childSetCommitCallback("WLBlueHorizonR", onColorControlRMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonG", onColorControlGMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonB", onColorControlBMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonI", onColorControlIMoved, ¶m_mgr->mBlueHorizon); - - // haze density, horizon, mult, and altitude - childSetCommitCallback("WLHazeDensity", onColorControlRMoved, ¶m_mgr->mHazeDensity); - childSetCommitCallback("WLHazeHorizon", onColorControlRMoved, ¶m_mgr->mHazeHorizon); - childSetCommitCallback("WLDensityMult", onFloatControlMoved, ¶m_mgr->mDensityMult); - childSetCommitCallback("WLMaxAltitude", onFloatControlMoved, ¶m_mgr->mMaxAlt); - - // blue density - childSetCommitCallback("WLBlueDensityR", onColorControlRMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityG", onColorControlGMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityB", onColorControlBMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityI", onColorControlIMoved, ¶m_mgr->mBlueDensity); - - // Lighting - - // sunlight - childSetCommitCallback("WLSunlightR", onColorControlRMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightG", onColorControlGMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightB", onColorControlBMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightI", onColorControlIMoved, ¶m_mgr->mSunlight); - - // glow - childSetCommitCallback("WLGlowR", onGlowRMoved, ¶m_mgr->mGlow); - childSetCommitCallback("WLGlowB", onGlowBMoved, ¶m_mgr->mGlow); - - // ambient - childSetCommitCallback("WLAmbientR", onColorControlRMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientG", onColorControlGMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientB", onColorControlBMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientI", onColorControlIMoved, ¶m_mgr->mAmbient); - - // time of day - childSetCommitCallback("WLSunAngle", onSunMoved, ¶m_mgr->mLightnorm); - childSetCommitCallback("WLEastAngle", onSunMoved, ¶m_mgr->mLightnorm); - - // Clouds - - // Cloud Color - childSetCommitCallback("WLCloudColorR", onColorControlRMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorG", onColorControlGMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorB", onColorControlBMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorI", onColorControlIMoved, ¶m_mgr->mCloudColor); - - // Cloud - childSetCommitCallback("WLCloudX", onColorControlRMoved, ¶m_mgr->mCloudMain); - childSetCommitCallback("WLCloudY", onColorControlGMoved, ¶m_mgr->mCloudMain); - childSetCommitCallback("WLCloudDensity", onColorControlBMoved, ¶m_mgr->mCloudMain); - - // Cloud Detail - childSetCommitCallback("WLCloudDetailX", onColorControlRMoved, ¶m_mgr->mCloudDetail); - childSetCommitCallback("WLCloudDetailY", onColorControlGMoved, ¶m_mgr->mCloudDetail); - childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, ¶m_mgr->mCloudDetail); - - // Cloud extras - childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, ¶m_mgr->mCloudCoverage); - childSetCommitCallback("WLCloudScale", onFloatControlMoved, ¶m_mgr->mCloudScale); - childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL); - childSetCommitCallback("WLCloudLockY", onCloudScrollYToggled, NULL); - childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL); - childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL); - childSetCommitCallback("WLDistanceMult", onFloatControlMoved, ¶m_mgr->mDistanceMult); - - // WL Top - childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); - // Load/save - LLComboBox* comboBox = getChild("WLPresetsCombo"); - - //childSetAction("WLLoadPreset", onLoadPreset, comboBox); - childSetAction("WLNewPreset", onNewPreset, comboBox); - childSetAction("WLSavePreset", onSavePreset, comboBox); - childSetAction("WLDeletePreset", onDeletePreset, comboBox); - - comboBox->setCommitCallback(boost::bind(&LLFloaterWindLight::onChangePresetName, _1)); - - // Dome - childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); - childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); -} - -bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& response) -{ - llassert(sWindLight); - std::string text = response["message"].asString(); - LLWLParamKey newKey(text, LLEnvKey::SCOPE_LOCAL); - S32 option = LLNotification::getSelectedOption(notification, response); - - if(text == "") - { - return false; - } - - if(option == 0) { - LLComboBox* comboBox = sWindLight->getChild( - "WLPresetsCombo"); - - LLFloaterDayCycle* sDayCycle = NULL; - LLComboBox* keyCombo = NULL; - if(LLFloaterDayCycle::isOpen()) - { - sDayCycle = LLFloaterDayCycle::instance(); - keyCombo = sDayCycle->getChild( - "WLKeyPresets"); - } - - // add the current parameters to the list - // see if it's there first - // if not there, add a new one - if (!LLWLParamManager::instance().hasParamSet(newKey)) - { - LLWLParamManager::getInstance()->addParamSet(newKey, - LLWLParamManager::getInstance()->mCurParams); - comboBox->add(newKey.toString(), newKey.toLLSD()); - comboBox->sortByName(); - - // add a blank to the bottom - comboBox->selectFirstItem(); - if(comboBox->getSimple() == "") - { - comboBox->remove(0); - } - comboBox->add(LLStringUtil::null); - - comboBox->setSelectedByValue(text, true); - if(LLFloaterDayCycle::isOpen()) - { - keyCombo->add(text); - keyCombo->sortByName(); - } - LLWLParamManager::getInstance()->savePreset(newKey); - - // otherwise, send a message to the user - } - else - { - LLNotifications::instance().add("ExistsSkyPresetAlert", LLSD(), LLSD()); - } - } - return false; -} - -void LLFloaterWindLight::syncMenu() -{ - bool err; - - LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); - - LLWLParamSet& currentParams = param_mgr->mCurParams; - //std::map & currentParams = param_mgr->mCurParams.mParamValues; - - // blue horizon - param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); - childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); - childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0); - childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0); - childSetValue("WLBlueHorizonI", - std::max(param_mgr->mBlueHorizon.r / 2.0, - std::max(param_mgr->mBlueHorizon.g / 2.0, - param_mgr->mBlueHorizon.b / 2.0))); - - // haze density, horizon, mult, and altitude - param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.mName, err); - childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r); - param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.mName, err); - childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r); - param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.mName, err); - childSetValue("WLDensityMult", param_mgr->mDensityMult.x * - param_mgr->mDensityMult.mult); - param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.mName, err); - childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x); - - // blue density - param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.mName, err); - childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0); - childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0); - childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0); - childSetValue("WLBlueDensityI", - std::max(param_mgr->mBlueDensity.r / 2.0, - std::max(param_mgr->mBlueDensity.g / 2.0, param_mgr->mBlueDensity.b / 2.0))); - - // Lighting - - // sunlight - param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.mName, err); - childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE); - childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE); - childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE); - childSetValue("WLSunlightI", - std::max(param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE, - std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE))); - - // glow - param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.mName, err); - childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f); - childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f); - - // ambient - param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.mName, err); - childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE); - childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE); - childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE); - childSetValue("WLAmbientI", - std::max(param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE, - std::max(param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE))); - - childSetValue("WLSunAngle", param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI); - childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI); - - // Clouds - - // Cloud Color - param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.mName, err); - childSetValue("WLCloudColorR", param_mgr->mCloudColor.r); - childSetValue("WLCloudColorG", param_mgr->mCloudColor.g); - childSetValue("WLCloudColorB", param_mgr->mCloudColor.b); - childSetValue("WLCloudColorI", - std::max(param_mgr->mCloudColor.r, - std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b))); - - // Cloud - param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.mName, err); - childSetValue("WLCloudX", param_mgr->mCloudMain.r); - childSetValue("WLCloudY", param_mgr->mCloudMain.g); - childSetValue("WLCloudDensity", param_mgr->mCloudMain.b); - - // Cloud Detail - param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.mName, err); - childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r); - childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g); - childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b); - - // Cloud extras - param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.mName, err); - param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.mName, err); - childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x); - childSetValue("WLCloudScale", param_mgr->mCloudScale.x); - - // cloud scrolling - bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX(); - bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY(); - childSetValue("WLCloudLockX", lockX); - childSetValue("WLCloudLockY", lockY); - - // disable if locked, enable if not - if(lockX) - { - childDisable("WLCloudScrollX"); - } else { - childEnable("WLCloudScrollX"); - } - if(lockY) - { - childDisable("WLCloudScrollY"); - } else { - childEnable("WLCloudScrollY"); - } - - // *HACK cloud scrolling is off my an additive of 10 - childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f); - childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f); - - param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.mName, err); - childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x); - - // Tweak extras - - param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.mName, err); - childSetValue("WLGamma", param_mgr->mWLGamma.x); - - childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness()); -} - - -// static -LLFloaterWindLight* LLFloaterWindLight::instance() -{ - if (!sWindLight) - { - lldebugs << "Creating WL floater" << llendl; - sWindLight = LLFloaterReg::getTypedInstance("env_windlight"); - llassert(sWindLight); - } - return sWindLight; -} - -// static -void LLFloaterWindLight::show(LLEnvKey::EScope scope) -{ - LLFloaterWindLight* windLight = instance(); - if(scope != sScope && ((LLView*)windLight)->getVisible()) - { - LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); - return; - } - sScope = scope; - std::string scope_str = ""; - switch(sScope) - { - case LLEnvKey::SCOPE_LOCAL: - scope_str = LLTrans::getString("LocalSettings"); - break; - case LLEnvKey::SCOPE_REGION: - scope_str = LLTrans::getString("RegionSettings"); - break; - } - std::string title = sOriginalTitle + " (" + scope_str + ")"; - windLight->setTitle(title); - windLight->syncMenu(); - - LLEnvManager::instance().startEditingScope(scope); - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); - //windLight->initCallbacks(); - - windLight->openFloater(); -} - -bool LLFloaterWindLight::isOpen() -{ - return LLFloater::isShown(sWindLight); -} - -// virtual -void LLFloaterWindLight::onClose(bool app_quitting) -{ - lldebugs << "Destroying WL floater" << llendl; - sWindLight = NULL; -} - -// color control callbacks -void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData) -{ - llassert(sWindLight); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WLColorControl * colorControl = static_cast(userData); - - colorControl->r = sldrCtrl->getValueF32(); - if(colorControl->isSunOrAmbientColor) { - colorControl->r *= 3; - } - if(colorControl->isBlueHorizonOrDensity) { - colorControl->r *= 2; - } - - // move i if it's the max - if(colorControl->r >= colorControl->g && colorControl->r >= colorControl->b - && colorControl->hasSliderName) { - colorControl->i = colorControl->r; - std::string name = colorControl->mSliderName; - name.append("I"); - - if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, colorControl->r / 3); - } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, colorControl->r / 2); - } else { - sWindLight->childSetValue(name, colorControl->r); - } - } - - colorControl->update(LLWLParamManager::getInstance()->mCurParams); - - LLWLParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData) -{ - llassert(sWindLight); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WLColorControl * colorControl = static_cast(userData); - - colorControl->g = sldrCtrl->getValueF32(); - if(colorControl->isSunOrAmbientColor) { - colorControl->g *= 3; - } - if(colorControl->isBlueHorizonOrDensity) { - colorControl->g *= 2; - } - - // move i if it's the max - if(colorControl->g >= colorControl->r && colorControl->g >= colorControl->b - && colorControl->hasSliderName) { - colorControl->i = colorControl->g; - std::string name = colorControl->mSliderName; - name.append("I"); - - if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, colorControl->g / 3); - } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, colorControl->g / 2); - } else { - sWindLight->childSetValue(name, colorControl->g); - } - } - - colorControl->update(LLWLParamManager::getInstance()->mCurParams); - - LLWLParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WLColorControl * colorControl = static_cast(userData); - - colorControl->b = sldrCtrl->getValueF32(); - if(colorControl->isSunOrAmbientColor) { - colorControl->b *= 3; - } - if(colorControl->isBlueHorizonOrDensity) { - colorControl->b *= 2; - } - - // move i if it's the max - if(colorControl->b >= colorControl->r && colorControl->b >= colorControl->g - && colorControl->hasSliderName) { - colorControl->i = colorControl->b; - std::string name = colorControl->mSliderName; - name.append("I"); - - if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, colorControl->b / 3); - } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, colorControl->b / 2); - } else { - sWindLight->childSetValue(name, colorControl->b); - } - } - - colorControl->update(LLWLParamManager::getInstance()->mCurParams); - - LLWLParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) -{ - llassert(sWindLight); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WLColorControl * colorControl = static_cast(userData); - - colorControl->i = sldrCtrl->getValueF32(); - - // only for sliders where we pass a name - if(colorControl->hasSliderName) { - - // set it to the top - F32 maxVal = std::max(std::max(colorControl->r, colorControl->g), colorControl->b); - F32 iVal; - - if(colorControl->isSunOrAmbientColor) - { - iVal = colorControl->i * 3; - } - else if(colorControl->isBlueHorizonOrDensity) - { - iVal = colorControl->i * 2; - } - else - { - iVal = colorControl->i; - } - - // get the names of the other sliders - std::string rName = colorControl->mSliderName; - rName.append("R"); - std::string gName = colorControl->mSliderName; - gName.append("G"); - std::string bName = colorControl->mSliderName; - bName.append("B"); - - // handle if at 0 - if(iVal == 0) { - colorControl->r = 0; - colorControl->g = 0; - colorControl->b = 0; - - // if all at the start - // set them all to the intensity - } else if (maxVal == 0) { - colorControl->r = iVal; - colorControl->g = iVal; - colorControl->b = iVal; - - } else { - - // add delta amounts to each - F32 delta = (iVal - maxVal) / maxVal; - colorControl->r *= (1.0f + delta); - colorControl->g *= (1.0f + delta); - colorControl->b *= (1.0f + delta); - } - - // divide sun color vals by three - if(colorControl->isSunOrAmbientColor) - { - sWindLight->childSetValue(rName, colorControl->r/3); - sWindLight->childSetValue(gName, colorControl->g/3); - sWindLight->childSetValue(bName, colorControl->b/3); - - } - else if(colorControl->isBlueHorizonOrDensity) - { - sWindLight->childSetValue(rName, colorControl->r/2); - sWindLight->childSetValue(gName, colorControl->g/2); - sWindLight->childSetValue(bName, colorControl->b/2); - - } - else - { - // set the sliders to the new vals - sWindLight->childSetValue(rName, colorControl->r); - sWindLight->childSetValue(gName, colorControl->g); - sWindLight->childSetValue(bName, colorControl->b); - } - } - - // now update the current parameters and send them to shaders - colorControl->update(LLWLParamManager::getInstance()->mCurParams); - LLWLParamManager::getInstance()->propagateParameters(); -} - -/// GLOW SPECIFIC CODE -void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WLColorControl * colorControl = static_cast(userData); - - // scaled by 20 - colorControl->r = (2 - sldrCtrl->getValueF32()) * 20; - - colorControl->update(LLWLParamManager::getInstance()->mCurParams); - LLWLParamManager::getInstance()->propagateParameters(); -} - -/// \NOTE that we want NEGATIVE (-) B -void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WLColorControl * colorControl = static_cast(userData); - - /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big - colorControl->b = -sldrCtrl->getValueF32() * 5; - - colorControl->update(LLWLParamManager::getInstance()->mCurParams); - LLWLParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WLFloatControl * floatControl = static_cast(userData); - - floatControl->x = sldrCtrl->getValueF32() / floatControl->mult; - - floatControl->update(LLWLParamManager::getInstance()->mCurParams); - LLWLParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); - - bool value = cbCtrl->get(); - (*(static_cast(userData))) = value; -} - - -// Lighting callbacks - -// time of day -void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) -{ - llassert(sWindLight); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sunSldr = sWindLight->getChild("WLSunAngle"); - LLSliderCtrl* eastSldr = sWindLight->getChild("WLEastAngle"); - - WLColorControl * colorControl = static_cast(userData); - - // get the two angles - LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); - - param_mgr->mCurParams.setSunAngle(F_TWO_PI * sunSldr->getValueF32()); - param_mgr->mCurParams.setEastAngle(F_TWO_PI * eastSldr->getValueF32()); - - // set the sun vector - colorControl->r = -sin(param_mgr->mCurParams.getEastAngle()) * - cos(param_mgr->mCurParams.getSunAngle()); - colorControl->g = sin(param_mgr->mCurParams.getSunAngle()); - colorControl->b = cos(param_mgr->mCurParams.getEastAngle()) * - cos(param_mgr->mCurParams.getSunAngle()); - colorControl->i = 1.f; - - colorControl->update(param_mgr->mCurParams); - param_mgr->propagateParameters(); -} - -void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - F32 * tweak = static_cast(userData); - - (*tweak) = sldrCtrl->getValueF32(); - LLWLParamManager::getInstance()->propagateParameters(); -} - -void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32()); -} - -void LLFloaterWindLight::onNewPreset(void* userData) -{ - LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback); -} - -void LLFloaterWindLight::onSavePreset(void* userData) -{ - llassert(sWindLight); - // get the name - LLComboBox* comboBox = sWindLight->getChild( - "WLPresetsCombo"); - - // don't save the empty name - if(comboBox->getSelectedItemLabel() == "") - { - return; - } - - // If region scope, save immediately. - // We don't actually save to file in this case, but just update the preset - // so that the changes can be uploaded to server. - LLWLParamKey key(comboBox->getSelectedValue()); - if (key.scope == LLEnvKey::SCOPE_REGION) - { - // *TODO: Eliminate code duplication. - LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << llendl; - LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); - param_mgr->mCurParams.mName = key.name; - param_mgr->setParamSet(key, param_mgr->mCurParams); - return; - } - - // check to see if it's a default and shouldn't be overwritten - std::set::iterator sIt = sDefaultPresets.find(LLWLParamKey(key)); - if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) - { - LLNotifications::instance().add("WLNoEditDefault", LLSD(), LLSD()); - return; - } - - LLWLParamManager::getInstance()->mCurParams.mName = - comboBox->getSelectedItemLabel(); - - LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); -} - -bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - // if they choose save, do it. Otherwise, don't do anything - if(option == 0) - { - LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); - - // we should only "save" local presets; those with other scopes should be "save as" - LLWLParamKey key(param_mgr->mCurParams.mName, LLEnvKey::SCOPE_LOCAL); - - param_mgr->setParamSet(key, param_mgr->mCurParams); - - // comment this back in to save to file - param_mgr->savePreset(key); - } - return false; -} - -void LLFloaterWindLight::onDeletePreset(void* userData) -{ - llassert(sWindLight); - LLComboBox* combo_box = sWindLight->getChild( - "WLPresetsCombo"); - - if(combo_box->getSelectedValue().isUndefined()) - { - return; - } - - LLSD args; - args["SKY"] = combo_box->getSelectedValue()[0].asString(); - LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), - boost::bind(&LLFloaterWindLight::deleteAlertCallback, sWindLight, _1, _2)); -} - -bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - // if they choose delete, do it. Otherwise, don't do anything - if(option == 0) - { - LLComboBox* combo_box = getChild( - "WLPresetsCombo"); - LLFloaterDayCycle* day_cycle = NULL; - LLComboBox* key_combo = NULL; - LLMultiSliderCtrl* mult_sldr = NULL; - - if(LLFloaterDayCycle::isOpen()) - { - day_cycle = LLFloaterDayCycle::instance(); - key_combo = day_cycle->getChild( - "WLKeyPresets"); - mult_sldr = day_cycle->getChild("WLDayCycleKeys"); - } - - LLWLParamKey key(combo_box->getSelectedValue()); - - // check to see if it's a default and shouldn't be deleted - std::set::iterator sIt = sDefaultPresets.find(key); - if(sIt != sDefaultPresets.end()) - { - LLNotifications::instance().add("WLNoEditDefault", LLSD(), LLSD()); - return false; - } - - LLWLParamManager::getInstance()->removeParamSet(key, true); - - // remove and choose another - S32 new_index = combo_box->getCurrentIndex(); - - combo_box->remove(key.toString()); - if(key_combo != NULL) - { - key_combo->remove(key.toString()); - - // remove from slider, as well - day_cycle->deletePreset(key); - } - - // pick the previously selected index after delete - if(new_index > 0) - { - new_index--; - } - - if(combo_box->getItemCount() > 0) - { - combo_box->setCurrentByIndex(new_index); - } - } - return false; -} - - -void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) -{ - llassert(sWindLight); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLComboBox * combo_box = static_cast(ctrl); - - if(combo_box->getSimple() == "") - { - return; - } - -#if 0 - LLWLParamManager::getInstance()->loadPreset(LLWLParamKey(combo_box->getSelectedValue())); -#else - LLEnvManagerNew::instance().setUseSkyPreset(LLWLParamKey(combo_box->getSelectedValue()).name); -#endif - sWindLight->syncMenu(); -} - -void LLFloaterWindLight::onOpenDayCycle(void* userData) -{ - LLFloaterDayCycle::show(sScope); -} - -// Clouds -void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - // *HACK all cloud scrolling is off by an additive of 10. - LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f); -} - -void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - // *HACK all cloud scrolling is off by an additive of 10. - LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldrCtrl->getValueF32() + 10.0f); -} - -void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData) -{ - llassert(sWindLight); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); - - bool lock = cbCtrl->get(); - LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock); - - LLSliderCtrl* sldr = sWindLight->getChild( - "WLCloudScrollX"); - - if(cbCtrl->get()) - { - sldr->setEnabled(false); - } - else - { - sldr->setEnabled(true); - } - -} - -void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData) -{ - llassert(sWindLight); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); - bool lock = cbCtrl->get(); - LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock); - - LLSliderCtrl* sldr = sWindLight->getChild( - "WLCloudScrollY"); - - if(cbCtrl->get()) - { - sldr->setEnabled(false); - } - else - { - sldr->setEnabled(true); - } -} diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h deleted file mode 100644 index c2607816e5..0000000000 --- a/indra/newview/llfloaterwindlight.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * @file llfloaterwindlight.h - * @brief LLFloaterWindLight class definition - * - * $LicenseInfo:firstyear=2007&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$ - */ - -/* - * Menu for adjusting the atmospheric settings of the world - */ - -#ifndef LL_LLFLOATERWINDLIGHT_H -#define LL_LLFLOATERWINDLIGHT_H - -#include "llfloater.h" - -#include -#include "llwlparamset.h" -#include "llwlparammanager.h" - -struct WLColorControl; -struct WLFloatControl; - -/// Menuing system for all of windlight's functionality -class LLFloaterWindLight : public LLFloater -{ - LOG_CLASS(LLFloaterWindLight); -public: - LLFloaterWindLight(const LLSD &key); - virtual ~LLFloaterWindLight(); - BOOL postBuild(); - - /// initialize all - void initCallbacks(void); - - /// one and one instance only - static LLFloaterWindLight* instance(); - - static bool newPromptCallback(const LLSD& notification, const LLSD& response); - - /// general purpose callbacks for dealing with color controllers - static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); - static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); - static void onBoolToggle(LLUICtrl* ctrl, void* userData); - - /// lighting callbacks for glow - static void onGlowRMoved(LLUICtrl* ctrl, void* userData); - //static void onGlowGMoved(LLUICtrl* ctrl, void* userData); - static void onGlowBMoved(LLUICtrl* ctrl, void* userData); - - /// lighting callbacks for sun - static void onSunMoved(LLUICtrl* ctrl, void* userData); - - /// handle if float is changed - static void onFloatTweakMoved(LLUICtrl* ctrl, void* userData); - - /// for handling when the star slider is moved to adjust the alpha - static void onStarAlphaMoved(LLUICtrl* ctrl, void* userData); - - /// when user hits the load preset button - static void onNewPreset(void* userData); - - /// when user hits the save preset button - static void onSavePreset(void* userData); - - /// prompts a user when overwriting a preset - static bool saveAlertCallback(const LLSD& notification, const LLSD& response); - - /// when user hits the save preset button - static void onDeletePreset(void* userData); - - /// prompts a user when overwriting a preset - bool deleteAlertCallback(const LLSD& notification, const LLSD& response); - - /// what to do when you change the preset name - static void onChangePresetName(LLUICtrl* ctrl); - - /// when user hits the save preset button - static void onOpenDayCycle(void* userData); - - /// handle cloud scrolling - static void onCloudScrollXMoved(LLUICtrl* ctrl, void* userData); - static void onCloudScrollYMoved(LLUICtrl* ctrl, void* userData); - static void onCloudScrollXToggled(LLUICtrl* ctrl, void* userData); - static void onCloudScrollYToggled(LLUICtrl* ctrl, void* userData); - - //// menu management - - /// show off our menu - static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL); - - /// return if the menu exists or not - static bool isOpen(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); - - /// sync up sliders with parameters - void syncMenu(); - -private: - static LLFloaterWindLight* sWindLight; // one instance on the inside - static std::set sDefaultPresets; - static LLEnvKey::EScope sScope; - static std::string sOriginalTitle; -}; - - -#endif diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 670b35aa71..6ae8e79be4 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -48,7 +48,6 @@ #include "llfloaterbulkpermission.h" #include "llfloaterbump.h" #include "llfloatercamera.h" -#include "llfloaterdaycycle.h" #include "llfloaterdeleteenvpreset.h" #include "llfloaterdisplayname.h" #include "llfloatereditdaycycle.h" @@ -57,7 +56,6 @@ #include "llfloaterenvironmentsettings.h" #include "llfloaterevent.h" #include "llfloatersearch.h" -#include "llfloaterenvsettings.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" #include "llfloatergodtools.h" @@ -106,9 +104,7 @@ #include "llfloatertopobjects.h" #include "llfloateruipreview.h" #include "llfloatervoiceeffect.h" -#include "llfloaterwater.h" #include "llfloaterwhitelistentry.h" -#include "llfloaterwindlight.h" #include "llfloaterwindowsize.h" #include "llfloaterworldmap.h" #include "llimfloatercontainer.h" @@ -184,12 +180,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_day_cycle", "floater_day_cycle_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("old_env_settings", "floater_env_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_settings", "floater_environment_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_water", "floater_water.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("env_windlight", "floater_windlight_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_delete_preset", "floater_delete_env_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_edit_sky", "floater_edit_sky_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("env_edit_water", "floater_edit_water_preset.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e8c91cd0f0..55eea8fc69 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7583,16 +7583,7 @@ class LLWorldEnvSettings : public view_listener_t bool handleEvent(const LLSD& userdata) { std::string tod = userdata.asString(); - LLVector3 sun_direction; - if (tod == "old_editor") - { - // if not there or is hidden, show it - // *TODO replace with LLFloaterWindLight::show(LLEnvKey::SCOPE_LOCAL) to make sure we're using the right scope? - LLFloaterReg::toggleInstance("old_env_settings"); - return true; - } - if (tod == "editor") { LLFloaterReg::toggleInstance("env_settings"); @@ -7685,16 +7676,6 @@ class LLWorldPostProcess : public view_listener_t } }; -/// Day Cycle callbacks -class LLWorldDayCycle : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - LLFloaterReg::showInstance("env_day_cycle"); - return true; - } -}; - class LLWorldToggleMovementControls : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -7925,7 +7906,6 @@ void initialize_menus() view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings"); view_listener_t::addMenu(new LLWorldEnvPreset(), "World.EnvPreset"); view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess"); - view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle"); view_listener_t::addMenu(new LLWorldToggleMovementControls(), "World.Toggle.MovementControls"); view_listener_t::addMenu(new LLWorldToggleCameraControls(), "World.Toggle.CameraControls"); diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 475f57cdd4..1a98d4c6c2 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -54,7 +54,6 @@ #include "llwlparammanager.h" #include "llwaterparamset.h" -#include "llfloaterwater.h" #include "curl/curl.h" @@ -225,13 +224,6 @@ void LLWaterParamManager::update(LLViewerCamera * cam) // update the shaders and the menu propagateParameters(); - // sync menus if they exist - LLFloaterWater* waterfloater = LLFloaterReg::findTypedInstance("env_water"); - if(waterfloater) - { - waterfloater->syncMenu(); - } - // only do this if we're dealing with shaders if(gPipeline.canUseVertexShaders()) { diff --git a/indra/newview/llwaterparamset.cpp b/indra/newview/llwaterparamset.cpp index 488b189e94..39d366b023 100644 --- a/indra/newview/llwaterparamset.cpp +++ b/indra/newview/llwaterparamset.cpp @@ -29,7 +29,6 @@ #include "llwaterparamset.h" #include "llsd.h" -#include "llfloaterwater.h" #include "llwaterparammanager.h" #include "lluictrlfactory.h" #include "llsliderctrl.h" diff --git a/indra/newview/llwaterparamset.h b/indra/newview/llwaterparamset.h index 9957d5371b..b28585af59 100644 --- a/indra/newview/llwaterparamset.h +++ b/indra/newview/llwaterparamset.h @@ -34,7 +34,6 @@ #include "v4color.h" #include "llviewershadermgr.h" -class LLFloaterWater; class LLWaterParamSet; /// A class representing a set of parameter values for the Water shaders. diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index e646b605a9..4c0cb7c0f4 100644 --- a/indra/newview/llwldaycycle.cpp +++ b/indra/newview/llwldaycycle.cpp @@ -29,7 +29,6 @@ #include "llwldaycycle.h" #include "llsdserialize.h" #include "llwlparammanager.h" -#include "llfloaterdaycycle.h" #include "llnotifications.h" #include "llviewerwindow.h" diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h index b5eb62b0b0..213bc7c7ce 100644 --- a/indra/newview/llwlhandlers.h +++ b/indra/newview/llwlhandlers.h @@ -36,8 +36,6 @@ #include "llviewerprecompiledheaders.h" #include "llhttpclient.h" -class LLEnvManager; - class LLEnvironmentRequest { LOG_CLASS(LLEnvironmentRequest); @@ -59,7 +57,6 @@ public: private: friend class LLEnvironmentRequest; - friend class LLEnvManager; LLEnvironmentRequestResponder(); static int sCount; diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index f475b3da01..55608a059f 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -55,9 +55,6 @@ #include "llwlparamset.h" #include "llpostprocess.h" -#include "llfloaterwindlight.h" -#include "llfloaterdaycycle.h" -#include "llfloaterenvsettings.h" #include "llviewershadermgr.h" #include "llglslshader.h" @@ -457,23 +454,6 @@ void LLWLParamManager::update(LLViewerCamera * cam) // update the shaders and the menu propagateParameters(); - // sync menus if they exist - LLFloaterWindLight* wlfloater = LLFloaterReg::findTypedInstance("env_windlight"); - if (wlfloater) - { - wlfloater->syncMenu(); - } - LLFloaterDayCycle* dlfloater = LLFloaterReg::findTypedInstance("env_day_cycle"); - if (dlfloater) - { - dlfloater->syncMenu(); - } - LLFloaterEnvSettings* envfloater = LLFloaterReg::findTypedInstance("old_env_settings"); - if (envfloater) - { - envfloater->syncMenu(); - } - F32 camYaw = cam->getYaw(); stop_glerror(); diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index a027d635e6..02d914a812 100644 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -29,7 +29,6 @@ #include "llwlparamset.h" #include "llwlanimator.h" -#include "llfloaterwindlight.h" #include "llwlparammanager.h" #include "llglslshader.h" #include "lluictrlfactory.h" diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h index 1358502032..3c44ed3bb8 100644 --- a/indra/newview/llwlparamset.h +++ b/indra/newview/llwlparamset.h @@ -33,7 +33,6 @@ #include "v4math.h" #include "v4color.h" -class LLFloaterWindLight; class LLWLParamSet; class LLGLSLShader; diff --git a/indra/newview/skins/default/xui/da/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/da/floater_day_cycle_options.xml deleted file mode 100644 index ffae3d788f..0000000000 --- a/indra/newview/skins/default/xui/da/floater_day_cycle_options.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - -