diff options
author | Justin Clarke Casey | 2008-12-30 19:00:19 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-12-30 19:00:19 +0000 |
commit | f0ea8eb53463fe7e228537779f3f700bc6ecb74d (patch) | |
tree | 33f1a11a0dc4817557fd0578329ee7249c058371 /OpenSim | |
parent | OpenUser_Main is now public. Fixes Mantis #2940. Thanks SirKimba (diff) | |
download | opensim-SC-f0ea8eb53463fe7e228537779f3f700bc6ecb74d.zip opensim-SC-f0ea8eb53463fe7e228537779f3f700bc6ecb74d.tar.gz opensim-SC-f0ea8eb53463fe7e228537779f3f700bc6ecb74d.tar.bz2 opensim-SC-f0ea8eb53463fe7e228537779f3f700bc6ecb74d.tar.xz |
* Implement saving of region settings in OAR files
* This means that you can now save terrain textures, water height, etc.
* Estate settings are not supported
* Older OAR files without these settings can still be loaded
Diffstat (limited to 'OpenSim')
11 files changed, 395 insertions, 30 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index a53bfbe..dc00059 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -200,8 +200,6 @@ namespace OpenSim.Framework | |||
200 | private EstateSettings m_estateSettings; | 200 | private EstateSettings m_estateSettings; |
201 | private RegionSettings m_regionSettings; | 201 | private RegionSettings m_regionSettings; |
202 | 202 | ||
203 | // public bool m_allow_alternate_ports; | ||
204 | |||
205 | public UUID MasterAvatarAssignedUUID = UUID.Zero; | 203 | public UUID MasterAvatarAssignedUUID = UUID.Zero; |
206 | public string MasterAvatarFirstName = String.Empty; | 204 | public string MasterAvatarFirstName = String.Empty; |
207 | public string MasterAvatarLastName = String.Empty; | 205 | public string MasterAvatarLastName = String.Empty; |
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index e1e747a..0e09fa1 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs | |||
@@ -38,6 +38,14 @@ namespace OpenSim.Framework | |||
38 | public delegate void SaveDelegate(RegionSettings rs); | 38 | public delegate void SaveDelegate(RegionSettings rs); |
39 | 39 | ||
40 | public event SaveDelegate OnSave; | 40 | public event SaveDelegate OnSave; |
41 | |||
42 | /// <value> | ||
43 | /// These appear to be terrain textures that are shipped with the client. | ||
44 | /// </value> | ||
45 | public static readonly UUID DEFAULT_TERRAIN_TEXTURE_1 = new UUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | ||
46 | public static readonly UUID DEFAULT_TERRAIN_TEXTURE_2 = new UUID("abb783e6-3e93-26c0-248a-247666855da3"); | ||
47 | public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); | ||
48 | public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); | ||
41 | 49 | ||
42 | public RegionSettings() | 50 | public RegionSettings() |
43 | { | 51 | { |
@@ -74,19 +82,19 @@ namespace OpenSim.Framework | |||
74 | 82 | ||
75 | configMember.addConfigurationOption("terrain_base_0", | 83 | configMember.addConfigurationOption("terrain_base_0", |
76 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, | 84 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, |
77 | String.Empty, "b8d3965a-ad78-bf43-699b-bff8eca6c975",true); | 85 | String.Empty, DEFAULT_TERRAIN_TEXTURE_1.ToString(), true); |
78 | 86 | ||
79 | configMember.addConfigurationOption("terrain_base_1", | 87 | configMember.addConfigurationOption("terrain_base_1", |
80 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, | 88 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, |
81 | String.Empty, "abb783e6-3e93-26c0-248a-247666855da3",true); | 89 | String.Empty, DEFAULT_TERRAIN_TEXTURE_2.ToString(), true); |
82 | 90 | ||
83 | configMember.addConfigurationOption("terrain_base_2", | 91 | configMember.addConfigurationOption("terrain_base_2", |
84 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, | 92 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, |
85 | String.Empty, "179cdabd-398a-9b6b-1391-4dc333ba321f",true); | 93 | String.Empty, DEFAULT_TERRAIN_TEXTURE_3.ToString(), true); |
86 | 94 | ||
87 | configMember.addConfigurationOption("terrain_base_3", | 95 | configMember.addConfigurationOption("terrain_base_3", |
88 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, | 96 | ConfigurationOption.ConfigurationTypes.TYPE_UUID, |
89 | String.Empty, "beb169c7-11ea-fff2-efe5-0f24dc881df2",true); | 97 | String.Empty, DEFAULT_TERRAIN_TEXTURE_4.ToString(), true); |
90 | 98 | ||
91 | configMember.addConfigurationOption("terrain_start_height_0", | 99 | configMember.addConfigurationOption("terrain_start_height_0", |
92 | ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, | 100 | ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, |
@@ -361,7 +369,7 @@ namespace OpenSim.Framework | |||
361 | set | 369 | set |
362 | { | 370 | { |
363 | if (value == UUID.Zero) | 371 | if (value == UUID.Zero) |
364 | m_TerrainTexture1 = new UUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | 372 | m_TerrainTexture1 = DEFAULT_TERRAIN_TEXTURE_1; |
365 | else | 373 | else |
366 | m_TerrainTexture1 = value; | 374 | m_TerrainTexture1 = value; |
367 | } | 375 | } |
@@ -375,7 +383,7 @@ namespace OpenSim.Framework | |||
375 | set | 383 | set |
376 | { | 384 | { |
377 | if (value == UUID.Zero) | 385 | if (value == UUID.Zero) |
378 | m_TerrainTexture2 = new UUID("abb783e6-3e93-26c0-248a-247666855da3"); | 386 | m_TerrainTexture2 = DEFAULT_TERRAIN_TEXTURE_2; |
379 | else | 387 | else |
380 | m_TerrainTexture2 = value; | 388 | m_TerrainTexture2 = value; |
381 | } | 389 | } |
@@ -389,7 +397,7 @@ namespace OpenSim.Framework | |||
389 | set | 397 | set |
390 | { | 398 | { |
391 | if (value == UUID.Zero) | 399 | if (value == UUID.Zero) |
392 | m_TerrainTexture3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); | 400 | m_TerrainTexture3 = DEFAULT_TERRAIN_TEXTURE_3; |
393 | else | 401 | else |
394 | m_TerrainTexture3 = value; | 402 | m_TerrainTexture3 = value; |
395 | } | 403 | } |
@@ -403,7 +411,7 @@ namespace OpenSim.Framework | |||
403 | set | 411 | set |
404 | { | 412 | { |
405 | if (value == UUID.Zero) | 413 | if (value == UUID.Zero) |
406 | m_TerrainTexture4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); | 414 | m_TerrainTexture4 = DEFAULT_TERRAIN_TEXTURE_4; |
407 | else | 415 | else |
408 | m_TerrainTexture4 = value; | 416 | m_TerrainTexture4 = value; |
409 | } | 417 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/IEstateModule.cs b/OpenSim/Region/Environment/Interfaces/IEstateModule.cs index 70c5800..8e393bb 100644 --- a/OpenSim/Region/Environment/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IEstateModule.cs | |||
@@ -35,5 +35,10 @@ namespace OpenSim.Region.Environment.Interfaces | |||
35 | { | 35 | { |
36 | uint GetRegionFlags(); | 36 | uint GetRegionFlags(); |
37 | bool IsManager(UUID avatarID); | 37 | bool IsManager(UUID avatarID); |
38 | |||
39 | /// <summary> | ||
40 | /// Tell all clients about the current state of the region (terrain textures, water height, etc.) | ||
41 | /// </summary> | ||
42 | void sendRegionHandshakeToAll(); | ||
38 | } | 43 | } |
39 | } | 44 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs index b2e006a..4151c88 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs | |||
@@ -59,6 +59,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
59 | /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. | 59 | /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out. |
60 | /// </summary> | 60 | /// </summary> |
61 | public static readonly string TERRAINS_PATH = "terrains/"; | 61 | public static readonly string TERRAINS_PATH = "terrains/"; |
62 | |||
63 | /// <summary> | ||
64 | /// Path for region settings. | ||
65 | /// </summary> | ||
66 | public static readonly string SETTINGS_PATH = "settings/"; | ||
62 | 67 | ||
63 | /// <summary> | 68 | /// <summary> |
64 | /// The character the separates the uuid from extension information in an archived asset filename | 69 | /// The character the separates the uuid from extension information in an archived asset filename |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index e04662f..a5b5917 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -69,6 +69,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
69 | 69 | ||
70 | private void DearchiveRegion() | 70 | private void DearchiveRegion() |
71 | { | 71 | { |
72 | // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions | ||
73 | DearchiveRegion0DotStar(); | ||
74 | } | ||
75 | |||
76 | private void DearchiveRegion0DotStar() | ||
77 | { | ||
72 | TarArchiveReader archive | 78 | TarArchiveReader archive |
73 | = new TarArchiveReader( | 79 | = new TarArchiveReader( |
74 | new GZipStream(GetStream(m_loadPath), CompressionMode.Decompress)); | 80 | new GZipStream(GetStream(m_loadPath), CompressionMode.Decompress)); |
@@ -107,6 +113,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
107 | { | 113 | { |
108 | LoadTerrain(filePath, data); | 114 | LoadTerrain(filePath, data); |
109 | } | 115 | } |
116 | else if (filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) | ||
117 | { | ||
118 | LoadRegionSettings(filePath, data); | ||
119 | } | ||
110 | } | 120 | } |
111 | 121 | ||
112 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); | 122 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); |
@@ -267,6 +277,68 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
267 | return false; | 277 | return false; |
268 | } | 278 | } |
269 | } | 279 | } |
280 | |||
281 | /// <summary> | ||
282 | /// Load region settings data | ||
283 | /// </summary> | ||
284 | /// <param name="settingsPath"></param> | ||
285 | /// <param name="data"></param> | ||
286 | /// <returns> | ||
287 | /// true if settings were loaded successfully, false otherwise | ||
288 | /// </returns> | ||
289 | private bool LoadRegionSettings(string settingsPath, byte[] data) | ||
290 | { | ||
291 | RegionSettings loadedRegionSettings; | ||
292 | |||
293 | try | ||
294 | { | ||
295 | loadedRegionSettings = RegionSettingsSerializer.Deserialize(data); | ||
296 | } | ||
297 | catch (Exception e) | ||
298 | { | ||
299 | m_log.ErrorFormat( | ||
300 | "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", | ||
301 | settingsPath, e); | ||
302 | return false; | ||
303 | } | ||
304 | |||
305 | RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; | ||
306 | |||
307 | currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit; | ||
308 | currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage; | ||
309 | currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide; | ||
310 | currentRegionSettings.AllowLandResell = loadedRegionSettings.AllowLandResell; | ||
311 | currentRegionSettings.BlockFly = loadedRegionSettings.BlockFly; | ||
312 | currentRegionSettings.BlockShowInSearch = loadedRegionSettings.BlockShowInSearch; | ||
313 | currentRegionSettings.BlockTerraform = loadedRegionSettings.BlockTerraform; | ||
314 | currentRegionSettings.DisableCollisions = loadedRegionSettings.DisableCollisions; | ||
315 | currentRegionSettings.DisablePhysics = loadedRegionSettings.DisablePhysics; | ||
316 | currentRegionSettings.DisableScripts = loadedRegionSettings.DisableScripts; | ||
317 | currentRegionSettings.Elevation1NE = loadedRegionSettings.Elevation1NE; | ||
318 | currentRegionSettings.Elevation1NW = loadedRegionSettings.Elevation1NW; | ||
319 | currentRegionSettings.Elevation1SE = loadedRegionSettings.Elevation1SE; | ||
320 | currentRegionSettings.Elevation1SW = loadedRegionSettings.Elevation1SW; | ||
321 | currentRegionSettings.Elevation2NE = loadedRegionSettings.Elevation2NE; | ||
322 | currentRegionSettings.Elevation2NW = loadedRegionSettings.Elevation2NW; | ||
323 | currentRegionSettings.Elevation2SE = loadedRegionSettings.Elevation2SE; | ||
324 | currentRegionSettings.Elevation2SW = loadedRegionSettings.Elevation2SW; | ||
325 | currentRegionSettings.FixedSun = loadedRegionSettings.FixedSun; | ||
326 | currentRegionSettings.ObjectBonus = loadedRegionSettings.ObjectBonus; | ||
327 | currentRegionSettings.RestrictPushing = loadedRegionSettings.RestrictPushing; | ||
328 | currentRegionSettings.TerrainLowerLimit = loadedRegionSettings.TerrainLowerLimit; | ||
329 | currentRegionSettings.TerrainRaiseLimit = loadedRegionSettings.TerrainRaiseLimit; | ||
330 | currentRegionSettings.TerrainTexture1 = loadedRegionSettings.TerrainTexture1; | ||
331 | currentRegionSettings.TerrainTexture2 = loadedRegionSettings.TerrainTexture2; | ||
332 | currentRegionSettings.TerrainTexture3 = loadedRegionSettings.TerrainTexture3; | ||
333 | currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; | ||
334 | currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; | ||
335 | currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; | ||
336 | |||
337 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | ||
338 | estateModule.sendRegionHandshakeToAll(); | ||
339 | |||
340 | return true; | ||
341 | } | ||
270 | 342 | ||
271 | /// <summary> | 343 | /// <summary> |
272 | /// Load terrain data | 344 | /// Load terrain data |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs index 73fa5d2..b410e55 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -56,20 +56,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
56 | protected ITerrainModule m_terrainModule; | 56 | protected ITerrainModule m_terrainModule; |
57 | protected IRegionSerialiserModule m_serialiser; | 57 | protected IRegionSerialiserModule m_serialiser; |
58 | protected List<SceneObjectGroup> m_sceneObjects; | 58 | protected List<SceneObjectGroup> m_sceneObjects; |
59 | protected string m_sceneName; | 59 | protected RegionInfo m_regionInfo; |
60 | protected string m_savePath; | 60 | protected string m_savePath; |
61 | 61 | ||
62 | public ArchiveWriteRequestExecution( | 62 | public ArchiveWriteRequestExecution( |
63 | List<SceneObjectGroup> sceneObjects, | 63 | List<SceneObjectGroup> sceneObjects, |
64 | ITerrainModule terrainModule, | 64 | ITerrainModule terrainModule, |
65 | IRegionSerialiserModule serialiser, | 65 | IRegionSerialiserModule serialiser, |
66 | string sceneName, | 66 | RegionInfo regionInfo, |
67 | string savePath) | 67 | string savePath) |
68 | { | 68 | { |
69 | m_sceneObjects = sceneObjects; | 69 | m_sceneObjects = sceneObjects; |
70 | m_terrainModule = terrainModule; | 70 | m_terrainModule = terrainModule; |
71 | m_serialiser = serialiser; | 71 | m_serialiser = serialiser; |
72 | m_sceneName = sceneName; | 72 | m_regionInfo = regionInfo; |
73 | m_savePath = savePath; | 73 | m_savePath = savePath; |
74 | } | 74 | } |
75 | 75 | ||
@@ -90,9 +90,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
90 | 90 | ||
91 | // Write out control file | 91 | // Write out control file |
92 | archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile()); | 92 | archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile()); |
93 | |||
94 | // Write out region settings | ||
95 | string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_regionInfo.RegionName); | ||
96 | archive.AddFile(settingsPath, RegionSettingsSerializer.Serialize(m_regionInfo.RegionSettings)); | ||
93 | 97 | ||
94 | // Write out terrain | 98 | // Write out terrain |
95 | string terrainPath = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_sceneName); | 99 | string terrainPath = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_regionInfo.RegionName); |
96 | MemoryStream ms = new MemoryStream(); | 100 | MemoryStream ms = new MemoryStream(); |
97 | m_terrainModule.SaveToStream(terrainPath, ms); | 101 | m_terrainModule.SaveToStream(terrainPath, ms); |
98 | archive.AddFile(terrainPath, ms.ToArray()); | 102 | archive.AddFile(terrainPath, ms.ToArray()); |
@@ -137,7 +141,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
137 | xtw.WriteStartDocument(); | 141 | xtw.WriteStartDocument(); |
138 | xtw.WriteStartElement("archive"); | 142 | xtw.WriteStartElement("archive"); |
139 | xtw.WriteAttributeString("major_version", "0"); | 143 | xtw.WriteAttributeString("major_version", "0"); |
140 | xtw.WriteAttributeString("minor_version", "1"); | 144 | xtw.WriteAttributeString("minor_version", "2"); |
141 | xtw.WriteEndElement(); | 145 | xtw.WriteEndElement(); |
142 | 146 | ||
143 | xtw.Flush(); | 147 | xtw.Flush(); |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs index 58e8f55..7c1d015 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -204,9 +204,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
204 | 204 | ||
205 | // Get the prim's default texture. This will be used for faces which don't have their own texture | 205 | // Get the prim's default texture. This will be used for faces which don't have their own texture |
206 | assetUuids[textureEntry.DefaultTexture.TextureID] = 1; | 206 | assetUuids[textureEntry.DefaultTexture.TextureID] = 1; |
207 | 207 | ||
208 | if (part.Shape.SculptTexture != UUID.Zero) | ||
209 | assetUuids[part.Shape.SculptTexture] = 1; | ||
210 | // XXX: Not a great way to iterate through face textures, but there's no | 208 | // XXX: Not a great way to iterate through face textures, but there's no |
211 | // other method available to tell how many faces there actually are | 209 | // other method available to tell how many faces there actually are |
212 | //int i = 0; | 210 | //int i = 0; |
@@ -218,7 +216,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
218 | assetUuids[texture.TextureID] = 1; | 216 | assetUuids[texture.TextureID] = 1; |
219 | } | 217 | } |
220 | } | 218 | } |
219 | |||
220 | // If the prim is a sculpt then preserve this information too | ||
221 | if (part.Shape.SculptTexture != UUID.Zero) | ||
222 | assetUuids[part.Shape.SculptTexture] = 1; | ||
221 | 223 | ||
224 | // Now analyze this prim's inventory items to preserve all the uuids that they reference | ||
222 | foreach (TaskInventoryItem tii in part.TaskInventory.Values) | 225 | foreach (TaskInventoryItem tii in part.TaskInventory.Values) |
223 | { | 226 | { |
224 | //m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type); | 227 | //m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type); |
@@ -239,10 +242,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
239 | { | 242 | { |
240 | GetSceneObjectAssetUuids(tii.AssetID, assetUuids); | 243 | GetSceneObjectAssetUuids(tii.AssetID, assetUuids); |
241 | } | 244 | } |
242 | else | 245 | //else |
243 | { | 246 | //{ |
244 | //m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tii.AssetID, part.UUID); | 247 | //m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tii.AssetID, part.UUID); |
245 | } | 248 | //} |
246 | } | 249 | } |
247 | } | 250 | } |
248 | } | 251 | } |
@@ -283,6 +286,21 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
283 | m_log.DebugFormat( | 286 | m_log.DebugFormat( |
284 | "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets", | 287 | "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets", |
285 | sceneObjects.Count, assetUuids.Count); | 288 | sceneObjects.Count, assetUuids.Count); |
289 | |||
290 | // Make sure that we also request terrain texture assets | ||
291 | RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings; | ||
292 | |||
293 | if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1) | ||
294 | assetUuids[regionSettings.TerrainTexture1] = 1; | ||
295 | |||
296 | if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2) | ||
297 | assetUuids[regionSettings.TerrainTexture2] = 1; | ||
298 | |||
299 | if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3) | ||
300 | assetUuids[regionSettings.TerrainTexture3] = 1; | ||
301 | |||
302 | if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4) | ||
303 | assetUuids[regionSettings.TerrainTexture4] = 1; | ||
286 | 304 | ||
287 | // Asynchronously request all the assets required to perform this archive operation | 305 | // Asynchronously request all the assets required to perform this archive operation |
288 | ArchiveWriteRequestExecution awre | 306 | ArchiveWriteRequestExecution awre |
@@ -290,8 +308,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
290 | sceneObjects, | 308 | sceneObjects, |
291 | m_scene.RequestModuleInterface<ITerrainModule>(), | 309 | m_scene.RequestModuleInterface<ITerrainModule>(), |
292 | m_scene.RequestModuleInterface<IRegionSerialiserModule>(), | 310 | m_scene.RequestModuleInterface<IRegionSerialiserModule>(), |
293 | m_scene.RegionInfo.RegionName, | 311 | m_scene.RegionInfo, |
294 | m_savePath); | 312 | m_savePath); |
313 | |||
295 | new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute(); | 314 | new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute(); |
296 | } | 315 | } |
297 | } | 316 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/RegionSettingsSerializer.cs b/OpenSim/Region/Environment/Modules/World/Archiver/RegionSettingsSerializer.cs new file mode 100644 index 0000000..e12d0ec --- /dev/null +++ b/OpenSim/Region/Environment/Modules/World/Archiver/RegionSettingsSerializer.cs | |||
@@ -0,0 +1,258 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Text; | ||
31 | using System.Xml; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | |||
35 | namespace OpenSim.Region.Environment.Modules.World.Archiver | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// Serialize and deserialize region settings for an archive file format. | ||
39 | /// </summary> | ||
40 | /// We didn't simply use automatic .NET serializagion for OpenSim.Framework.RegionSettings since this is really | ||
41 | /// a file format rather than an object serialization. | ||
42 | /// TODO: However, we could still have used separate non-framework classes here to read and write the xml | ||
43 | /// automatically rather than laboriously doing it by hand using XmlTextReader and Writer. Should switch to this | ||
44 | /// in the future. | ||
45 | public class RegionSettingsSerializer | ||
46 | { | ||
47 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Deserialize region settings | ||
51 | /// </summary> | ||
52 | /// <param name="serializedSettings"></param> | ||
53 | /// <returns></returns> | ||
54 | /// <exception cref="System.Xml.XmlException"></exception> | ||
55 | public static RegionSettings Deserialize(byte[] serializedSettings) | ||
56 | { | ||
57 | return Deserialize(m_asciiEncoding.GetString(serializedSettings, 0, serializedSettings.Length)); | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Deserialize region settings | ||
62 | /// </summary> | ||
63 | /// <param name="serializedSettings"></param> | ||
64 | /// <returns></returns> | ||
65 | /// <exception cref="System.Xml.XmlException"></exception> | ||
66 | public static RegionSettings Deserialize(string serializedSettings) | ||
67 | { | ||
68 | RegionSettings settings = new RegionSettings(); | ||
69 | |||
70 | StringReader sr = new StringReader(serializedSettings); | ||
71 | XmlTextReader xtr = new XmlTextReader(sr); | ||
72 | |||
73 | xtr.ReadStartElement("RegionSettings"); | ||
74 | |||
75 | xtr.ReadStartElement("General"); | ||
76 | |||
77 | while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) | ||
78 | { | ||
79 | switch (xtr.Name) | ||
80 | { | ||
81 | case "AllowDamage": | ||
82 | settings.AllowDamage = bool.Parse(xtr.ReadElementContentAsString()); | ||
83 | break; | ||
84 | case "AllowLandResell": | ||
85 | settings.AllowLandResell = bool.Parse(xtr.ReadElementContentAsString()); | ||
86 | break; | ||
87 | case "AllowLandJoinDivide": | ||
88 | settings.AllowLandJoinDivide = bool.Parse(xtr.ReadElementContentAsString()); | ||
89 | break; | ||
90 | case "BlockFly": | ||
91 | settings.BlockFly = bool.Parse(xtr.ReadElementContentAsString()); | ||
92 | break; | ||
93 | case "BlockLandShowInSearch": | ||
94 | settings.BlockShowInSearch = bool.Parse(xtr.ReadElementContentAsString()); | ||
95 | break; | ||
96 | case "BlockTerraform": | ||
97 | settings.BlockTerraform = bool.Parse(xtr.ReadElementContentAsString()); | ||
98 | break; | ||
99 | case "DisableCollisions": | ||
100 | settings.DisableCollisions = bool.Parse(xtr.ReadElementContentAsString()); | ||
101 | break; | ||
102 | case "DisablePhysics": | ||
103 | settings.DisablePhysics = bool.Parse(xtr.ReadElementContentAsString()); | ||
104 | break; | ||
105 | case "DisableScripts": | ||
106 | settings.DisableScripts = bool.Parse(xtr.ReadElementContentAsString()); | ||
107 | break; | ||
108 | case "MaturityRating": | ||
109 | settings.Maturity = int.Parse(xtr.ReadElementContentAsString()); | ||
110 | break; | ||
111 | case "RestrictPushing": | ||
112 | settings.RestrictPushing = bool.Parse(xtr.ReadElementContentAsString()); | ||
113 | break; | ||
114 | case "AgentLimit": | ||
115 | settings.AgentLimit = int.Parse(xtr.ReadElementContentAsString()); | ||
116 | break; | ||
117 | case "ObjectBonus": | ||
118 | settings.ObjectBonus = double.Parse(xtr.ReadElementContentAsString()); | ||
119 | break; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | xtr.ReadEndElement(); | ||
124 | xtr.ReadStartElement("GroundTextures"); | ||
125 | |||
126 | while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) | ||
127 | { | ||
128 | switch (xtr.Name) | ||
129 | { | ||
130 | case "Texture1": | ||
131 | settings.TerrainTexture1 = UUID.Parse(xtr.ReadElementContentAsString()); | ||
132 | break; | ||
133 | case "Texture2": | ||
134 | settings.TerrainTexture2 = UUID.Parse(xtr.ReadElementContentAsString()); | ||
135 | break; | ||
136 | case "Texture3": | ||
137 | settings.TerrainTexture3 = UUID.Parse(xtr.ReadElementContentAsString()); | ||
138 | break; | ||
139 | case "Texture4": | ||
140 | settings.TerrainTexture4 = UUID.Parse(xtr.ReadElementContentAsString()); | ||
141 | break; | ||
142 | case "ElevationLowSW": | ||
143 | settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString()); | ||
144 | break; | ||
145 | case "ElevationLowNW": | ||
146 | settings.Elevation1NW = double.Parse(xtr.ReadElementContentAsString()); | ||
147 | break; | ||
148 | case "ElevationLowSE": | ||
149 | settings.Elevation1SE = double.Parse(xtr.ReadElementContentAsString()); | ||
150 | break; | ||
151 | case "ElevationLowNE": | ||
152 | settings.Elevation1NE = double.Parse(xtr.ReadElementContentAsString()); | ||
153 | break; | ||
154 | case "ElevationHighSW": | ||
155 | settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString()); | ||
156 | break; | ||
157 | case "ElevationHighNW": | ||
158 | settings.Elevation2NW = double.Parse(xtr.ReadElementContentAsString()); | ||
159 | break; | ||
160 | case "ElevationHighSE": | ||
161 | settings.Elevation2SE = double.Parse(xtr.ReadElementContentAsString()); | ||
162 | break; | ||
163 | case "ElevationHighNE": | ||
164 | settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString()); | ||
165 | break; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | xtr.ReadEndElement(); | ||
170 | xtr.ReadStartElement("Terrain"); | ||
171 | |||
172 | while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) | ||
173 | { | ||
174 | switch (xtr.Name) | ||
175 | { | ||
176 | case "WaterHeight": | ||
177 | settings.WaterHeight = double.Parse(xtr.ReadElementContentAsString()); | ||
178 | break; | ||
179 | case "TerrainRaiseLimit": | ||
180 | settings.TerrainRaiseLimit = double.Parse(xtr.ReadElementContentAsString()); | ||
181 | break; | ||
182 | case "TerrainLowerLimit": | ||
183 | settings.TerrainLowerLimit = double.Parse(xtr.ReadElementContentAsString()); | ||
184 | break; | ||
185 | case "UseEstateSun": | ||
186 | settings.UseEstateSun = bool.Parse(xtr.ReadElementContentAsString()); | ||
187 | break; | ||
188 | case "FixedSun": | ||
189 | settings.FixedSun = bool.Parse(xtr.ReadElementContentAsString()); | ||
190 | break; | ||
191 | } | ||
192 | } | ||
193 | |||
194 | xtr.Close(); | ||
195 | sr.Close(); | ||
196 | |||
197 | return settings; | ||
198 | } | ||
199 | |||
200 | public static string Serialize(RegionSettings settings) | ||
201 | { | ||
202 | StringWriter sw = new StringWriter(); | ||
203 | XmlTextWriter xtw = new XmlTextWriter(sw); | ||
204 | xtw.Formatting = Formatting.Indented; | ||
205 | xtw.WriteStartDocument(); | ||
206 | |||
207 | xtw.WriteStartElement("RegionSettings"); | ||
208 | |||
209 | xtw.WriteStartElement("General"); | ||
210 | xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString()); | ||
211 | xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString()); | ||
212 | xtw.WriteElementString("AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString()); | ||
213 | xtw.WriteElementString("BlockFly", settings.BlockFly.ToString()); | ||
214 | xtw.WriteElementString("BlockLandShowInSearch", settings.BlockShowInSearch.ToString()); | ||
215 | xtw.WriteElementString("BlockTerraform", settings.BlockTerraform.ToString()); | ||
216 | xtw.WriteElementString("DisableCollisions", settings.DisableCollisions.ToString()); | ||
217 | xtw.WriteElementString("DisablePhysics", settings.DisablePhysics.ToString()); | ||
218 | xtw.WriteElementString("DisableScripts", settings.DisableScripts.ToString()); | ||
219 | xtw.WriteElementString("MaturityRating", settings.Maturity.ToString()); | ||
220 | xtw.WriteElementString("RestrictPushing", settings.RestrictPushing.ToString()); | ||
221 | xtw.WriteElementString("AgentLimit", settings.AgentLimit.ToString()); | ||
222 | xtw.WriteElementString("ObjectBonus", settings.ObjectBonus.ToString()); | ||
223 | xtw.WriteEndElement(); | ||
224 | |||
225 | xtw.WriteStartElement("GroundTextures"); | ||
226 | xtw.WriteElementString("Texture1", settings.TerrainTexture1.ToString()); | ||
227 | xtw.WriteElementString("Texture2", settings.TerrainTexture2.ToString()); | ||
228 | xtw.WriteElementString("Texture3", settings.TerrainTexture3.ToString()); | ||
229 | xtw.WriteElementString("Texture4", settings.TerrainTexture4.ToString()); | ||
230 | xtw.WriteElementString("ElevationLowSW", settings.Elevation1SW.ToString()); | ||
231 | xtw.WriteElementString("ElevationLowNW", settings.Elevation1NW.ToString()); | ||
232 | xtw.WriteElementString("ElevationLowSE", settings.Elevation1SE.ToString()); | ||
233 | xtw.WriteElementString("ElevationLowNE", settings.Elevation1NE.ToString()); | ||
234 | xtw.WriteElementString("ElevationHighSW", settings.Elevation2SW.ToString()); | ||
235 | xtw.WriteElementString("ElevationHighNW", settings.Elevation2NW.ToString()); | ||
236 | xtw.WriteElementString("ElevationHighSE", settings.Elevation2SE.ToString()); | ||
237 | xtw.WriteElementString("ElevationHighNE", settings.Elevation2NE.ToString()); | ||
238 | xtw.WriteEndElement(); | ||
239 | |||
240 | xtw.WriteStartElement("Terrain"); | ||
241 | xtw.WriteElementString("WaterHeight", settings.WaterHeight.ToString()); | ||
242 | xtw.WriteElementString("TerrainRaiseLimit", settings.TerrainRaiseLimit.ToString()); | ||
243 | xtw.WriteElementString("TerrainLowerLimit", settings.TerrainLowerLimit.ToString()); | ||
244 | xtw.WriteElementString("UseEstateSun", settings.UseEstateSun.ToString()); | ||
245 | xtw.WriteElementString("FixedSun", settings.FixedSun.ToString()); | ||
246 | // XXX: Need to expose interface to get sun phase information from sun module | ||
247 | // xtw.WriteStartElement("SunPhase", | ||
248 | xtw.WriteEndElement(); | ||
249 | |||
250 | xtw.WriteEndElement(); | ||
251 | |||
252 | xtw.Close(); | ||
253 | sw.Close(); | ||
254 | |||
255 | return sw.ToString(); | ||
256 | } | ||
257 | } | ||
258 | } | ||
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs index 83b9250..d4a8a46 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs | |||
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Environment | |||
43 | 43 | ||
44 | protected Dictionary<string, byte[]> m_files = new Dictionary<string, byte[]>(); | 44 | protected Dictionary<string, byte[]> m_files = new Dictionary<string, byte[]>(); |
45 | 45 | ||
46 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); | 46 | protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); |
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | /// Add a directory to the tar archive. We can only handle one path level right now! | 49 | /// Add a directory to the tar archive. We can only handle one path level right now! |
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 7945815..14450ae 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | |||
@@ -562,7 +562,6 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
562 | 562 | ||
563 | private void HandleRegionInfoRequest(IClientAPI remote_client) | 563 | private void HandleRegionInfoRequest(IClientAPI remote_client) |
564 | { | 564 | { |
565 | |||
566 | RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); | 565 | RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); |
567 | args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; | 566 | args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor; |
568 | args.estateID = m_scene.RegionInfo.EstateSettings.EstateID; | 567 | args.estateID = m_scene.RegionInfo.EstateSettings.EstateID; |
@@ -754,9 +753,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
754 | 753 | ||
755 | public void sendRegionHandshakeToAll() | 754 | public void sendRegionHandshakeToAll() |
756 | { | 755 | { |
757 | m_scene.Broadcast( | 756 | m_scene.Broadcast(sendRegionHandshake); |
758 | sendRegionHandshake | ||
759 | ); | ||
760 | } | 757 | } |
761 | 758 | ||
762 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) | 759 | public void handleEstateChangeInfo(IClientAPI remoteClient, UUID invoice, UUID senderID, UInt32 parms1, UInt32 parms2) |
diff --git a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs index 318afa1..3f82190 100644 --- a/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Sun/SunModule.cs | |||
@@ -223,7 +223,6 @@ namespace OpenSim.Region.Environment.Modules | |||
223 | // Insert our event handling hooks | 223 | // Insert our event handling hooks |
224 | 224 | ||
225 | scene.EventManager.OnFrame += SunUpdate; | 225 | scene.EventManager.OnFrame += SunUpdate; |
226 | //scene.EventManager.OnNewClient += SunToClient; | ||
227 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | 226 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; |
228 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 227 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
229 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 228 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
@@ -248,9 +247,9 @@ namespace OpenSim.Region.Environment.Modules | |||
248 | public void Close() | 247 | public void Close() |
249 | { | 248 | { |
250 | ready = false; | 249 | ready = false; |
251 | // Remove our hooks | 250 | |
251 | // Remove our hooks | ||
252 | m_scene.EventManager.OnFrame -= SunUpdate; | 252 | m_scene.EventManager.OnFrame -= SunUpdate; |
253 | // m_scene.EventManager.OnNewClient -= SunToClient; | ||
254 | m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; | 253 | m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; |
255 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; | 254 | m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; |
256 | m_scene.EventManager.OnClientClosed -= ClientLoggedOut; | 255 | m_scene.EventManager.OnClientClosed -= ClientLoggedOut; |