aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-12 02:36:56 +0100
committerJustin Clark-Casey (justincc)2012-05-12 02:36:56 +0100
commit8b958e7e74d8e4b462c6a59c2854c5072ff8c746 (patch)
tree391e872861713771078d6706fe49b16b94ece9ff /OpenSim
parentSave the Telehub and its Spawn Points in the OAR (diff)
downloadopensim-SC_OLD-8b958e7e74d8e4b462c6a59c2854c5072ff8c746.zip
opensim-SC_OLD-8b958e7e74d8e4b462c6a59c2854c5072ff8c746.tar.gz
opensim-SC_OLD-8b958e7e74d8e4b462c6a59c2854c5072ff8c746.tar.bz2
opensim-SC_OLD-8b958e7e74d8e4b462c6a59c2854c5072ff8c746.tar.xz
Revert "Save the Telehub and its Spawn Points in the OAR"
This reverts commit b0b7b45b943dd94546bcfcf5d3bb871cfe35b507. Sorry BlueWall, I wanted to discuss an aspect of the data storage but I couldn't assign bugs in 'patch included' state to myself until I changed mantis just now and I forgot to mention it on irc. I wouldn't normally revert but thinks get tricky when it comes to data formats. Essentially, I would like to see the Yaw, Pitch and Distance values as separate XML entities (as used in other aspects such as vectors, quaternions) rather than as a . delimited string We can discuss this more with Oren in opensimulator.org/mantis/view.php?id=6008
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/RegionSettings.cs29
-rw-r--r--OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs37
-rw-r--r--OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs25
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs4
6 files changed, 5 insertions, 100 deletions
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index 011a97a..4ce3392 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using OpenMetaverse; 31using OpenMetaverse;
32using System.Runtime.Serialization;
33 32
34namespace OpenSim.Framework 33namespace OpenSim.Framework
35{ 34{
@@ -72,32 +71,6 @@ namespace OpenSim.Framework
72 71
73 return pos + offset; 72 return pos + offset;
74 } 73 }
75
76 /// <summary>
77 /// Returns a string representation of this SpawnPoint.
78 /// </summary>
79 /// <returns></returns>
80 public override string ToString()
81 {
82 return string.Format("{0},{1},{2}", Yaw, Pitch, Distance);
83 }
84
85 /// <summary>
86 /// Generate a SpawnPoint from a string
87 /// </summary>
88 /// <param name="str"></param>
89 public static SpawnPoint Parse(string str)
90 {
91 string[] parts = str.Split(',');
92 if (parts.Length != 3)
93 throw new ArgumentException("Invalid string: " + str);
94
95 SpawnPoint sp = new SpawnPoint();
96 sp.Yaw = float.Parse(parts[0]);
97 sp.Pitch = float.Parse(parts[1]);
98 sp.Distance = float.Parse(parts[2]);
99 return sp;
100 }
101 } 74 }
102 75
103 public class RegionSettings 76 public class RegionSettings
@@ -483,7 +456,7 @@ namespace OpenSim.Framework
483 } 456 }
484 457
485 // Connected Telehub object 458 // Connected Telehub object
486 private UUID m_TelehubObject = UUID.Zero; 459 private UUID m_TelehubObject;
487 public UUID TelehubObject 460 public UUID TelehubObject
488 { 461 {
489 get 462 get
diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
index f18435d..931898c 100644
--- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
@@ -30,8 +30,6 @@ using System.Text;
30using System.Xml; 30using System.Xml;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using log4net;
34using System.Reflection;
35 33
36namespace OpenSim.Framework.Serialization.External 34namespace OpenSim.Framework.Serialization.External
37{ 35{
@@ -189,29 +187,7 @@ namespace OpenSim.Framework.Serialization.External
189 break; 187 break;
190 } 188 }
191 } 189 }
192 190
193 xtr.ReadEndElement();
194
195 if (xtr.IsStartElement("Telehub"))
196 {
197 xtr.ReadStartElement("Telehub");
198
199 while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
200 {
201 switch (xtr.Name)
202 {
203 case "TelehubObject":
204 settings.TelehubObject = UUID.Parse(xtr.ReadElementContentAsString());
205 break;
206 case "SpawnPoint":
207 string str = xtr.ReadElementContentAsString();
208 SpawnPoint sp = SpawnPoint.Parse(str);
209 settings.AddSpawnPoint(sp);
210 break;
211 }
212 }
213 }
214
215 xtr.Close(); 191 xtr.Close();
216 sr.Close(); 192 sr.Close();
217 193
@@ -267,16 +243,7 @@ namespace OpenSim.Framework.Serialization.External
267 xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); 243 xtw.WriteElementString("SunPosition", settings.SunPosition.ToString());
268 // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which 244 // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which
269 // calculates it automatically according to the date and other factors. 245 // calculates it automatically according to the date and other factors.
270 xtw.WriteEndElement(); 246 xtw.WriteEndElement();
271
272 xtw.WriteStartElement("Telehub");
273 if (settings.TelehubObject != UUID.Zero)
274 {
275 xtw.WriteElementString("TelehubObject", settings.TelehubObject.ToString());
276 foreach (SpawnPoint sp in settings.SpawnPoints())
277 xtw.WriteElementString("SpawnPoint", sp.ToString());
278 }
279 xtw.WriteEndElement();
280 247
281 xtw.WriteEndElement(); 248 xtw.WriteEndElement();
282 249
diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
index 09b6f6d..a61e4af 100644
--- a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
+++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
@@ -78,10 +78,6 @@ namespace OpenSim.Framework.Serialization.Tests
78 <FixedSun>true</FixedSun> 78 <FixedSun>true</FixedSun>
79 <SunPosition>12</SunPosition> 79 <SunPosition>12</SunPosition>
80 </Terrain> 80 </Terrain>
81 <Telehub>
82 <TelehubObject>00000000-0000-0000-0000-111111111111</TelehubObject>
83 <SpawnPoint>1,-2,0.33</SpawnPoint>
84 </Telehub>
85</RegionSettings>"; 81</RegionSettings>";
86 82
87 private RegionSettings m_rs; 83 private RegionSettings m_rs;
@@ -120,8 +116,6 @@ namespace OpenSim.Framework.Serialization.Tests
120 m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); 116 m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
121 m_rs.UseEstateSun = true; 117 m_rs.UseEstateSun = true;
122 m_rs.WaterHeight = 23; 118 m_rs.WaterHeight = 23;
123 m_rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111");
124 m_rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33"));
125 } 119 }
126 120
127 [Test] 121 [Test]
@@ -135,8 +129,6 @@ namespace OpenSim.Framework.Serialization.Tests
135 Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); 129 Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
136 Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); 130 Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));
137 Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); 131 Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit));
138 Assert.That(deserRs.TelehubObject, Is.EqualTo(m_rs.TelehubObject));
139 Assert.That(deserRs.SpawnPoints()[0].ToString(), Is.EqualTo(m_rs.SpawnPoints()[0].ToString()));
140 } 132 }
141 } 133 }
142} 134}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index bf0ff75..a6dbaba 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -245,8 +245,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
245 // Reload serialized prims 245 // Reload serialized prims
246 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); 246 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
247 247
248 UUID oldTelehubUUID = m_scene.RegionInfo.RegionSettings.TelehubObject;
249
250 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); 248 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>();
251 int sceneObjectsLoadedCount = 0; 249 int sceneObjectsLoadedCount = 0;
252 250
@@ -268,21 +266,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
268 266
269 SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); 267 SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject);
270 268
271 bool isTelehub = (sceneObject.UUID == oldTelehubUUID);
272
273 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned 269 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
274 // on the same region server and multiple examples a single object archive to be imported 270 // on the same region server and multiple examples a single object archive to be imported
275 // to the same scene (when this is possible). 271 // to the same scene (when this is possible).
276 sceneObject.ResetIDs(); 272 sceneObject.ResetIDs();
277 273
278 if (isTelehub)
279 {
280 // Change the Telehub Object to the new UUID
281 m_scene.RegionInfo.RegionSettings.TelehubObject = sceneObject.UUID;
282 m_scene.RegionInfo.RegionSettings.Save();
283 oldTelehubUUID = UUID.Zero;
284 }
285
286 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid 274 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
287 // or creator data is present. Otherwise, use the estate owner instead. 275 // or creator data is present. Otherwise, use the estate owner instead.
288 foreach (SceneObjectPart part in sceneObject.Parts) 276 foreach (SceneObjectPart part in sceneObject.Parts)
@@ -341,14 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
341 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount; 329 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount;
342 330
343 if (ignoredObjects > 0) 331 if (ignoredObjects > 0)
344 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); 332 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects);
345
346 if (oldTelehubUUID != UUID.Zero)
347 {
348 m_log.WarnFormat("Telehub object not found: {0}", oldTelehubUUID);
349 m_scene.RegionInfo.RegionSettings.TelehubObject = UUID.Zero;
350 m_scene.RegionInfo.RegionSettings.ClearSpawnPoints();
351 }
352 } 333 }
353 334
354 /// <summary> 335 /// <summary>
@@ -524,10 +505,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
524 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; 505 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
525 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; 506 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
526 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; 507 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
527 currentRegionSettings.TelehubObject = loadedRegionSettings.TelehubObject;
528 currentRegionSettings.ClearSpawnPoints();
529 foreach (SpawnPoint sp in loadedRegionSettings.SpawnPoints())
530 currentRegionSettings.AddSpawnPoint(sp);
531 508
532 currentRegionSettings.Save(); 509 currentRegionSettings.Save();
533 510
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 5679ad5..eabe46e 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -328,7 +328,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
328 /// <returns></returns> 328 /// <returns></returns>
329 public string CreateControlFile(Dictionary<string, object> options) 329 public string CreateControlFile(Dictionary<string, object> options)
330 { 330 {
331 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 8; 331 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 7;
332// 332//
333// if (options.ContainsKey("version")) 333// if (options.ContainsKey("version"))
334// { 334// {
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 394ca27..053c6f5 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -534,8 +534,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
534 rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); 534 rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
535 rs.UseEstateSun = true; 535 rs.UseEstateSun = true;
536 rs.WaterHeight = 23; 536 rs.WaterHeight = 23;
537 rs.TelehubObject = UUID.Parse("00000000-0000-0000-0000-111111111111");
538 rs.AddSpawnPoint(SpawnPoint.Parse("1,-2,0.33"));
539 537
540 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs)); 538 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs));
541 539
@@ -582,8 +580,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
582 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080"))); 580 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080")));
583 Assert.That(loadedRs.UseEstateSun, Is.True); 581 Assert.That(loadedRs.UseEstateSun, Is.True);
584 Assert.That(loadedRs.WaterHeight, Is.EqualTo(23)); 582 Assert.That(loadedRs.WaterHeight, Is.EqualTo(23));
585 Assert.AreEqual(UUID.Zero, loadedRs.TelehubObject); // because no object was found with the original UUID
586 Assert.AreEqual(0, loadedRs.SpawnPoints().Count);
587 } 583 }
588 584
589 /// <summary> 585 /// <summary>