From e045d212d35354d679c2d2e05c6d4689f9f8ac95 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 27 Sep 2010 22:56:08 -0400 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: first pass at merging in windlight estate settings to viewer-dev codebase. not built, not tested. Probably needs a bunch of fixes to be able to be integrated. (resubmitted by Vadim ProductEngine) --- indra/newview/app_settings/settings.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 742a20a849..d21e978ca5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11046,6 +11046,17 @@ Value 1 + UseEnvironmentFromRegion + + Comment + Choose whether to use the region's environment settings, or override them with the local settings. + Persist + 1 + Type + Boolean + Value + 0 + UseExternalBrowser Comment -- cgit v1.3 From fa87eaa1b0fef33ace91862bef0ae722cab124e8 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 18 Apr 2011 22:10:39 +0300 Subject: STORM-1170 FIX Enabled using region environment settings by default. --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 90967f3af8..ccaaf8d9c4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11342,7 +11342,7 @@ Type Boolean Value - 0 + 1 UseExternalBrowser -- cgit v1.3 From 81676d4753a1abe347a69a95f234a005aad0659f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 18 Apr 2011 15:58:03 -0400 Subject: storm-160: revert latest fixes to prevent conflicts with windlight --- indra/newview/app_settings/settings.xml | 27 --------------------------- indra/newview/llwaterparammanager.cpp | 33 --------------------------------- indra/newview/llwaterparammanager.h | 6 ------ 3 files changed, 66 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d98f0da1c2..d412b82e95 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11926,33 +11926,6 @@ Value 0 - WaterFogColor - - Comment - Water fog color - Persist - 1 - Type - Color4 - Value - - 0.0863 - 0.168 - 0.212 - 0 - - - WaterFogDensity - - Comment - Water fog density - Persist - 1 - Type - F32 - Value - 16.0 - WaterGLFogDensityScale Comment diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 4b3a9a4dc3..d239347810 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -72,8 +72,6 @@ LLWaterParamManager::LLWaterParamManager() : mWave1Dir(.5f, .5f, "wave1Dir"), mWave2Dir(.5f, .5f, "wave2Dir"), mDensitySliderValue(1.0f), - mPrevFogDensity(16.0f), // 2^4 - mPrevFogColor(22.f/255.f, 43.f/255.f, 54.f/255.f, 0.0f), mWaterFogKS(1.0f) { } @@ -267,20 +265,6 @@ void LLWaterParamManager::update(LLViewerCamera * cam) // update the shaders and the menu propagateParameters(); - // If water fog color has been changed, save it. - if (mPrevFogColor != mFogColor) - { - gSavedSettings.setColor4("WaterFogColor", mFogColor); - mPrevFogColor = mFogColor; - } - - // If water fog density has been changed, save it. - if (mPrevFogDensity != mFogDensity) - { - gSavedSettings.setF32("WaterFogDensity", mFogDensity); - mPrevFogDensity = mFogDensity; - } - // sync menus if they exist LLFloaterWater* waterfloater = LLFloaterReg::findTypedInstance("env_water"); if(waterfloater) @@ -465,24 +449,7 @@ LLWaterParamManager * LLWaterParamManager::instance() sInstance->loadAllPresets(LLStringUtil::null); sInstance->getParamSet("Default", sInstance->mCurParams); - sInstance->initOverrides(); } return sInstance; } - -void LLWaterParamManager::initOverrides() -{ - // Override fog color from the current preset with the saved setting. - LLColor4 fog_color_override = gSavedSettings.getColor4("WaterFogColor"); - mFogColor = fog_color_override; - mPrevFogColor = fog_color_override; - mCurParams.set("waterFogColor", fog_color_override); - - // Do the same with fog density. - F32 fog_density = gSavedSettings.getF32("WaterFogDensity"); - mPrevFogDensity = fog_density; - mFogDensity = fog_density; - mCurParams.set("waterFogDensity", fog_density); - setDensitySliderValue(mFogDensity.mExp); -} diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h index f465034c39..c479f1861c 100644 --- a/indra/newview/llwaterparammanager.h +++ b/indra/newview/llwaterparammanager.h @@ -284,9 +284,6 @@ public: // singleton pattern implementation static LLWaterParamManager * instance(); -private: - void initOverrides(); - public: LLWaterParamSet mCurParams; @@ -317,9 +314,6 @@ private: LLVector4 mWaterPlane; F32 mWaterFogKS; - LLColor4 mPrevFogColor; - F32 mPrevFogDensity; - // our parameter manager singleton instance static LLWaterParamManager * sInstance; }; -- cgit v1.3 From cccca566bd2365c88cca819729c5432af9dfa52f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 16 May 2011 17:17:01 +0300 Subject: STORM-1245 WIP Reimplementing management of local presets according to the new spec. User environment preferences are now persistent. TODO: Implement applying region env. settings. --- indra/newview/app_settings/settings.xml | 44 ++++ indra/newview/llagent.cpp | 16 ++ indra/newview/llenvmanager.cpp | 231 +++++++++++++++++++++ indra/newview/llenvmanager.h | 82 ++++++++ indra/newview/llfloaterwater.cpp | 6 +- indra/newview/llfloaterwindlight.cpp | 7 +- indra/newview/llviewermenu.cpp | 38 +--- indra/newview/llwaterparammanager.cpp | 10 +- indra/newview/llwaterparammanager.h | 3 + indra/newview/llwlhandlers.cpp | 8 + indra/newview/llwlparammanager.cpp | 52 ++++- indra/newview/llwlparammanager.h | 3 + indra/newview/skins/default/xui/en/menu_viewer.xml | 3 +- .../newview/skins/default/xui/en/notifications.xml | 11 - 14 files changed, 462 insertions(+), 52 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3c02cd1b8c..29476b5e71 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11333,6 +11333,50 @@ Value 1 + UseDayCycle + + Comment + Whether to use use a day cycle or a fixed sky. + Persist + 1 + Type + Boolean + Value + 1 + + WaterPresetName + + Comment + Water preset to use. May be superseded by region settings. + Persist + 1 + Type + String + Value + Default + + SkyPresetName + + Comment + Sky preset to use. May be superseded by region settings or by a day cycle (see DayCycleName). + Persist + 1 + Type + String + Value + Default + + DayCycleName + + Comment + Day cycle to use. May be superseded by region settings. + Persist + 1 + Type + String + Value + Default + UseExternalBrowser Comment diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index cb3c5319c9..38e6caa4b3 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -637,11 +637,19 @@ void LLAgent::setRegion(LLViewerRegion *regionp) bool teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE); if (teleport) { +#if 0 LLEnvManager::getInstance()->notifyTP(); +#else + LLEnvManagerNew::instance().onTeleport(); +#endif } else { +#if 0 LLEnvManager::getInstance()->notifyCrossing(); +#else + LLEnvManagerNew::instance().onRegionCrossing(); +#endif } } else @@ -661,7 +669,11 @@ void LLAgent::setRegion(LLViewerRegion *regionp) LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal); // Notify windlight managers about login +#if 0 LLEnvManager::getInstance()->notifyLogin(); +#else + LLEnvManagerNew::instance().onLogin(); +#endif } // Pass new region along to metrics components that care about this level of detail. @@ -687,8 +699,12 @@ void LLAgent::setRegion(LLViewerRegion *regionp) LLFloaterMove::sUpdateFlyingStatus(); +#if 0 // notify EnvManager that a refresh is needed LLEnvManager::instance().refreshFromStorage(LLEnvKey::SCOPE_REGION); +#else + LLEnvManagerNew::instance().onTeleport(); +#endif } diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index c855d8597c..49bbf1a77c 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -52,6 +52,8 @@ 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; @@ -557,3 +559,232 @@ void LLEnvManager::dumpScopes() scope_dump = makePacket(LLEnvKey::SCOPE_REGION, LLSD()); LL_DEBUGS("Windlight") << "Region scope:" << scope_dump << LL_ENDL; } + + +//============================================================================= + +std::string LLEnvPrefs::getWaterPresetName() const +{ + if (mWaterPresetName.empty()) + { + llwarns << "Water preset name is empty" << llendl; + } + + return mWaterPresetName; +} + +std::string LLEnvPrefs::getSkyPresetName() const +{ + if (mSkyPresetName.empty()) + { + llwarns << "Sky preset name is empty" << llendl; + } + + return mSkyPresetName; +} + +std::string LLEnvPrefs::getDayCycleName() const +{ + if (mDayCycleName.empty()) + { + llwarns << "Day cycle name is empty" << llendl; + } + + return mDayCycleName; +} + +void LLEnvPrefs::setUseDefaults(bool val) +{ + mUseDefaults = val; +} + +void LLEnvPrefs::setUseWaterPreset(const std::string& name) +{ + setUseDefaults(false); + mWaterPresetName = name; +} + +void LLEnvPrefs::setUseSkyPreset(const std::string& name) +{ + setUseDefaults(false); + mUseDayCycle = false; + mSkyPresetName = name; +} + +void LLEnvPrefs::setUseDayCycle(const std::string& name) +{ + setUseDefaults(false); + mUseDayCycle = true; + mDayCycleName = name; +} + +//============================================================================= +LLEnvManagerNew::LLEnvManagerNew() +{ + mInterpNextChangeMessage = true; + + // Set default environment settings. + mUserPrefs.mUseDefaults = true; + mUserPrefs.mUseDayCycle = true; + mUserPrefs.mWaterPresetName = "Default"; + mUserPrefs.mSkyPresetName = "Default"; + mUserPrefs.mDayCycleName = "Default"; +} + +bool LLEnvManagerNew::getUseRegionSettings() const +{ + return mUserPrefs.getUseDefaults(); +} + +bool LLEnvManagerNew::getUseDayCycle() const +{ + return mUserPrefs.getUseDayCycle(); +} + +bool LLEnvManagerNew::getUseFixedSky() const +{ + return mUserPrefs.getUseFixedSky(); +} + +std::string LLEnvManagerNew::getWaterPresetName() const +{ + return mUserPrefs.getWaterPresetName(); +} + +std::string LLEnvManagerNew::getSkyPresetName() const +{ + return mUserPrefs.getSkyPresetName(); +} + +std::string LLEnvManagerNew::getDayCycleName() const +{ + return mUserPrefs.getDayCycleName(); +} + +void LLEnvManagerNew::setUseRegionSettings(bool val) +{ + mUserPrefs.setUseDefaults(val); + saveUserPrefs(); + updateManagersFromPrefs(); +} + +void LLEnvManagerNew::setUseWaterPreset(const std::string& name) +{ + if (name.empty()) + { + llwarns << "Empty water preset name passed" << llendl; + return; + } + + mUserPrefs.setUseWaterPreset(name); + saveUserPrefs(); + updateManagersFromPrefs(); +} + +void LLEnvManagerNew::setUseSkyPreset(const std::string& name) +{ + if (name.empty()) + { + llwarns << "Empty sky preset name passed" << llendl; + return; + } + + mUserPrefs.setUseSkyPreset(name); + saveUserPrefs(); + updateManagersFromPrefs(); +} + +void LLEnvManagerNew::setUseDayCycle(const std::string& name) +{ + if (name.empty()) + { + llwarns << "Empty day cycle name passed" << llendl; + return; + } + + mUserPrefs.setUseDayCycle(name); + saveUserPrefs(); + updateManagersFromPrefs(); +} + +void LLEnvManagerNew::loadUserPrefs() +{ + // operate on members directly to avoid side effects + mUserPrefs.mWaterPresetName = gSavedSettings.getString("WaterPresetName"); + mUserPrefs.mSkyPresetName = gSavedSettings.getString("SkyPresetName"); + mUserPrefs.mDayCycleName = gSavedSettings.getString("DayCycleName"); + + mUserPrefs.mUseDefaults = gSavedSettings.getBOOL("UseEnvironmentFromRegion"); + mUserPrefs.mUseDayCycle = gSavedSettings.getBOOL("UseDayCycle"); +} + +void LLEnvManagerNew::saveUserPrefs() +{ + gSavedSettings.setString("WaterPresetName", getWaterPresetName()); + gSavedSettings.setString("SkyPresetName", getSkyPresetName()); + gSavedSettings.setString("DayCycleName", getDayCycleName()); + + gSavedSettings.setBOOL("UseEnvironmentFromRegion", getUseRegionSettings()); + gSavedSettings.setBOOL("UseDayCycle", getUseDayCycle()); +} + +void LLEnvManagerNew::onRegionCrossing() +{ + LL_DEBUGS("Windlight") << "Crossed region" << LL_ENDL; + onRegionChange(true); +} + +void LLEnvManagerNew::onLogin() +{ + LL_DEBUGS("Windlight") << "Logged in" << LL_ENDL; + onRegionChange(false); +} + +void LLEnvManagerNew::onTeleport() +{ + LL_DEBUGS("Windlight") << "Teleported" << LL_ENDL; + onRegionChange(false); +} + +//-- private methods ---------------------------------------------------------- + +// virtual +void LLEnvManagerNew::initSingleton() +{ + LL_DEBUGS("Windlight") << "Initializing LLEnvManagerNew" << LL_ENDL; + + loadUserPrefs(); +} + +void LLEnvManagerNew::updateManagersFromPrefs() +{ + // *TODO: apply region settings if user preferences say to do so. + + // Apply water settings. + LLWaterParamManager::instance().applyUserPrefs(); + + // Apply sky settings. + LLWLParamManager::instance().applyUserPrefs(); +} + +void LLEnvManagerNew::sendRegionSettingsRequest() +{ +} + +void LLEnvManagerNew::onRegionChange(bool interpolate) +{ + mInterpNextChangeMessage = interpolate; + sendRegionSettingsRequest(); +} + +void LLEnvManagerNew::onRegionSettingsResponse() +{ + // 1. Refresh cached region settings. + // ... + + // 2. If using server settings, update managers. + if (mUserPrefs.getUseDefaults()) + { + updateManagersFromPrefs(); + } +} diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 438fe4590d..0fd2a7e87e 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -126,6 +126,7 @@ private: // 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 @@ -219,5 +220,86 @@ private: LLUUID mLastReceivedID; }; +/** + * User or region preferences. + * + * Region defaults :- use SL defaults + * User defaults :- use region defaults + */ +class LLEnvPrefs +{ +public: + LLEnvPrefs() : mUseDefaults(true), mUseDayCycle(true) {} + + bool getUseDefaults() const { return mUseDefaults; } + bool getUseDayCycle() const { return mUseDayCycle; } + bool getUseFixedSky() const { return !getUseDayCycle(); } + + std::string getWaterPresetName() const; + std::string getSkyPresetName() const; + std::string getDayCycleName() const; + + void setUseDefaults(bool val); + void setUseWaterPreset(const std::string& name); + void setUseSkyPreset(const std::string& name); + void setUseDayCycle(const std::string& name); + + bool mUseDefaults; + bool mUseDayCycle; + std::string mWaterPresetName; + std::string mSkyPresetName; + std::string mDayCycleName; +}; + +class LLRegionEnvPrefs : public LLEnvPrefs +{ + LLSD mDayCycle; +}; + +/** + * Setting: + * 1. Use region settings. + * 2. Use my setting: + | + */ +class LLEnvManagerNew : public LLSingleton +{ + LOG_CLASS(LLEnvManagerNew); +public: + LLEnvManagerNew(); + + bool getUseRegionSettings() const; + bool getUseDayCycle() const; + bool getUseFixedSky() const; + std::string getWaterPresetName() const; + std::string getSkyPresetName() const; + std::string getDayCycleName() const; + + void setUseRegionSettings(bool val); + void setUseWaterPreset(const std::string& name); + void setUseSkyPreset(const std::string& name); + void setUseDayCycle(const std::string& name); + + void loadUserPrefs(); + void saveUserPrefs(); + + void onLogin(); + void onRegionCrossing(); + void onTeleport(); + +private: + friend class LLSingleton; + /*virtual*/ void initSingleton(); + + void updateManagersFromPrefs(); + void sendRegionSettingsRequest(); + + void onRegionChange(bool interpolate); + void onRegionSettingsResponse(); + + LLEnvPrefs mUserPrefs; + LLRegionEnvPrefs mCachedRegionPrefs; + bool mInterpNextChangeMessage; +}; + #endif // LL_LLENVMANAGER_H diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index 533831f181..c32e25be41 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -98,7 +98,7 @@ BOOL LLFloaterWater::postBuild() } // set defaults on combo boxes - comboBox->selectByValue(LLSD("Default")); + comboBox->selectByValue(LLEnvManagerNew::instance().getWaterPresetName()); } // load it up initCallbacks(); @@ -654,7 +654,11 @@ 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/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 34629ec5c4..b90f576555 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -89,7 +89,8 @@ BOOL LLFloaterWindLight::postBuild() comboBox->add(LLStringUtil::null); // set defaults on combo boxes - comboBox->selectByValue(LLSD("Default")); + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + comboBox->selectByValue(env_mgr.getUseFixedSky() ? env_mgr.getSkyPresetName() : LLStringUtil::null); } // add the list of presets @@ -920,7 +921,11 @@ void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) return; } +#if 0 LLWLParamManager::getInstance()->loadPreset(LLWLParamKey(combo_box->getSelectedValue())); +#else + LLEnvManagerNew::instance().setUseSkyPreset(LLWLParamKey(combo_box->getSelectedValue()).name); +#endif sWindLight->syncMenu(); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 54fc4a2bb7..4a0e9fa766 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7587,51 +7587,21 @@ class LLWorldEnvSettings : public view_listener_t return true; } - if (gSavedSettings.getBOOL("UseEnvironmentFromRegion")) - { - LLNotifications::instance().add("EnvLockedUsingRegion", LLSD(), LLSD()); - return true; - } - if (tod == "sunrise") { - // set the value, turn off animation - LLWLParamManager::getInstance()->mAnimator.setDayTime(0.25); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - // then call update once - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); + LLEnvManagerNew::instance().setUseSkyPreset("Sunrise"); } else if (tod == "noon") { - // set the value, turn off animation - LLWLParamManager::getInstance()->mAnimator.setDayTime(0.567); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - // then call update once - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); + LLEnvManagerNew::instance().setUseSkyPreset("Midday"); } else if (tod == "sunset") { - // set the value, turn off animation - LLWLParamManager::getInstance()->mAnimator.setDayTime(0.75); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - // then call update once - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); + LLEnvManagerNew::instance().setUseSkyPreset("Sunset"); } else if (tod == "midnight") { - // set the value, turn off animation - LLWLParamManager::getInstance()->mAnimator.setDayTime(0.0); - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - // then call update once - LLWLParamManager::getInstance()->mAnimator.update( - LLWLParamManager::getInstance()->mCurParams); + LLEnvManagerNew::instance().setUseSkyPreset("Midnight"); } else { diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 4e56be5851..587249856e 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -256,6 +256,13 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader) static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params"); +void LLWaterParamManager::applyUserPrefs() +{ + std::string water = LLEnvManagerNew::instance().getWaterPresetName(); + LL_DEBUGS("Windlight") << "Loading water preset [" << water << "]" << LL_ENDL; + loadPreset(water, true); +} + void LLWaterParamManager::update(LLViewerCamera * cam) { LLFastTimer ftm(FTM_UPDATE_WATERPARAM); @@ -427,6 +434,7 @@ F32 LLWaterParamManager::getFogDensity(void) // virtual static void LLWaterParamManager::initSingleton() { + LL_DEBUGS("Windlight") << "Initializing water" << LL_ENDL; loadAllPresets(LLStringUtil::null); - getParamSet("Default", mCurParams); + applyUserPrefs(); } diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h index 3fe0f0d861..37c04448eb 100644 --- a/indra/newview/llwaterparammanager.h +++ b/indra/newview/llwaterparammanager.h @@ -229,6 +229,9 @@ public: /// send the parameters to the shaders void propagateParameters(void); + /// apply user water preferences + void applyUserPrefs(); + /// update information for the shader void update(LLViewerCamera * cam); diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index c116265c86..de20051880 100644 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -113,13 +113,21 @@ LLEnvironmentRequestResponder::LLEnvironmentRequestResponder() return; } +#if 0 LLEnvManager::getInstance()->processIncomingMessage(unvalidated_content, LLEnvKey::SCOPE_REGION); +#else + LL_INFOS("WindlightCaps") << "Temprarily ignoring region settings" << LL_ENDL; +#endif } /*virtual*/ void LLEnvironmentRequestResponder::error(U32 status, const std::string& reason) { LL_INFOS("WindlightCaps") << "Got an error, not using region windlight..." << LL_ENDL; +#if 0 // notify manager that region settings are undefined LLEnvManager::getInstance()->processIncomingMessage(LLSD(), LLEnvKey::SCOPE_REGION); +#else + LL_INFOS("WindlightCaps") << "Temprarily ignoring region settings" << LL_ENDL; +#endif } diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 1da70b9557..43f0cdae93 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -580,6 +580,49 @@ void LLWLParamManager::update(LLViewerCamera * cam) } } +void LLWLParamManager::applyUserPrefs() +{ + LL_DEBUGS("Windlight") << "Applying sky prefs" << LL_ENDL; + + if (LLEnvManagerNew::instance().getUseRegionSettings()) // apply region-wide settings + { + llwarns << "Using region settings has not been implemented" << llendl; + } + else // apply user-specified settings + { + bool use_day_cycle = LLEnvManagerNew::instance().getUseDayCycle(); + + if (use_day_cycle) + { + LL_DEBUGS("Windlight") << "Loading day cycle " << LLEnvManagerNew::instance().getDayCycleName() << LL_ENDL; + mDay.loadDayCycleFromFile(LLEnvManagerNew::instance().getDayCycleName() + ".xml"); + } + else + { + // *HACK - sets cloud scrolling to what we want... fix this better in the future + std::string sky = LLEnvManagerNew::instance().getSkyPresetName(); + LL_DEBUGS("Windlight") << "Loading fixed sky " << sky << LL_ENDL; + getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), mCurParams); + } + + // Animator should be running if we're using a day cycle + // and be stopped if we want fixed sky. + if (use_day_cycle != mAnimator.getIsRunning()) + { + if (use_day_cycle) + { + LL_DEBUGS("Windlight") << "Activating animator" << LL_ENDL; + mAnimator.activate(mAnimator.getTimeType()); + } + else + { + LL_DEBUGS("Windlight") << "Deactivating animator" << LL_ENDL; + mAnimator.deactivate(); + } + } + } +} + void LLWLParamManager::resetAnimator(F32 curTime, bool run) { mAnimator.setTrack(mDay.mTimeMap, mDay.mDayRate, @@ -687,16 +730,19 @@ void LLWLParamManager::removeParamSet(const LLWLParamKey& key, bool delete_from_ // virtual static void LLWLParamManager::initSingleton() { + LL_DEBUGS("Windlight") << "Initializing sky" << LL_ENDL; + loadPresets(LLStringUtil::null); // load the day - mDay.loadDayCycleFromFile(std::string("Default.xml")); + mDay.loadDayCycleFromFile(LLEnvManagerNew::instance().getDayCycleName() + ".xml"); // *HACK - sets cloud scrolling to what we want... fix this better in the future - getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams); + std::string sky = LLEnvManagerNew::instance().getSkyPresetName(); + getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), mCurParams); // set it to noon - resetAnimator(0.5, true); + resetAnimator(0.5, LLEnvManagerNew::instance().getUseDayCycle()); // but use linden time sets it to what the estate is mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN); diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index e85227d3b3..a2327d35a8 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -235,6 +235,9 @@ public: /// update information camera dependent parameters void update(LLViewerCamera * cam); + /// apply specified params + void applyUserPrefs(); + // get where the light is pointing inline LLVector4 getLightDir(void) const; diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 910106a6b5..04a0350283 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -505,8 +505,9 @@ function="World.EnvSettings" parameter="midnight" /> + - -You cannot load environment presets while you are using the region's environment settings. To manually configure your environment setings, select the Environment Editor and uncheck "Use Region Environment Settings." - - - Date: Wed, 25 May 2011 13:57:16 -0400 Subject: storm-1189: remove classic clouds --- indra/newview/CMakeLists.txt | 2 -- indra/newview/app_settings/settings.xml | 11 ------ indra/newview/featuretable.txt | 2 -- indra/newview/featuretable_linux.txt | 2 -- indra/newview/featuretable_mac.txt | 2 -- indra/newview/featuretable_xp.txt | 2 -- indra/newview/llappviewer.cpp | 3 +- indra/newview/llfloaterwindlight.cpp | 6 +--- indra/newview/llviewerregion.cpp | 1 - indra/newview/llviewerregion.h | 2 -- indra/newview/llworld.cpp | 39 +++++----------------- .../default/xui/en/floater_edit_sky_preset.xml | 10 ------ .../default/xui/en/floater_windlight_options.xml | 10 ------ 13 files changed, 11 insertions(+), 81 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5f0a7f5b66..5a9ee92b0c 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -119,7 +119,6 @@ set(viewer_SOURCE_FILES llchiclet.cpp llclassifiedinfo.cpp llclassifiedstatsresponder.cpp - llcloud.cpp llcofwearables.cpp llcolorswatch.cpp llcommanddispatcherlistener.cpp @@ -672,7 +671,6 @@ set(viewer_HEADER_FILES llchiclet.h llclassifiedinfo.h llclassifiedstatsresponder.h - llcloud.h llcofwearables.h llcolorswatch.h llcommanddispatcherlistener.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a3b8ee177a..d1d64516f9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10187,17 +10187,6 @@ 0.1 - SkyUseClassicClouds - - Comment - Whether to use the old Second Life particle clouds or not - Persist - 1 - Type - Boolean - Value - 1 - SnapEnabled Comment diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index dd8a88e558..9cc6893b15 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -59,7 +59,6 @@ Disregard96DefaultDrawDistance 1 1 RenderTextureMemoryMultiple 1 1.0 RenderShaderLightingMaxLevel 1 3 RenderDeferred 1 1 -SkyUseClassicClouds 1 1 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 WatchdogDisabled 1 1 @@ -91,7 +90,6 @@ RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 WLSkyDetail 1 48 -SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 058bdcc730..1aa6314246 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -57,7 +57,6 @@ WLSkyDetail 1 128 Disregard128DefaultDrawDistance 1 1 Disregard96DefaultDrawDistance 1 1 RenderTextureMemoryMultiple 1 1.0 -SkyUseClassicClouds 1 1 RenderShaderLightingMaxLevel 1 3 RenderDeferred 1 1 RenderDeferredSSAO 1 1 @@ -89,7 +88,6 @@ RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 WLSkyDetail 1 48 -SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index c075c660f3..9a8e4d04be 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -58,7 +58,6 @@ Disregard128DefaultDrawDistance 1 1 Disregard96DefaultDrawDistance 1 1 RenderTextureMemoryMultiple 1 0.5 RenderShaderLightingMaxLevel 1 3 -SkyUseClassicClouds 1 1 RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 @@ -91,7 +90,6 @@ RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 WLSkyDetail 1 48 -SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index 3339172a1a..9b9e1f6ead 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -58,7 +58,6 @@ Disregard128DefaultDrawDistance 1 1 Disregard96DefaultDrawDistance 1 1 RenderTextureMemoryMultiple 1 1.0 RenderShaderLightingMaxLevel 1 3 -SkyUseClassicClouds 1 1 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 @@ -91,7 +90,6 @@ RenderVolumeLODFactor 1 0.5 VertexShaderEnable 1 0 WindLightUseAtmosShaders 1 0 WLSkyDetail 1 48 -SkyUseClassicClouds 1 0 RenderDeferred 1 0 RenderDeferredSSAO 1 0 RenderShadowDetail 1 0 diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 84db514ecf..572a5a4683 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1,4 +1,4 @@ - /** +/** * @file llappviewer.cpp * @brief The LLAppViewer class definitions * @@ -4311,7 +4311,6 @@ void LLAppViewer::idle() // // Update weather effects // - LLWorld::getInstance()->updateClouds(gFrameDTClamped); gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets // Update wind vector diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index b90f576555..fb69e6f594 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -180,8 +180,6 @@ void LLFloaterWindLight::initCallbacks(void) childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, ¶m_mgr->mCloudDetail); // Cloud extras - static std::string use_classic_clouds = "SkyUseClassicClouds"; - childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, ¶m_mgr->mCloudCoverage); childSetCommitCallback("WLCloudScale", onFloatControlMoved, ¶m_mgr->mCloudScale); childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL); @@ -189,8 +187,7 @@ void LLFloaterWindLight::initCallbacks(void) childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL); childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL); childSetCommitCallback("WLDistanceMult", onFloatControlMoved, ¶m_mgr->mDistanceMult); - getChild("DrawClassicClouds")->setCommitCallback(boost::bind(LLSavedSettingsGlue::setBOOL, _1, "SkyUseClassicClouds")); - + // WL Top childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); // Load/save @@ -373,7 +370,6 @@ void LLFloaterWindLight::syncMenu() bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY(); childSetValue("WLCloudLockX", lockX); childSetValue("WLCloudLockY", lockY); - childSetValue("DrawClassicClouds", gSavedSettings.getBOOL("SkyUseClassicClouds")); // disable if locked, enable if not if(lockX) diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 9b3ec80c03..65fb74f1f0 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -349,7 +349,6 @@ LLViewerRegion::~LLViewerRegion() // Can't do this on destruction, because the neighbor pointers might be invalid. // This should be reference counted... disconnectAllNeighbors(); - mCloudLayer.destroy(); LLViewerPartSim::getInstance()->cleanupRegion(this); gObjectList.killObjects(this); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index eae04b2f0c..4bc487e4cb 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -34,7 +34,6 @@ #include "lldarray.h" #include "llwind.h" -#include "llcloud.h" #include "llstat.h" #include "v3dmath.h" #include "llstring.h" @@ -334,7 +333,6 @@ protected: public: LLWind mWind; - LLCloudLayer mCloudLayer; LLViewerParcelOverlay *mParcelOverlay; LLStat mBitStat; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index ec24b02934..3af62d537c 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -61,6 +61,8 @@ #include #include +#define TMP_WL_REMOVE_CLOUDS /* disables code for classic clouds */ + // // Globals // @@ -91,8 +93,11 @@ LLWorld::LLWorld() : mLastPacketsIn(0), mLastPacketsOut(0), mLastPacketsLost(0), - mSpaceTimeUSec(0), - mClassicCloudsEnabled(TRUE) + mSpaceTimeUSec(0) +#ifndef TMP_WL_REMOVE_CLOUDS + , + mClassicCloudsEnabled(FALSE) +#endif { for (S32 i = 0; i < 8; i++) { @@ -661,6 +666,7 @@ void LLWorld::updateParticles() LLViewerPartSim::getInstance()->updateSimulation(); } +#ifndef TMP_WL_REMOVE_CLOUDS void LLWorld::updateClouds(const F32 dt) { static LLFastTimer::DeclareTimer ftm("World Clouds"); @@ -672,33 +678,6 @@ void LLWorld::updateClouds(const F32 dt) return; } - if ( - mClassicCloudsEnabled != - gSavedSettings.getBOOL("SkyUseClassicClouds") ) - { - // The classic cloud toggle has been flipped - // gotta update all of the cloud layers - mClassicCloudsEnabled = - gSavedSettings.getBOOL("SkyUseClassicClouds"); - - if ( !mClassicCloudsEnabled && mActiveRegionList.size() ) - { - // We've transitioned to having classic clouds disabled - // reset all cloud layers. - for ( - region_list_t::iterator iter = mActiveRegionList.begin(); - iter != mActiveRegionList.end(); - ++iter) - { - LLViewerRegion* regionp = *iter; - regionp->mCloudLayer.reset(); - } - - return; - } - } - else if ( !mClassicCloudsEnabled ) return; - if (mActiveRegionList.size()) { for (region_list_t::iterator iter = mActiveRegionList.begin(); @@ -745,7 +724,7 @@ LLCloudGroup* LLWorld::findCloudGroup(const LLCloudPuff &puff) } return NULL; } - +#endif // TMP_WL_REMOVE_CLOUDS void LLWorld::renderPropertyLines() { diff --git a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml index 9d180a1f50..7ddb7ac1e1 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml @@ -987,16 +987,6 @@ name="WLCloudScrollY" top_pad="6" width="200" /> - diff --git a/indra/newview/skins/default/xui/en/floater_windlight_options.xml b/indra/newview/skins/default/xui/en/floater_windlight_options.xml index 249ad95c41..b121f3daa5 100644 --- a/indra/newview/skins/default/xui/en/floater_windlight_options.xml +++ b/indra/newview/skins/default/xui/en/floater_windlight_options.xml @@ -1273,16 +1273,6 @@ name="WLCloudScrollY" top="85" width="200" /> - -- cgit v1.3 From 9d1c1c496831fdeacfec0d762d5203a3067e8f77 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 6 Jun 2011 15:56:44 +0300 Subject: STORM-1253 WIP Made the triangle 50% larger. --- indra/newview/app_settings/settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 3db2259c62..199ce9c30d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10801,7 +10801,7 @@ Type S32 Value - -2 + -1 UIExtraTriangleWidth @@ -10812,7 +10812,7 @@ Type S32 Value - 2 + 4 UIFloaterCloseBoxSize -- cgit v1.3 From cf31723a1a258e0452dd26d9f5eb5fcdac290e05 Mon Sep 17 00:00:00 2001 From: callum Date: Mon, 6 Jun 2011 17:12:17 -0700 Subject: EXP-844 INITIAL CHECKIN - FUNCTION DISABLED - As a first time user I would like to see a video after I log in that highlights the best features of Second Life --- indra/newview/app_settings/settings.xml | 25 +++++- indra/newview/llmediactrl.cpp | 18 ++--- indra/newview/llprogressview.cpp | 88 +++++++++++++++++----- indra/newview/llprogressview.h | 20 ++++- indra/newview/llstartup.cpp | 3 +- indra/newview/llviewerwindow.cpp | 8 ++ indra/newview/llviewerwindow.h | 1 + .../skins/default/xui/en/panel_progress.xml | 8 ++ 8 files changed, 132 insertions(+), 39 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index cf5f522519..218a0534e6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6535,8 +6535,29 @@ Value 0 - - PrecachingDelay + PostFirstLoginIntroURL + + Comment + URL of intro presenatation after first time users first login + Persist + 1 + Type + String + Value + + + PostFirstLoginIntroViewed + + Comment + Flag indicating if user has seen intro presenatation after first time users first login + Persist + 1 + Type + Boolean + Value + 0 + + PrecachingDelay Comment Delay when logging in to load world before showing it (seconds) diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index b3ad9efeb2..03ccabc994 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -38,6 +38,7 @@ #include "llviewermedia.h" #include "llviewertexture.h" #include "llviewerwindow.h" +#include "lldebugmessagebox.h" #include "llweb.h" #include "llrender.h" #include "llpluginclassmedia.h" @@ -708,6 +709,8 @@ LLPluginClassMedia* LLMediaCtrl::getMediaPlugin() // void LLMediaCtrl::draw() { + F32 alpha = getDrawContext().mAlpha; + if ( gRestoreGL == 1 ) { LLRect r = getRect(); @@ -746,21 +749,11 @@ void LLMediaCtrl::draw() } } -// if(mHidingInitialLoad) -// { -// // If we're hiding loading, don't draw at all. -// draw_media = false; -// } - bool background_visible = isBackgroundVisible(); bool background_opaque = isBackgroundOpaque(); if(draw_media) { - // alpha off for this - LLGLSUIDefault gls_ui; - LLGLDisable gls_alphaTest( GL_ALPHA_TEST ); - gGL.pushUIMatrix(); { if (mIgnoreUIScale) @@ -775,7 +768,8 @@ void LLMediaCtrl::draw() // scale texture to fit the space using texture coords gGL.getTexUnit(0)->bind(media_texture); - gGL.color4fv( LLColor4::white.mV ); + LLColor4 media_color = LLColor4::white % alpha; + gGL.color4fv( media_color.mV ); F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth(); F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight(); @@ -827,7 +821,6 @@ void LLMediaCtrl::draw() } // draw the browser - gGL.setSceneBlendType(LLRender::BT_REPLACE); gGL.begin( LLRender::QUADS ); if (! media_plugin->getTextureCoordsOpenGL()) { @@ -860,7 +853,6 @@ void LLMediaCtrl::draw() gGL.vertex2i( x_offset + width, y_offset ); } gGL.end(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); } gGL.popUIMatrix(); diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 31fde5d58a..028891a90e 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -55,23 +55,18 @@ LLProgressView* LLProgressView::sInstance = NULL; S32 gStartImageWidth = 1; S32 gStartImageHeight = 1; -const F32 FADE_IN_TIME = 1.f; - -const std::string ANIMATION_FILENAME = "Login Sequence "; -const std::string ANIMATION_SUFFIX = ".jpg"; -const F32 TOTAL_LOGIN_TIME = 10.f; // seconds, wild guess at time from GL context to actual world view -S32 gLastStartAnimationFrame = 0; // human-style indexing, first image = 1 -const S32 ANIMATION_FRAMES = 1; //13; +const F32 FADE_TO_WORLD_TIME = 1.0f; static LLRegisterPanelClassWrapper r("progress_view"); - // XUI: Translate LLProgressView::LLProgressView() : LLPanel(), mPercentDone( 0.f ), + mMediaCtrl( NULL ), mMouseDownInActiveArea( false ), - mUpdateEvents("LLProgressView") + mUpdateEvents("LLProgressView"), + mFadeToWorldTimer() { mUpdateEvents.listen("self", boost::bind(&LLProgressView::handleUpdate, this, _1)); } @@ -80,9 +75,14 @@ BOOL LLProgressView::postBuild() { mProgressBar = getChild("login_progress_bar"); + // media control that is used to play intro video + mMediaCtrl = getChild("login_media_panel"); + mMediaCtrl->setVisible( false ); // hidden initially + mMediaCtrl->addObserver( this ); // watch events + mCancelBtn = getChild("cancel_btn"); mCancelBtn->setClickedCallback( LLProgressView::onCancelButtonClicked, NULL ); - mFadeTimer.stop(); + mFadeToWorldTimer.stop(); getChild("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle())); @@ -125,24 +125,43 @@ BOOL LLProgressView::handleKeyHere(KEY key, MASK mask) return TRUE; } +void LLProgressView::revealIntroPanel() +{ + // if user hasn't yet seen intro video + std::string intro_url = gSavedSettings.getString("PostFirstLoginIntroURL"); + if ( intro_url.length() > 0 && + gSavedSettings.getBOOL("PostFirstLoginIntroViewed" ) == FALSE ) + { + // navigate to intro URL and reveal widget + mMediaCtrl->navigateTo( intro_url ); + mMediaCtrl->setVisible( TRUE ); + + // flag as having seen the new user post login intro + gSavedSettings.setBOOL("PostFirstLoginIntroViewed", TRUE ); + } + else + { + // start the timer that will control the fade through to the world view + mFadeToWorldTimer.start(); + } +} + void LLProgressView::setVisible(BOOL visible) { // hiding progress view if (getVisible() && !visible) { - mFadeTimer.start(); + LLPanel::setVisible(FALSE); } // showing progress view - else if (visible && (!getVisible() || mFadeTimer.getStarted())) + else if (visible && (!getVisible() || mFadeToWorldTimer.getStarted())) { setFocus(TRUE); - mFadeTimer.stop(); - mProgressTimer.start(); + mFadeToWorldTimer.stop(); LLPanel::setVisible(TRUE); } } - void LLProgressView::draw() { static LLTimer timer; @@ -153,7 +172,7 @@ void LLProgressView::draw() { LLGLSUIDefault gls_ui; gGL.getTexUnit(0)->bind(gStartTexture.get()); - gGL.color4f(1.f, 1.f, 1.f, mFadeTimer.getStarted() ? clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, FADE_IN_TIME, 1.f, 0.f) : 1.f); + gGL.color4f(1.f, 1.f, 1.f, 1.f); F32 image_aspect = (F32)gStartImageWidth / (F32)gStartImageHeight; S32 width = getRect().getWidth(); S32 height = getRect().getHeight(); @@ -180,16 +199,36 @@ void LLProgressView::draw() } glPopMatrix(); - // Handle fade-in animation - if (mFadeTimer.getStarted()) + // handle fade out to world view when we're asked to + if (mFadeToWorldTimer.getStarted()) { + // draw fading panel + F32 alpha = clamp_rescale(mFadeToWorldTimer.getElapsedTimeF32(), 0.f, FADE_TO_WORLD_TIME, 1.f, 0.f); + LLViewDrawContext context(alpha); LLPanel::draw(); - if (mFadeTimer.getElapsedTimeF32() > FADE_IN_TIME) + + // faded out completely - remove panel and reveal world + if (mFadeToWorldTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME ) { + mFadeToWorldTimer.stop(); + // Fade is complete, release focus gFocusMgr.releaseFocusIfNeeded( this ); + + // turn off panel that hosts intro so we see the world LLPanel::setVisible(FALSE); - mFadeTimer.stop(); + + // stop observing events since we no longer care + mMediaCtrl->remObserver( this ); + + // hide the intro + mMediaCtrl->setVisible( false ); + + // navigate away from intro page to something innocuous since 'unload' is broken right now + //mMediaCtrl->navigateTo( "about:blank" ); + + // FIXME: this causes a crash that i haven't been able to fix + mMediaCtrl->unloadMediaSource(); gStartTexture = NULL; } @@ -307,3 +346,12 @@ bool LLProgressView::onAlertModal(const LLSD& notify) } return false; } + +void LLProgressView::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) +{ + if( event == MEDIA_EVENT_CLOSE_REQUEST ) + { + // the intro web content calls javascript::window.close() when it's done + mFadeToWorldTimer.start(); + } +} diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index be1744f08a..73dd478e98 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -28,6 +28,7 @@ #define LL_LLPROGRESSVIEW_H #include "llpanel.h" +#include "llmediactrl.h" #include "llframetimer.h" #include "llevents.h" @@ -35,7 +36,10 @@ class LLImageRaw; class LLButton; class LLProgressBar; -class LLProgressView : public LLPanel +class LLProgressView : + public LLPanel, + public LLViewerMediaObserver + { public: LLProgressView(); @@ -49,25 +53,35 @@ public: /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void setVisible(BOOL visible); + // inherited from LLViewerMediaObserver + /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); + void setText(const std::string& text); void setPercent(const F32 percent); // Set it to NULL when you want to eliminate the message. void setMessage(const std::string& msg); + // turns on (under certain circumstances) the into video after login + void revealIntroPanel(); + void setCancelButtonVisible(BOOL b, const std::string& label); static void onCancelButtonClicked( void* ); static void onClickMessage(void*); bool onAlertModal(const LLSD& sd); + // note - this is not just hiding the intro panel - it also hides the parent panel + // and is used when the intro is finished and we want to show the world + void removeIntroPanel(); + protected: LLProgressBar* mProgressBar; + LLMediaCtrl* mMediaCtrl; F32 mPercentDone; std::string mMessage; LLButton* mCancelBtn; - LLFrameTimer mFadeTimer; - LLFrameTimer mProgressTimer; + LLFrameTimer mFadeToWorldTimer; LLRect mOutlineRect; bool mMouseDownInActiveArea; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 86b09473ab..167dd68f08 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1953,7 +1953,8 @@ bool idle_startup() gViewerWindow->getWindow()->resetBusyCount(); gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("AppInit") << "Done releasing bitmap" << LL_ENDL; - gViewerWindow->setShowProgress(FALSE); + gViewerWindow->revealIntroPanel(); + //gViewerWindow->setShowProgress(FALSE); // reveal intro video now handles this gViewerWindow->setProgressCancelButtonVisible(FALSE); // We're not away from keyboard, even though login might have taken diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 34d15a597e..4ecb645337 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4512,6 +4512,14 @@ void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset) glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]); } +void LLViewerWindow::revealIntroPanel() +{ + if (mProgressView) + { + mProgressView->revealIntroPanel(); + } +} + void LLViewerWindow::setShowProgress(const BOOL show) { if (mProgressView) diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index df6928aa1d..ff49ed1f62 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -271,6 +271,7 @@ public: void setProgressMessage(const std::string& msg); void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null ); LLProgressView *getProgressView() const; + void revealIntroPanel(); void updateObjectUnderCursor(); diff --git a/indra/newview/skins/default/xui/en/panel_progress.xml b/indra/newview/skins/default/xui/en/panel_progress.xml index 2868d91cc7..4535c56339 100644 --- a/indra/newview/skins/default/xui/en/panel_progress.xml +++ b/indra/newview/skins/default/xui/en/panel_progress.xml @@ -132,4 +132,12 @@ name="cancel_btn" top="700" width="90" /> + -- cgit v1.3 From 5e3d344fba6f73959d9a8caeac68984d2ae99004 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 15 Jun 2011 16:21:19 -0700 Subject: EXP-872 FIX -- Hide inbox and outbox unless applicable EXP-893 FIX -- Single order purchases not sorted with most recent item delivered at top of list EXP-904 FIX -- Newness/Freshness value out of synch with new items in Inbox on next login when ordering in bulk with Inventory window open * Inbox and outbox can now be forced on by setting the debug variables "InventoryDisplayInbox" and "InventoryDisplayOutbox" * Inbox is only displayed when logging into a grid that has a marketplace that returns pup as a merchant * Inbox contents is now a forced download when the user logs in, rather than the typical lazy load of the rest of the inventory Reviewed by Leyla --- indra/newview/app_settings/settings.xml | 35 ++++++++- indra/newview/llsidepanelinventory.cpp | 131 ++++++++++++++------------------ indra/newview/llsidepanelinventory.h | 7 +- 3 files changed, 93 insertions(+), 80 deletions(-) (limited to 'indra/newview/app_settings/settings.xml') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 218a0534e6..bae127d217 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4180,7 +4180,29 @@ Value 1.0 - InventoryLinking + InventoryDisplayInbox + + Comment + Override received items inventory inbox display + Persist + 0 + Type + Boolean + Value + 0 + + InventoryDisplayOutbox + + Comment + Override merchant inventory outbox display + Persist + 0 + Type + Boolean + Value + 0 + + InventoryLinking Comment Enable ability to create links to folders and items via "Paste as link". @@ -4422,6 +4444,17 @@ Value 2.0 + LastInventoryInboxExpand + + Comment + The last time the received items inbox was expanded. + Persist + 1 + Type + String + Value + + LCDDestination Comment diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 33d512d89e..d916c430a8 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -29,8 +29,10 @@ #include "llagent.h" #include "llappearancemgr.h" +#include "llappviewer.h" #include "llavataractions.h" #include "llbutton.h" +#include "llcurl.h" #include "lldate.h" #include "llfirstuse.h" #include "llfoldertype.h" @@ -47,7 +49,9 @@ #include "llselectmgr.h" #include "llsidepaneliteminfo.h" #include "llsidepaneltaskinfo.h" +#include "llstring.h" #include "lltabcontainer.h" +#include "llviewernetwork.h" #include "llweb.h" static LLRegisterPanelClassWrapper t_inventory("sidepanel_inventory"); @@ -71,47 +75,27 @@ static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack" // Helpers // -class LLInboxOutboxInventoryAddedObserver : public LLInventoryAddedObserver +class LLInventoryUserStatusResponder : public LLHTTPClient::Responder { public: - LLInboxOutboxInventoryAddedObserver(LLSidepanelInventory * sidepanelInventory) - : LLInventoryAddedObserver() + LLInventoryUserStatusResponder(LLSidepanelInventory * sidepanelInventory) + : LLCurl::Responder() , mSidepanelInventory(sidepanelInventory) - {} + { + } -protected: - virtual void done() + void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - uuid_vec_t::const_iterator it = mAdded.begin(); - uuid_vec_t::const_iterator it_end = mAdded.end(); - - for(; it != it_end; ++it) - { - LLInventoryObject* item = gInventory.getObject(*it); - - // NOTE: This doesn't actually work because folder creation does not trigger this observer - if (item && item->getType() == LLAssetType::AT_CATEGORY) - { - // Check for FolderType FT_INBOX or FT_OUTBOX and report back to mSidepanelInventory - LLInventoryCategory * item_cat = static_cast(item); - LLFolderType::EType folderType = item_cat->getPreferredType(); - - if (folderType == LLFolderType::FT_INBOX) - { - mSidepanelInventory->enableInbox(true); - } - else if (folderType == LLFolderType::FT_OUTBOX) - { - mSidepanelInventory->enableOutbox(true); - } - } - } + llinfos << "Marketplace Inbox Disabled" << llendl; + } - mAdded.clear(); + void result(const LLSD& content) + { + mSidepanelInventory->enableInbox(true); } private: - LLSidepanelInventory * mSidepanelInventory; + LLSidepanelInventory * mSidepanelInventory; }; // @@ -124,19 +108,12 @@ LLSidepanelInventory::LLSidepanelInventory() , mPanelMainInventory(NULL) , mInventoryFetched(false) , mCategoriesObserver(NULL) - , mInboxOutboxAddedObserver(NULL) { //buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() } LLSidepanelInventory::~LLSidepanelInventory() { - if (mInboxOutboxAddedObserver && gInventory.containsObserver(mInboxOutboxAddedObserver)) - { - gInventory.removeObserver(mInboxOutboxAddedObserver); - } - delete mInboxOutboxAddedObserver; - if (mCategoriesObserver && gInventory.containsObserver(mCategoriesObserver)) { gInventory.removeObserver(mCategoriesObserver); @@ -207,9 +184,6 @@ BOOL LLSidepanelInventory::postBuild() // Marketplace inbox/outbox setup { - LLButton * inbox_button = getChild(INBOX_BUTTON_NAME); - LLButton * outbox_button = getChild(OUTBOX_BUTTON_NAME); - LLLayoutStack* stack = getChild(INVENTORY_LAYOUT_STACK_NAME); LLLayoutPanel * inbox_panel = getChild(INBOX_LAYOUT_PANEL_NAME); @@ -217,61 +191,69 @@ BOOL LLSidepanelInventory::postBuild() stack->collapsePanel(inbox_panel, true); stack->collapsePanel(outbox_panel, true); + + // Disable user_resize on main inventory panel by default + stack->setPanelUserResize(MAIN_INVENTORY_LAYOUT_PANEL, false); + + LLButton * inbox_button = getChild(INBOX_BUTTON_NAME); + LLButton * outbox_button = getChild(OUTBOX_BUTTON_NAME); inbox_button->setToggleState(false); outbox_button->setToggleState(false); inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this)); outbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); - - // TODO: Hide inbox/outbox panels until we determine the status of the feature - //inbox_panel->setVisible(false); - //outbox_panel->setVisible(false); - - // Track added items - mInboxOutboxAddedObserver = new LLInboxOutboxInventoryAddedObserver(this); - gInventory.addObserver(mInboxOutboxAddedObserver); - // Track inbox and outbox folder changes - const bool do_not_create_folder = false; - const bool do_not_find_in_library = false; + // Set the inbox and outbox visible based on debug settings (final setting comes from http request below) + inbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayInbox")); + outbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayOutbox")); - const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, do_not_create_folder, do_not_find_in_library); - const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library); - - mCategoriesObserver = new LLInventoryCategoriesObserver(); - gInventory.addObserver(mCategoriesObserver); - - mCategoriesObserver->addCategory(inbox_id, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inbox_id)); - mCategoriesObserver->addCategory(outbox_id, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outbox_id)); + // Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); } return TRUE; } -void LLSidepanelInventory::draw() +void LLSidepanelInventory::handleLoginComplete() { - if (!mInventoryFetched && LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) + // + // Hard coding this as a temporary way to determine whether or not to display the inbox + // + + std::string url = "https://marketplace.secondlife.com/"; + + if (!LLGridManager::getInstance()->isInProductionGrid()) { - mInventoryFetched = true; - - updateInboxOutboxPanels(); + std::string gridLabel = LLGridManager::getInstance()->getGridLabel(); + url = llformat("https://marketplace.%s.lindenlab.com/", utf8str_tolower(gridLabel).c_str()); } - LLPanel::draw(); -} + std::string url_suffix = "api/1/users/b72d31f8-d03c-4a3b-a002-3dd7b4a712b8/user_status"; + + LLHTTPClient::get(url + url_suffix, new LLInventoryUserStatusResponder(this)); + + // + // Track inbox and outbox folder changes + // -void LLSidepanelInventory::updateInboxOutboxPanels() -{ - // Iterate through gInventory looking for inbox and outbox const bool do_not_create_folder = false; const bool do_not_find_in_library = false; const LLUUID inbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, do_not_create_folder, do_not_find_in_library); const LLUUID outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX, do_not_create_folder, do_not_find_in_library); - enableInbox(inbox_id.notNull()); - enableOutbox(outbox_id.notNull()); + mCategoriesObserver = new LLInventoryCategoriesObserver(); + gInventory.addObserver(mCategoriesObserver); + + mCategoriesObserver->addCategory(inbox_id, boost::bind(&LLSidepanelInventory::onInboxChanged, this, inbox_id)); + mCategoriesObserver->addCategory(outbox_id, boost::bind(&LLSidepanelInventory::onOutboxChanged, this, outbox_id)); + + // + // Trigger a load for the entire contents of the Inbox + // + + LLInventoryModelBackgroundFetch::instance().start(inbox_id); } void LLSidepanelInventory::enableInbox(bool enabled) @@ -286,7 +268,8 @@ void LLSidepanelInventory::enableOutbox(bool enabled) void LLSidepanelInventory::onInboxChanged(const LLUUID& inbox_id) { - // Perhaps use this to track inbox changes? + // Trigger a load of the entire inbox so we always know the contents and their creation dates for sorting + LLInventoryModelBackgroundFetch::instance().start(inbox_id); } void LLSidepanelInventory::onOutboxChanged(const LLUUID& outbox_id) diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 8047e11566..25fc28d56b 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -30,7 +30,6 @@ #include "llpanel.h" class LLFolderViewItem; -class LLInboxOutboxInventoryAddedObserver; class LLInventoryCategoriesObserver; class LLInventoryItem; class LLInventoryPanel; @@ -44,6 +43,8 @@ public: LLSidepanelInventory(); virtual ~LLSidepanelInventory(); + void handleLoginComplete(); + /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); @@ -61,12 +62,9 @@ public: void onToggleInboxBtn(); void onToggleOutboxBtn(); - void updateInboxOutboxPanels(); void enableInbox(bool enabled); void enableOutbox(bool enabled); - virtual void draw(); - protected: // Tracks highlighted (selected) item in inventory panel. LLInventoryItem *getSelectedItem(); @@ -112,7 +110,6 @@ private: bool mInventoryFetched; LLInventoryCategoriesObserver* mCategoriesObserver; - LLInboxOutboxInventoryAddedObserver* mInboxOutboxAddedObserver; }; #endif //LL_LLSIDEPANELINVENTORY_H -- cgit v1.3 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/newview/app_settings/settings.xml') 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 @@ - - - - -