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/llenvmanager.h | 214 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 indra/newview/llenvmanager.h (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h new file mode 100644 index 0000000000..1ff4654003 --- /dev/null +++ b/indra/newview/llenvmanager.h @@ -0,0 +1,214 @@ +/** + * @file llenvmanager.h + * @brief Declaration of classes managing WindLight and water settings. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLENVMANAGER_H +#define LL_LLENVMANAGER_H + +#include "llmemory.h" +#include "llsd.h" + +class LLWLParamManager; +class LLWaterParamManager; +class LLWLAnimator; + +// generic key +struct LLEnvKey +{ +public: + // Note: enum ordering is important; for example, a region-level floater (1) will see local and region (all values that are <=) + typedef enum e_scope + { + SCOPE_LOCAL, // 0 + SCOPE_REGION//, // 1 + // SCOPE_ESTATE, // 2 + // etc. + } EScope; +}; + +class LLEnvironmentSettings +{ +public: + LLEnvironmentSettings() : + mWLDayCycle(LLSD::emptyMap()), + mSkyMap(LLSD::emptyMap()), + mWaterParams(LLSD::emptyMap()), + mDayTime(0.f) + {} + LLEnvironmentSettings(const LLSD& dayCycle, const LLSD& skyMap, const LLSD& waterParams, F64 dayTime) : + mWLDayCycle(dayCycle), + mSkyMap(skyMap), + mWaterParams(waterParams), + mDayTime(dayTime) + {} + ~LLEnvironmentSettings() {} + + void saveParams(const LLSD& dayCycle, const LLSD& skyMap, const LLSD& waterParams, F64 dayTime) + { + mWLDayCycle = dayCycle; + mSkyMap = skyMap; + mWaterParams = waterParams; + mDayTime = dayTime; + } + + LLSD& getWLDayCycle() + { + return mWLDayCycle; + } + + LLSD& getWaterParams() + { + return mWaterParams; + } + + LLSD& getSkyMap() + { + return mSkyMap; + } + + F64 getDayTime() + { + return mDayTime; + } + + LLSD makePacket(const LLSD& metadata) + { + LLSD full_packet = LLSD::emptyArray(); + + // 0: metadata + full_packet.append(metadata); + + // 1: day cycle + full_packet.append(mWLDayCycle); + + // 2: map of sky setting names to sky settings (as LLSD) + full_packet.append(mSkyMap); + + // 3: water params + full_packet.append(mWaterParams); + + return full_packet; + } + +private: + LLSD mWLDayCycle, mWaterParams, mSkyMap; + F64 mDayTime; +}; + +// not thread-safe +class LLEnvManager : public LLSingleton +{ +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); + + /* + * 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); + +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); + + // 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; +}; + +#endif // LL_LLENVMANAGER_H + -- cgit v1.2.3 From 79fb8e2ec26dc2c5a42ef1ee48ebaaa39183c67b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 31 Mar 2011 18:24:01 +0300 Subject: STORM-1126 WIP Windlight Estate Settings integration: pass 4 Changes: * Fixed incorrect way to pass parameters to notifications. * Fixed crashes in the Advanced Sky floater and the Region Terrain panel. * Fixed initialization and multiple instantiation of the Day Cycle floater (that might lead to incorrect behavior). * Fixed and re-enabled committing env. settings changes to region. * Fixed day cycle and sky settings being sent as empty arrays and therefore not passing validation on server. It is now possible to change region environment settings. * Added debug messages. --- indra/newview/llenvmanager.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 1ff4654003..0228648a39 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -174,6 +174,8 @@ public: // 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; private: // overriden initializer -- cgit v1.2.3 From 7419abc12ba07380593fa3c0571155b248b8c8a6 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 31 Mar 2011 18:24:01 +0300 Subject: STORM-1126 WIP Windlight Estate Settings integration: pass 5 * Added "Apply Local to Region" button to the region terrain setttings panel. * Fixed previewing presets via a combomox in the Advanced Sky Editor floater. --- indra/newview/llenvmanager.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 0228648a39..138921b432 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -145,6 +145,8 @@ public: 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. -- cgit v1.2.3 From 38f87d0e21cfb6807e262e0289e1f6b08904a4e7 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 31 Mar 2011 18:24:01 +0300 Subject: STORM-1126 WIP Windlight Estate Settings integration: pass 6 * Made it possible to update a region sky preset with the Save button. * Fixed resetting day cycle when you start editing region environment settings. * Fixed: if you press "Cancel Changes" in the region envitonment settings and then choose to resume editing in the confirmation dialog, you won't be able to cancel your changes later. --- indra/newview/llenvmanager.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 138921b432..60298b12e4 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -189,6 +189,8 @@ private: 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(); -- cgit v1.2.3 From 4b5eeb34601ac642194e245ef3928a3b9e56d3b8 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 7 Apr 2011 06:26:42 +0300 Subject: STORM-1142 ADDITIONAL_COMMIT Debugging improvements. --- indra/newview/llenvmanager.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 60298b12e4..438fe4590d 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -179,6 +179,9 @@ public: // gets normally displayed scope LLEnvKey::EScope getNormallyDisplayedScope() const; + // for debugging purposes + void dumpScopes(); + private: // overriden initializer friend class LLSingleton; -- cgit v1.2.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/llenvmanager.h | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) (limited to 'indra/newview/llenvmanager.h') 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 -- cgit v1.2.3 From 912f021bb11ef48f352ea85cca27c2bca6ca06b1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 16 May 2011 17:17:22 +0300 Subject: STORM-1245 WIP Implement loading and applying region environment settings. --- indra/newview/llenvmanager.h | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 0fd2a7e87e..da1db52074 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -79,22 +79,22 @@ public: mDayTime = dayTime; } - LLSD& getWLDayCycle() + const LLSD& getWLDayCycle() const { return mWLDayCycle; } - LLSD& getWaterParams() + const LLSD& getWaterParams() const { return mWaterParams; } - LLSD& getSkyMap() + const LLSD& getSkyMap() const { return mSkyMap; } - F64 getDayTime() + F64 getDayTime() const { return mDayTime; } @@ -221,10 +221,9 @@ private: }; /** - * User or region preferences. + * User environment preferences. * - * Region defaults :- use SL defaults - * User defaults :- use region defaults + * defaults = use region settings */ class LLEnvPrefs { @@ -251,11 +250,6 @@ public: std::string mDayCycleName; }; -class LLRegionEnvPrefs : public LLEnvPrefs -{ - LLSD mDayCycle; -}; - /** * Setting: * 1. Use region settings. @@ -273,6 +267,7 @@ public: std::string getWaterPresetName() const; std::string getSkyPresetName() const; std::string getDayCycleName() const; + const LLEnvironmentSettings& getRegionSettings() const; void setUseRegionSettings(bool val); void setUseWaterPreset(const std::string& name); @@ -281,10 +276,12 @@ public: void loadUserPrefs(); void saveUserPrefs(); + void dumpUserPrefs(); void onLogin(); void onRegionCrossing(); void onTeleport(); + void onRegionSettingsResponse(const LLSD& content); private: friend class LLSingleton; @@ -294,11 +291,10 @@ private: void sendRegionSettingsRequest(); void onRegionChange(bool interpolate); - void onRegionSettingsResponse(); - LLEnvPrefs mUserPrefs; - LLRegionEnvPrefs mCachedRegionPrefs; - bool mInterpNextChangeMessage; + LLEnvPrefs mUserPrefs; + LLEnvironmentSettings mCachedRegionPrefs; + bool mInterpNextChangeMessage; }; #endif // LL_LLENVMANAGER_H -- cgit v1.2.3 From 348218e40f362d386a0175d4b010b639282764b2 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 17 May 2011 16:26:55 +0300 Subject: STORM-1245 WIP Restored environment settings interpolation on region crossing. Also got rid of duplicated region environment settings requests. --- indra/newview/llenvmanager.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index da1db52074..b871ebc06f 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -278,7 +278,6 @@ public: void saveUserPrefs(); void dumpUserPrefs(); - void onLogin(); void onRegionCrossing(); void onTeleport(); void onRegionSettingsResponse(const LLSD& content); @@ -287,14 +286,15 @@ private: friend class LLSingleton; /*virtual*/ void initSingleton(); - void updateManagersFromPrefs(); + void updateManagersFromPrefs(bool interpolate); void sendRegionSettingsRequest(); void onRegionChange(bool interpolate); - LLEnvPrefs mUserPrefs; - LLEnvironmentSettings mCachedRegionPrefs; - bool mInterpNextChangeMessage; + LLEnvPrefs mUserPrefs; /// User environment preferences. + LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings. + bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change. + LLUUID mCurRegionUUID; /// To avoid duplicated region env. settings requests. }; #endif // LL_LLENVMANAGER_H -- cgit v1.2.3 From ec749bb1c1fa143c6019791d6713d85f05510e53 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 17 May 2011 17:09:15 +0300 Subject: STORM-1244 FIXED Environment Settings floater implementation. --- indra/newview/llenvmanager.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index b871ebc06f..1f005ecce2 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -276,6 +276,12 @@ public: void loadUserPrefs(); void saveUserPrefs(); + void setUserPrefs( + const std::string& water_preset, + const std::string& sky_preset, + const std::string& day_cycle_preset, + bool use_fixed_sky, + bool use_region_settings); void dumpUserPrefs(); void onRegionCrossing(); -- cgit v1.2.3 From b60c63bf075a92084ba94459a840decba846a916 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 23 May 2011 19:26:17 +0300 Subject: STORM-1256 WIP Implemented editing region environment settings via the Region/Estate floater. --- indra/newview/llenvmanager.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 1f005ecce2..f52eaf5a4b 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -99,7 +99,7 @@ public: return mDayTime; } - LLSD makePacket(const LLSD& metadata) + LLSD makePacket(const LLSD& metadata) const { LLSD full_packet = LLSD::emptyArray(); @@ -261,19 +261,24 @@ class LLEnvManagerNew : public LLSingleton public: LLEnvManagerNew(); + // getters to access user env. preferences bool getUseRegionSettings() const; bool getUseDayCycle() const; bool getUseFixedSky() const; std::string getWaterPresetName() const; std::string getSkyPresetName() const; std::string getDayCycleName() const; + + /// @return cached env. settings of the current region. const LLEnvironmentSettings& getRegionSettings() const; + // setters for user env. preferences void setUseRegionSettings(bool val); void setUseWaterPreset(const std::string& name); void setUseSkyPreset(const std::string& name); void setUseDayCycle(const std::string& name); + // Preferences manipulation. void loadUserPrefs(); void saveUserPrefs(); void setUserPrefs( @@ -284,6 +289,13 @@ public: bool use_region_settings); void dumpUserPrefs(); + // Common interface to the wl/water managers. + static LLSD getDayCycleByName(const std::string name); + + // Misc. + bool sendRegionSettings(const LLEnvironmentSettings& new_settings); + + // Public callbacks. void onRegionCrossing(); void onTeleport(); void onRegionSettingsResponse(const LLSD& content); @@ -293,7 +305,7 @@ private: /*virtual*/ void initSingleton(); void updateManagersFromPrefs(bool interpolate); - void sendRegionSettingsRequest(); + void requestRegionSettings(); void onRegionChange(bool interpolate); @@ -301,6 +313,7 @@ private: LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings. bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change. LLUUID mCurRegionUUID; /// To avoid duplicated region env. settings requests. + LLUUID mLastReceivedID; /// Id of last received region env. settings. }; #endif // LL_LLENVMANAGER_H -- cgit v1.2.3 From 9c2c6c7a6c48753e722748a7ae5cd4e2174f5630 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 24 May 2011 15:28:20 +0300 Subject: STORM-1256 WIP Improvements to region enviroment settings editing. * Enable/disable controls according to the region permissions. * Update controls when region settings update comes. --- indra/newview/llenvmanager.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index f52eaf5a4b..eb678e000e 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -259,6 +259,9 @@ class LLEnvManagerNew : public LLSingleton { LOG_CLASS(LLEnvManagerNew); public: + typedef boost::signals2::signal region_settings_change_signal_t; + typedef boost::signals2::signal region_change_signal_t; + LLEnvManagerNew(); // getters to access user env. preferences @@ -293,7 +296,10 @@ public: static LLSD getDayCycleByName(const std::string name); // Misc. + void requestRegionSettings(); bool sendRegionSettings(const LLEnvironmentSettings& new_settings); + boost::signals2::connection setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb); + boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); // Public callbacks. void onRegionCrossing(); @@ -305,10 +311,15 @@ private: /*virtual*/ void initSingleton(); void updateManagersFromPrefs(bool interpolate); - void requestRegionSettings(); void onRegionChange(bool interpolate); + /// Emitted when region environment settings update comes. + region_settings_change_signal_t mRegionSettingsChangeSignal; + + /// Emitted when agent region changes. Move to LLAgent? + region_settings_change_signal_t mRegionChangeSignal; + LLEnvPrefs mUserPrefs; /// User environment preferences. LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings. bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change. -- cgit v1.2.3 From d755605f8dc5bba0abdb87f075db2b6a5ed4ecad Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 24 May 2011 20:21:23 +0300 Subject: STORM-1256 WIP Added perpetual indicator for progress of applying changes. --- indra/newview/llenvmanager.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index eb678e000e..52b645b535 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -261,6 +261,7 @@ class LLEnvManagerNew : public LLSingleton public: typedef boost::signals2::signal region_settings_change_signal_t; typedef boost::signals2::signal region_change_signal_t; + typedef boost::signals2::signal region_settings_applied_signal_t; LLEnvManagerNew(); @@ -300,11 +301,13 @@ public: bool sendRegionSettings(const LLEnvironmentSettings& new_settings); boost::signals2::connection setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb); boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); + boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); // Public callbacks. void onRegionCrossing(); void onTeleport(); void onRegionSettingsResponse(const LLSD& content); + void onRegionSettingsApplyResponse(bool ok); private: friend class LLSingleton; @@ -320,6 +323,9 @@ private: /// Emitted when agent region changes. Move to LLAgent? region_settings_change_signal_t mRegionChangeSignal; + /// Emitted when agent region changes. Move to LLAgent? + region_settings_applied_signal_t mRegionSettingsAppliedSignal; + LLEnvPrefs mUserPrefs; /// User environment preferences. LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings. bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change. -- cgit v1.2.3 From c32b19f31d4d5d0b32fcf64cce1cebd7d79b9b05 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 26 May 2011 15:11:01 +0300 Subject: STORM-1253 WIP Implemented switching between multiple day cycles (locally and region-wide). --- indra/newview/llenvmanager.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 52b645b535..223654151b 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -293,9 +293,6 @@ public: bool use_region_settings); void dumpUserPrefs(); - // Common interface to the wl/water managers. - static LLSD getDayCycleByName(const std::string name); - // Misc. void requestRegionSettings(); bool sendRegionSettings(const LLEnvironmentSettings& new_settings); -- cgit v1.2.3 From c0037909d576fc4922b92dfcc83d865d61ac43cb Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 26 May 2011 19:32:20 +0300 Subject: STORM-1284 FIXED Changes to region environment are now visible immediately. Pressing "Apply" sends the settings update to server. Pressing "Cancel" reverts to current region settings. --- indra/newview/llenvmanager.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 223654151b..21b771bed8 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -276,6 +276,15 @@ public: /// @return cached env. settings of the current region. const LLEnvironmentSettings& getRegionSettings() const; + // Change environment w/o changing user preferences. + bool usePrefs(); + bool useDefaults(); + bool useWaterPreset(const std::string& name); + bool useWaterParams(const LLSD& params); + bool useSkyParams(const LLSD& params); + bool useDayCycle(const std::string& name, LLEnvKey::EScope scope); + bool useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope); + // setters for user env. preferences void setUseRegionSettings(bool val); void setUseWaterPreset(const std::string& name); -- cgit v1.2.3 From 6e2c05a512f498fe10aee307308e0365536f9819 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 1 Jun 2011 18:11:20 +0300 Subject: STORM-1253 WIP Fixed a couple of typos. --- indra/newview/llenvmanager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 21b771bed8..098fc6f353 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -327,7 +327,7 @@ private: region_settings_change_signal_t mRegionSettingsChangeSignal; /// Emitted when agent region changes. Move to LLAgent? - region_settings_change_signal_t mRegionChangeSignal; + region_change_signal_t mRegionChangeSignal; /// Emitted when agent region changes. Move to LLAgent? region_settings_applied_signal_t mRegionSettingsAppliedSignal; -- cgit v1.2.3 From dda7df4ac94d1e269aa0ce9eff6c6078f756cbd9 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Jun 2011 18:35:23 +0300 Subject: STORM-1253 WIP Debugging stuff. --- indra/newview/llenvmanager.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 098fc6f353..62ec08b09f 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -301,6 +301,7 @@ public: bool use_fixed_sky, bool use_region_settings); void dumpUserPrefs(); + void dumpPresets(); // Misc. void requestRegionSettings(); -- cgit v1.2.3 From e184c7598680f2069e2bcf5caa3c86967d7ab0a1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Jun 2011 18:56:49 +0300 Subject: STORM-1253 WIP Changed the workflow to modify region day cycle. Was: Press "Save" after editing the region day cycle in the Day Cycle Editor. Now: - Press "Save" in the Day Cycle Editor. - Open Region / Estate -> Environment tab. - Select the region day cycle. - Press "Apply". --- indra/newview/llenvmanager.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 62ec08b09f..7d4e647e90 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -99,6 +99,16 @@ public: return mDayTime; } + bool isEmpty() const + { + return mWLDayCycle.size() == 0; + } + + void clear() + { + *this = LLEnvironmentSettings(); + } + LLSD makePacket(const LLSD& metadata) const { LLSD full_packet = LLSD::emptyArray(); @@ -276,6 +286,14 @@ public: /// @return cached env. settings of the current region. const LLEnvironmentSettings& getRegionSettings() const; + /** + * Set new region settings without uploading them to the region. + * + * The override will be reset when the changes are applied to the region (=uploaded) + * or user teleports to another region. + */ + void setRegionSettings(const LLEnvironmentSettings& new_settings); + // Change environment w/o changing user preferences. bool usePrefs(); bool useDefaults(); @@ -335,6 +353,7 @@ private: LLEnvPrefs mUserPrefs; /// User environment preferences. LLEnvironmentSettings mCachedRegionPrefs; /// Cached region environment settings. + LLEnvironmentSettings mNewRegionPrefs; /// Not-yet-uploaded modified region env. settings. bool mInterpNextChangeMessage; /// Interpolate env. settings on next region change. LLUUID mCurRegionUUID; /// To avoid duplicated region env. settings requests. LLUUID mLastReceivedID; /// Id of last received region env. settings. -- cgit v1.2.3 From 9f4779e09997e70246c3c0c5f831bf55d4ed6a4f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 6 Jun 2011 23:46:35 +0300 Subject: STORM-1255 WIP Made the check for region permissions reusable. --- indra/newview/llenvmanager.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 7d4e647e90..de82787a08 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -328,6 +328,8 @@ public: boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); 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 + // Public callbacks. void onRegionCrossing(); void onTeleport(); -- cgit v1.2.3 From d6b0afb9148d8205ad10838513c247f947bcc7f8 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 9 Jun 2011 21:20:20 +0300 Subject: STORM-1279 WIP Moved private methods to the appropriate section. --- indra/newview/llenvmanager.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index de82787a08..a66a46275a 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -310,8 +310,6 @@ public: void setUseDayCycle(const std::string& name); // Preferences manipulation. - void loadUserPrefs(); - void saveUserPrefs(); void setUserPrefs( const std::string& water_preset, const std::string& sky_preset, @@ -340,6 +338,9 @@ private: friend class LLSingleton; /*virtual*/ void initSingleton(); + void loadUserPrefs(); + void saveUserPrefs(); + void updateManagersFromPrefs(bool interpolate); void onRegionChange(bool interpolate); -- cgit v1.2.3 From a7603c84879e7a2d0f72d64e5988aae332d463c1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 9 Jun 2011 21:56:33 +0300 Subject: STORM-1279 WIP Renamed a method. --- indra/newview/llenvmanager.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index a66a46275a..4d7c0fe5e4 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -232,15 +232,13 @@ private: /** * User environment preferences. - * - * defaults = use region settings */ class LLEnvPrefs { public: - LLEnvPrefs() : mUseDefaults(true), mUseDayCycle(true) {} + LLEnvPrefs() : mUseRegionSettings(true), mUseDayCycle(true) {} - bool getUseDefaults() const { return mUseDefaults; } + bool getUseRegionSettings() const { return mUseRegionSettings; } bool getUseDayCycle() const { return mUseDayCycle; } bool getUseFixedSky() const { return !getUseDayCycle(); } @@ -248,12 +246,12 @@ public: std::string getSkyPresetName() const; std::string getDayCycleName() const; - void setUseDefaults(bool val); + void setUseRegionSettings(bool val); void setUseWaterPreset(const std::string& name); void setUseSkyPreset(const std::string& name); void setUseDayCycle(const std::string& name); - bool mUseDefaults; + bool mUseRegionSettings; bool mUseDayCycle; std::string mWaterPresetName; std::string mSkyPresetName; -- cgit v1.2.3 From 0d1cc56eb128755ce9e63d8cdf852b0e3b6f4fb1 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 18:21:32 +0300 Subject: STORM-1279 FIXED Changing sky preset with a keyboard shortcut now updates the Environment Settings floater. Changes: * Subscribed the floater to the "settings changed" signal of the environment manager. * Rewrote the floater to not modify settings only when the Save button is pressed. * Refactoring to eliminate code duplication. --- indra/newview/llenvmanager.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'indra/newview/llenvmanager.h') diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 4d7c0fe5e4..343416634c 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -267,6 +267,7 @@ class LLEnvManagerNew : public LLSingleton { LOG_CLASS(LLEnvManagerNew); public: + typedef boost::signals2::signal prefs_change_signal_t; typedef boost::signals2::signal region_settings_change_signal_t; typedef boost::signals2::signal region_change_signal_t; typedef boost::signals2::signal region_settings_applied_signal_t; @@ -295,31 +296,34 @@ public: // Change environment w/o changing user preferences. bool usePrefs(); bool useDefaults(); + bool useRegionSettings(); bool useWaterPreset(const std::string& name); bool useWaterParams(const LLSD& params); + bool useSkyPreset(const std::string& name); bool useSkyParams(const LLSD& params); bool useDayCycle(const std::string& name, LLEnvKey::EScope scope); - bool useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope); + bool useDayCycleParams(const LLSD& params, LLEnvKey::EScope scope, F32 time = 0.5); // setters for user env. preferences void setUseRegionSettings(bool val); void setUseWaterPreset(const std::string& name); void setUseSkyPreset(const std::string& name); void setUseDayCycle(const std::string& name); - - // Preferences manipulation. void setUserPrefs( const std::string& water_preset, const std::string& sky_preset, const std::string& day_cycle_preset, bool use_fixed_sky, bool use_region_settings); + + // debugging methods void dumpUserPrefs(); void dumpPresets(); // Misc. void requestRegionSettings(); bool sendRegionSettings(const LLEnvironmentSettings& new_settings); + boost::signals2::connection setPreferencesChangeCallback(const prefs_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsChangeCallback(const region_settings_change_signal_t::slot_type& cb); boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); @@ -339,10 +343,21 @@ private: void loadUserPrefs(); void saveUserPrefs(); + void updateSkyFromPrefs(); + void updateWaterFromPrefs(bool interpolate); void updateManagersFromPrefs(bool interpolate); + bool useRegionSky(); + bool useRegionWater(); + + bool useDefaultSky(); + bool useDefaultWater(); + void onRegionChange(bool interpolate); + /// Emitted when user environment preferences change. + prefs_change_signal_t mUsePrefsChangeSignal; + /// Emitted when region environment settings update comes. region_settings_change_signal_t mRegionSettingsChangeSignal; -- cgit v1.2.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/llenvmanager.h | 98 +------------------------------------------- 1 file changed, 1 insertion(+), 97 deletions(-) (limited to 'indra/newview/llenvmanager.h') 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(); -- cgit v1.2.3