aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorOren Hurvitz2012-05-03 19:38:35 +0300
committerBlueWall2012-05-10 22:56:37 -0400
commitb0b7b45b943dd94546bcfcf5d3bb871cfe35b507 (patch)
treeb9bcaa15a5a1c85a8779fc7ab0a1b648cc700e01 /OpenSim
parentPrint out more information on connecting bots (diff)
downloadopensim-SC-b0b7b45b943dd94546bcfcf5d3bb871cfe35b507.zip
opensim-SC-b0b7b45b943dd94546bcfcf5d3bb871cfe35b507.tar.gz
opensim-SC-b0b7b45b943dd94546bcfcf5d3bb871cfe35b507.tar.bz2
opensim-SC-b0b7b45b943dd94546bcfcf5d3bb871cfe35b507.tar.xz
Save the Telehub and its Spawn Points in the OAR
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
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, 100 insertions, 5 deletions
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index 4ce3392..011a97a 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using OpenMetaverse; 31using OpenMetaverse;
32using System.Runtime.Serialization;
32 33
33namespace OpenSim.Framework 34namespace OpenSim.Framework
34{ 35{
@@ -71,6 +72,32 @@ namespace OpenSim.Framework
71 72
72 return pos + offset; 73 return pos + offset;
73 } 74 }
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 }
74 } 101 }
75 102
76 public class RegionSettings 103 public class RegionSettings
@@ -456,7 +483,7 @@ namespace OpenSim.Framework
456 } 483 }
457 484
458 // Connected Telehub object 485 // Connected Telehub object
459 private UUID m_TelehubObject; 486 private UUID m_TelehubObject = UUID.Zero;
460 public UUID TelehubObject 487 public UUID TelehubObject
461 { 488 {
462 get 489 get
diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
index 931898c..f18435d 100644
--- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs
@@ -30,6 +30,8 @@ using System.Text;
30using System.Xml; 30using System.Xml;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using log4net;
34using System.Reflection;
33 35
34namespace OpenSim.Framework.Serialization.External 36namespace OpenSim.Framework.Serialization.External
35{ 37{
@@ -187,7 +189,29 @@ namespace OpenSim.Framework.Serialization.External
187 break; 189 break;
188 } 190 }
189 } 191 }
190 192
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
191 xtr.Close(); 215 xtr.Close();
192 sr.Close(); 216 sr.Close();
193 217
@@ -243,7 +267,16 @@ namespace OpenSim.Framework.Serialization.External
243 xtw.WriteElementString("SunPosition", settings.SunPosition.ToString()); 267 xtw.WriteElementString("SunPosition", settings.SunPosition.ToString());
244 // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which 268 // Note: 'SunVector' isn't saved because this value is owned by the Sun Module, which
245 // calculates it automatically according to the date and other factors. 269 // calculates it automatically according to the date and other factors.
246 xtw.WriteEndElement(); 270 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();
247 280
248 xtw.WriteEndElement(); 281 xtw.WriteEndElement();
249 282
diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
index a61e4af..09b6f6d 100644
--- a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
+++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs
@@ -78,6 +78,10 @@ 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>
81</RegionSettings>"; 85</RegionSettings>";
82 86
83 private RegionSettings m_rs; 87 private RegionSettings m_rs;
@@ -116,6 +120,8 @@ namespace OpenSim.Framework.Serialization.Tests
116 m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); 120 m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
117 m_rs.UseEstateSun = true; 121 m_rs.UseEstateSun = true;
118 m_rs.WaterHeight = 23; 122 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"));
119 } 125 }
120 126
121 [Test] 127 [Test]
@@ -129,6 +135,8 @@ namespace OpenSim.Framework.Serialization.Tests
129 Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); 135 Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2));
130 Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); 136 Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics));
131 Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); 137 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()));
132 } 140 }
133 } 141 }
134} 142}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index a6dbaba..bf0ff75 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -245,6 +245,8 @@ 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
248 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); 250 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>();
249 int sceneObjectsLoadedCount = 0; 251 int sceneObjectsLoadedCount = 0;
250 252
@@ -266,11 +268,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
266 268
267 SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); 269 SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject);
268 270
271 bool isTelehub = (sceneObject.UUID == oldTelehubUUID);
272
269 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned 273 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
270 // on the same region server and multiple examples a single object archive to be imported 274 // on the same region server and multiple examples a single object archive to be imported
271 // to the same scene (when this is possible). 275 // to the same scene (when this is possible).
272 sceneObject.ResetIDs(); 276 sceneObject.ResetIDs();
273 277
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
274 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid 286 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
275 // or creator data is present. Otherwise, use the estate owner instead. 287 // or creator data is present. Otherwise, use the estate owner instead.
276 foreach (SceneObjectPart part in sceneObject.Parts) 288 foreach (SceneObjectPart part in sceneObject.Parts)
@@ -329,7 +341,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
329 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount; 341 int ignoredObjects = serialisedSceneObjects.Count - sceneObjectsLoadedCount;
330 342
331 if (ignoredObjects > 0) 343 if (ignoredObjects > 0)
332 m_log.WarnFormat("[ARCHIVER]: Ignored {0} scene objects that already existed in the scene", ignoredObjects); 344 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 }
333 } 352 }
334 353
335 /// <summary> 354 /// <summary>
@@ -505,6 +524,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
505 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; 524 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
506 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; 525 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
507 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; 526 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
527 currentRegionSettings.TelehubObject = loadedRegionSettings.TelehubObject;
528 currentRegionSettings.ClearSpawnPoints();
529 foreach (SpawnPoint sp in loadedRegionSettings.SpawnPoints())
530 currentRegionSettings.AddSpawnPoint(sp);
508 531
509 currentRegionSettings.Save(); 532 currentRegionSettings.Save();
510 533
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index eabe46e..5679ad5 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 = 7; 331 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 8;
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 053c6f5..394ca27 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -534,6 +534,8 @@ 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"));
537 539
538 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs)); 540 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs));
539 541
@@ -580,6 +582,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
580 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080"))); 582 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080")));
581 Assert.That(loadedRs.UseEstateSun, Is.True); 583 Assert.That(loadedRs.UseEstateSun, Is.True);
582 Assert.That(loadedRs.WaterHeight, Is.EqualTo(23)); 584 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);
583 } 587 }
584 588
585 /// <summary> 589 /// <summary>