diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 1da52b41e4..80ec65e246 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -705,6 +705,9 @@ VALUES //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index e2b69538e5..ae78814f06 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -817,6 +817,7 @@ namespace OpenSim.Data.MySQL nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); + nWP.valid = true; } } } @@ -964,6 +965,21 @@ namespace OpenSim.Data.MySQL } } + public void RemoveRegionWindlightSettings(UUID regionID) + { + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; + cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); + ExecuteNonQuery(cmd); + } + } + } + public void StoreRegionSettings(RegionSettings rs) { lock (m_dbLock) diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index 34d3a4e38a..eb4e313f84 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -56,6 +56,9 @@ namespace OpenSim.Data.Null //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 9d49fb681f..bade0a1e9c 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -323,6 +323,9 @@ namespace OpenSim.Data.SQLite //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index ce18a428bb..4952cdf569 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -286,6 +286,9 @@ namespace OpenSim.Data.SQLiteLegacy //Return default LL windlight settings return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index a006f3e031..806142f57a 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -43,6 +43,7 @@ namespace OpenSim.Framework [Serializable] public class RegionLightShareData : ICloneable { + public bool valid = false; public UUID regionID = UUID.Zero; public Vector3 waterColor = new Vector3(4.0f,38.0f,64.0f); public float waterFogDensityExponent = 4.0f; diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 412dbb69c3..88f392dcdb 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -194,7 +194,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare } private void EventManager_OnSaveNewWindlightProfile() { - m_scene.ForEachScenePresence(SendProfileToClient); + if (m_scene.RegionInfo.WindlightSettings.valid) + m_scene.ForEachScenePresence(SendProfileToClient); } public void PostInitialise() diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs index edaa07c80f..5295a72976 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs @@ -94,5 +94,6 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); } } diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs index 0a4d531b91..615f3770d1 100644 --- a/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs @@ -105,6 +105,7 @@ namespace OpenSim.Region.Framework.Interfaces RegionSettings LoadRegionSettings(UUID regionUUID); RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID); void StoreRegionWindlightSettings(RegionLightShareData wl); + void RemoveRegionWindlightSettings(UUID regionID); void Shutdown(); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index 665b39f6fc..645566eaf0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs @@ -455,6 +455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (LightShareModule.EnableWindlight) { RegionLightShareData wl = getWindlightProfileFromRules(rules); + wl.valid = true; m_host.ParentGroup.Scene.StoreWindlightProfile(wl); success = 1; } @@ -465,6 +466,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return success; } + public void lsClearWindlightScene() + { + if (!m_LSFunctionsEnabled) + { + LSShoutError("LightShare functions are not enabled."); + return; + } + if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) + { + LSShoutError("lsSetWindlightScene can only be used by estate managers or owners."); + return; + } + + m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.valid = false; + if (m_host.ParentGroup.Scene.SimulationDataService != null) + m_host.ParentGroup.Scene.SimulationDataService.RemoveRegionWindlightSettings(m_host.ParentGroup.Scene.RegionInfo.RegionID); + } /// /// Set the current Windlight scene to a target avatar /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs index 9aa437b37e..f2df094abf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILS_Api.cs @@ -44,5 +44,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List lsGetWindlightScene(LSL_List rules); int lsSetWindlightScene(LSL_List rules); int lsSetWindlightSceneTargeted(LSL_List rules, key target); + void lsClearWindlightScene(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs index 8280ca5b5c..2e27f16725 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LS_Stub.cs @@ -73,6 +73,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target); } + public void lsClearWindlightScene() + { + m_LS_Functions.lsClearWindlightScene(); + } + public LSL_List cmGetWindlightScene(LSL_List rules) { return m_LS_Functions.lsGetWindlightScene(rules); @@ -87,5 +92,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LS_Functions.lsSetWindlightSceneTargeted(rules, target); } + + public void cmClearWindlightScene() + { + m_LS_Functions.lsClearWindlightScene(); + } } } diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index c8ecb18bbc..0df9380547 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs @@ -144,5 +144,9 @@ namespace OpenSim.Services.Connectors { m_database.StoreRegionWindlightSettings(wl); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + m_database.RemoveRegionWindlightSettings(regionID); + } } } diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs index 2e5020b043..2ea36da228 100644 --- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs @@ -104,6 +104,10 @@ namespace OpenSim.Data.Null return m_store.LoadRegionWindlightSettings(regionUUID); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { m_store.StoreRegionWindlightSettings(wl); @@ -146,6 +150,10 @@ namespace OpenSim.Data.Null return new RegionLightShareData(); } + public void RemoveRegionWindlightSettings(UUID regionID) + { + } + public void StoreRegionWindlightSettings(RegionLightShareData wl) { //This connector doesn't support the windlight module yet @@ -274,4 +282,4 @@ namespace OpenSim.Data.Null { } } -} \ No newline at end of file +}