diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 6f39b42770..cc87aa20c8 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -29,17 +29,13 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
-using System.IO;
using System.Reflection;
-using System.Threading;
using log4net;
using MySql.Data.MySqlClient;
using OpenMetaverse;
-using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
-using OpenSim.Data;
namespace OpenSim.Data.MySQL
{
@@ -1510,9 +1506,7 @@ namespace OpenSim.Data.MySQL
{
try
{
- OSD oenv = OSDParser.Deserialize(env);
- ViewerEnvironment VEnv = new ViewerEnvironment();
- VEnv.FromOSD(oenv);
+ ViewerEnvironment VEnv = ViewerEnvironment.FromOSDString(env);
newData.Environment = VEnv;
newData.EnvironmentVersion = VEnv.version;
}
@@ -1875,9 +1869,7 @@ namespace OpenSim.Data.MySQL
{
try
{
- OSD oenv = land.Environment.ToOSD();
- string env = OSDParser.SerializeLLSDNotationFull(oenv);
- cmd.Parameters.AddWithValue("environment", env);
+ cmd.Parameters.AddWithValue("environment", ViewerEnvironment.ToOSDString(land.Environment));
}
catch
{
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index d3557a714e..eab82d2e65 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Framework.Serialization
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ASSET_EXTENSION_SEPARATOR + "texture.jp2";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR + "texture.tga";
ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml";
- ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Settings] = ASSET_EXTENSION_SEPARATOR + "settings.bin";
+ ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Settings] = ASSET_EXTENSION_SEPARATOR + "settings.dat";
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "animation.bvh"] = (sbyte)AssetType.Animation;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bodypart.txt"] = (sbyte)AssetType.Bodypart;
@@ -148,7 +148,7 @@ namespace OpenSim.Framework.Serialization
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.jp2"] = (sbyte)AssetType.Texture;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "material.xml"] = (sbyte)OpenSimAssetType.Material;
- EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "settings.bin"] = (sbyte)AssetType.Settings;
+ EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "settings.dat"] = (sbyte)AssetType.Settings;
}
public static string CreateOarLandDataPath(LandData ld)
diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
index e42d56f96b..2a826828aa 100644
--- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs
@@ -28,12 +28,10 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Reflection;
using System.Text;
using System.Xml;
using log4net;
using OpenMetaverse;
-using OpenSim.Framework;
namespace OpenSim.Framework.Serialization.External
{
@@ -99,6 +97,9 @@ namespace OpenSim.Framework.Serialization.External
m_ldProcessors.Add(
"ParcelAccessList", ProcessParcelAccessList);
+ m_ldProcessors.Add(
+ "Environment", ProcessParcelEnvironment);
+
m_ldProcessors.Add(
"PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours")));
m_ldProcessors.Add(
@@ -132,6 +133,13 @@ namespace OpenSim.Framework.Serialization.External
);
m_laeProcessors.Add(
"AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList")));
+
+ }
+
+ public static void ProcessParcelEnvironment(LandData ld, XmlReader xtr)
+ {
+ string senv = xtr.ReadElementString("Environment");
+ ld.Environment = ViewerEnvironment.FromOSDString(senv);
}
public static void ProcessParcelAccessList(LandData ld, XmlReader xtr)
@@ -255,6 +263,15 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("Dwell", "0");
xtw.WriteElementString("OtherCleanTime", Convert.ToString(landData.OtherCleanTime));
+ if(landData.Environment != null)
+ {
+ try
+ {
+ string senv = ViewerEnvironment.ToOSDString(landData.Environment);
+ xtw.WriteElementString("Environment", senv);
+ }
+ catch { }
+ }
xtw.WriteEndElement();
xtw.Close();
diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
index 617c451fe0..a18fad60a1 100644
--- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
@@ -46,9 +46,10 @@ namespace OpenSim.Framework.Serialization.External
///
///
///
- public static RegionSettings Deserialize(byte[] serializedSettings)
+ public static RegionSettings Deserialize(byte[] serializedSettings, out ViewerEnvironment regionEnv)
{
- return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length));
+ // encoding is wrong. old oars seem to be on utf-16
+ return Deserialize(Encoding.ASCII.GetString(serializedSettings, 0, serializedSettings.Length), out regionEnv);
}
///
@@ -57,9 +58,10 @@ namespace OpenSim.Framework.Serialization.External
///
///
///
- public static RegionSettings Deserialize(string serializedSettings)
+ public static RegionSettings Deserialize(string serializedSettings, out ViewerEnvironment regionEnv)
{
RegionSettings settings = new RegionSettings();
+ regionEnv = null;
StringReader sr = new StringReader(serializedSettings);
XmlTextReader xtr = new XmlTextReader(sr);
@@ -210,13 +212,28 @@ namespace OpenSim.Framework.Serialization.External
}
}
+ if (xtr.IsStartElement("Environment"))
+ {
+ xtr.ReadStartElement("Environment");
+
+ while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
+ {
+ switch (xtr.Name)
+ {
+ case "data":
+ regionEnv = ViewerEnvironment.FromOSDString(xtr.ReadElementContentAsString());
+ break;
+ }
+ }
+ }
+
xtr.Close();
sr.Close();
return settings;
}
- public static string Serialize(RegionSettings settings)
+ public static string Serialize(RegionSettings settings, ViewerEnvironment RegionEnv)
{
StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw);
@@ -263,8 +280,6 @@ namespace OpenSim.Framework.Serialization.External
xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString());
xtw.WriteElementString("FixedSun", settings.FixedSun.ToString());
xtw.WriteElementString("SunPosition", settings.SunPosition.ToString());
- // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which
- // calculates it automatically according to the date and other factors.
xtw.WriteEndElement();
xtw.WriteStartElement("Telehub");
@@ -276,6 +291,13 @@ namespace OpenSim.Framework.Serialization.External
}
xtw.WriteEndElement();
+ if (RegionEnv != null)
+ {
+ xtw.WriteStartElement("Environment");
+ xtw.WriteElementString("data", ViewerEnvironment.ToOSDString(RegionEnv));
+ xtw.WriteEndElement();
+ }
+
xtw.WriteEndElement();
xtw.Close();
diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
index 142726bbe7..80215e5e6d 100644
--- a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
+++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
@@ -130,7 +130,7 @@ namespace OpenSim.Framework.Serialization.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
- RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs);
+ RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs, out ViewerEnvironment dummy);
Assert.That(deserRs, Is.Not.Null);
Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 613c302d2d..2964d98d4b 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -3381,6 +3381,14 @@ namespace OpenSim.Framework
return ticks * TimeStampClockPeriodMS;
}
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
+ public static void AddToGatheredIds(Dictionary uuids, UUID id, sbyte type)
+ {
+ if (id == UUID.Zero)
+ return;
+ uuids[id] = type;
+ }
+
///
/// Formats a duration (given in milliseconds).
///
@@ -3976,7 +3984,5 @@ namespace OpenSim.Framework
{
rng.GetBytes(buff);
}
-
-
}
}
diff --git a/OpenSim/Framework/ViewerEnvironment.cs b/OpenSim/Framework/ViewerEnvironment.cs
index f8078b07c2..368aa93e11 100644
--- a/OpenSim/Framework/ViewerEnvironment.cs
+++ b/OpenSim/Framework/ViewerEnvironment.cs
@@ -484,6 +484,16 @@ namespace OpenSim.Framework
sunlight_color = otmp;
Name = name;
}
+
+ public void GatherAssets(Dictionary uuids)
+ {
+ Util.AddToGatheredIds(uuids, bloom_id, (sbyte)AssetType.Texture);
+ Util.AddToGatheredIds(uuids, cloud_id, (sbyte)AssetType.Texture);
+ Util.AddToGatheredIds(uuids, halo_id, (sbyte)AssetType.Texture);
+ Util.AddToGatheredIds(uuids, moon_id, (sbyte)AssetType.Texture);
+ Util.AddToGatheredIds(uuids, rainbow_id, (sbyte)AssetType.Texture);
+ Util.AddToGatheredIds(uuids, sun_id, (sbyte)AssetType.Texture);
+ }
}
public class WaterData
@@ -599,6 +609,12 @@ namespace OpenSim.Framework
return map;
}
+
+ public void GatherAssets(Dictionary uuids)
+ {
+ Util.AddToGatheredIds(uuids, normalMap, (sbyte)AssetType.Texture);
+ Util.AddToGatheredIds(uuids, transpTexture, (sbyte)AssetType.Texture);
+ }
}
public class DayCycle
@@ -889,6 +905,18 @@ namespace OpenSim.Framework
return cycle;
}
+
+ public void GatherAssets(Dictionary uuids)
+ {
+ foreach (WaterData wd in waterframes.Values)
+ {
+ wd.GatherAssets(uuids);
+ }
+ foreach (SkyData sd in skyframes.Values)
+ {
+ sd.GatherAssets(uuids);
+ }
+ }
}
public class ViewerEnvironment
@@ -1216,6 +1244,35 @@ namespace OpenSim.Framework
return env;
}
+ public static ViewerEnvironment FromOSDString(string s)
+ {
+ try
+ {
+ OSD eosd = OSDParser.Deserialize(s);
+ ViewerEnvironment VEnv = new ViewerEnvironment();
+ VEnv.FromOSD(eosd);
+ return VEnv;
+ }
+ catch
+ {
+ }
+ return null;
+ }
+
+ public static string ToOSDString(ViewerEnvironment VEnv, bool xml = false)
+ {
+ try
+ {
+ OSD eosd= VEnv.ToOSD();
+ if(xml)
+ return OSDParser.SerializeLLSDXmlString(eosd);
+ else
+ return OSDParser.SerializeLLSDNotationFull(eosd);
+ }
+ catch {}
+ return String.Empty;
+ }
+
public ViewerEnvironment Clone()
{
// im lazy need to proper clone later
@@ -1398,5 +1455,11 @@ namespace OpenSim.Framework
return true;
}
*/
+
+ public void GatherAssets(Dictionary uuids)
+ {
+ if (Cycle != null)
+ Cycle.GatherAssets(uuids);
+ }
}
}
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index cf837de8d7..55cafbd064 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -285,14 +285,13 @@ namespace OpenSim.Framework
if (tickdiff > LongCallTime)
{
m_log.InfoFormat(
- "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {7} bytes ({8} uncomp): {9}",
+ "[WEB UTIL]: Slow ServiceOSD request {0} {1} {2} took {3}ms, {4} bytes ({5} uncomp): {6}",
reqnum,
method,
url,
tickdiff,
compsize,
strBuffer != null ? strBuffer.Length : 0,
-
strBuffer != null
? (strBuffer.Length > MaxRequestDiagLength ? strBuffer.Remove(MaxRequestDiagLength) : strBuffer)
: "");
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 21243dc1b4..7a191b9e06 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -1039,10 +1039,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
private bool LoadRegionSettings(Scene scene, string settingsPath, byte[] data, DearchiveScenesInfo dearchivedScenes)
{
RegionSettings loadedRegionSettings;
-
+ ViewerEnvironment regionEnv = null;
try
{
- loadedRegionSettings = RegionSettingsSerializer.Deserialize(data);
+ loadedRegionSettings = RegionSettingsSerializer.Deserialize(data, out regionEnv);
}
catch (Exception e)
{
@@ -1051,7 +1051,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
settingsPath, e);
return false;
}
-
+ scene.RegionEnvironment = regionEnv;
RegionSettings currentRegionSettings = scene.RegionInfo.RegionSettings;
currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit;
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index 6cee442ea9..1911eaf19f 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -321,6 +321,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
assetUuids[regionSettings.TerrainTexture4] = (sbyte)AssetType.Texture;
+ if(scene.RegionEnvironment != null)
+ scene.RegionEnvironment.GatherAssets(assetUuids);
+
+ List landObjects = scene.LandChannel.AllParcels();
+ foreach (ILandObject lo in landObjects)
+ {
+ if(lo.LandData != null && lo.LandData.Environment != null)
+ lo.LandData.Environment.GatherAssets(assetUuids);
+ }
+
Save(scene, sceneObjects, regionDir);
GC.Collect();
}
@@ -572,7 +582,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// Write out region settings
string settingsPath = String.Format("{0}{1}{2}.xml",
regionDir, ArchiveConstants.SETTINGS_PATH, scene.RegionInfo.RegionName);
- m_archiveWriter.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(scene.RegionInfo.RegionSettings));
+ m_archiveWriter.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(scene.RegionInfo.RegionSettings, scene.RegionEnvironment));
m_log.InfoFormat("[ARCHIVER]: Adding parcel settings to archive.");
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 68852991c1..a1ebb1adc3 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -657,7 +657,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111");
rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33"));
- tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs));
+ tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs, null));
tar.Close();
diff --git a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
index 68fb6b1a4f..cd1ab00105 100644
--- a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
+++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
@@ -699,9 +699,9 @@ namespace OpenSim.Region.CoreModules.World.LightShare
{
if(m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
{
- ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
- if (land != null && land.LandData != null && land.LandData.Environment != null)
- VEnv = land.LandData.Environment;
+ ILandObject land = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
+ if (land != null && land.LandData != null && land.LandData.Environment != null)
+ VEnv = land.LandData.Environment;
}
if(VEnv == null)
VEnv = GetRegionEnvironment();
@@ -837,6 +837,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
return OSDParser.SerializeLLSDNotationToBytes(osddata,true);
}
+
public List MakeLightShareData()
{
if(m_scene.RegionEnvironment == null)
diff --git a/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs b/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs
index ac8ff52e09..5a460730bd 100644
--- a/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs
+++ b/OpenSim/Server/Handlers/Authentication/OpenIdServerConnector.cs
@@ -66,10 +66,10 @@ namespace OpenSim.Server.Handlers.Authentication
m_UserAccountService = ServerUtils.LoadPlugin(userService, args);
// Handler for OpenID user identity pages
- server.AddStreamHandler(new OpenIdStreamHandler("GET", "/users/", m_UserAccountService, m_AuthenticationService));
+ server.AddStreamHandler(new OpenIdStreamHandler("GET", "/users", m_UserAccountService, m_AuthenticationService));
// Handlers for the OpenID endpoint server
- server.AddStreamHandler(new OpenIdStreamHandler("POST", "/openid/server/", m_UserAccountService, m_AuthenticationService));
- server.AddStreamHandler(new OpenIdStreamHandler("GET", "/openid/server/", m_UserAccountService, m_AuthenticationService));
+ server.AddStreamHandler(new OpenIdStreamHandler("POST", "/openid/server", m_UserAccountService, m_AuthenticationService));
+ server.AddStreamHandler(new OpenIdStreamHandler("GET", "/openid/server", m_UserAccountService, m_AuthenticationService));
m_log.Info("[OPENID]: OpenId service enabled");
}