aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-07-12 22:14:38 +0000
committerJustin Clarke Casey2008-07-12 22:14:38 +0000
commita89385818d35dd991aa29f835fdb742e0923c26e (patch)
tree56cd5b650bcc8aceafcbd4a1cb7f3026e8d9c30f /OpenSim/Region/Environment
parentminor: method documentation (diff)
downloadopensim-SC_OLD-a89385818d35dd991aa29f835fdb742e0923c26e.zip
opensim-SC_OLD-a89385818d35dd991aa29f835fdb742e0923c26e.tar.gz
opensim-SC_OLD-a89385818d35dd991aa29f835fdb742e0923c26e.tar.bz2
opensim-SC_OLD-a89385818d35dd991aa29f835fdb742e0923c26e.tar.xz
* On archive loading, tell the user how many objects we are ignoring because they already exist in the scene
* (ability to give objects new uuids will come later)
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs16
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
5 files changed, 32 insertions, 17 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 0e37197..c9f8fce 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -103,11 +103,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
103 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects", serialisedSceneObjects.Count); 103 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects", serialisedSceneObjects.Count);
104 104
105 IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); 105 IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
106 ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 106 ICollection<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
107 107
108 foreach (string serialisedSceneObject in serialisedSceneObjects) 108 foreach (string serialisedSceneObject in serialisedSceneObjects)
109 { 109 {
110 sceneObjects.Add(serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject)); 110 SceneObjectGroup sceneObject = serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject);
111
112 if (null != sceneObject)
113 sceneObjects.Add(sceneObject);
111 } 114 }
112 115
113 m_log.Debug("[ARCHIVER]: Starting scripts"); 116 m_log.Debug("[ARCHIVER]: Starting scripts");
@@ -117,6 +120,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
117 sceneObject.CreateScriptInstances(0, true); 120 sceneObject.CreateScriptInstances(0, true);
118 } 121 }
119 122
123 m_log.InfoFormat("[ARCHIVER]: Restored {0} objects to the scene", sceneObjects.Count);
124
125 int ignoredObjects = serialisedSceneObjects.Count - sceneObjects.Count;
126
127 if (ignoredObjects > 0)
128 m_log.WarnFormat("[ARCHIVER]: Ignored {0} objects that already existed in the scene", ignoredObjects);
129
120 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); 130 m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");
121 } 131 }
122 132
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
index 0fc8ac3..6e48f8e 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
85 /// </summary> 85 /// </summary>
86 /// <param name="scene"></param> 86 /// <param name="scene"></param>
87 /// <param name="xmlString"></param> 87 /// <param name="xmlString"></param>
88 /// <returns>The scene object created</returns> 88 /// <returns>The scene object created. null if the scene object already existed</returns>
89 SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString); 89 SceneObjectGroup LoadGroupFromXml2(Scene scene, string xmlString);
90 90
91 /// <summary> 91 /// <summary>
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index f283ecb..bd19a7e 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -180,14 +180,15 @@ namespace OpenSim.Region.Environment.Scenes
180 /// </summary> 180 /// </summary>
181 /// <param name="scene"></param> 181 /// <param name="scene"></param>
182 /// <param name="xmlData"></param> 182 /// <param name="xmlData"></param>
183 /// <returns>The scene object created</returns> 183 /// <returns>The scene object created. null if the scene object already existed</returns>
184 protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData) 184 protected static SceneObjectGroup CreatePrimFromXml2(Scene scene, string xmlData)
185 { 185 {
186 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 186 SceneObjectGroup obj = new SceneObjectGroup(xmlData);
187 187
188 scene.AddRestoredSceneObject(obj, true); 188 if (scene.AddRestoredSceneObject(obj, true))
189 189 return obj;
190 return obj; 190 else
191 return null;
191 } 192 }
192 193
193 public static void SavePrimsToXml2(Scene scene, string fileName) 194 public static void SavePrimsToXml2(Scene scene, string fileName)
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 6a2b2d9..abd3387 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -196,7 +196,10 @@ namespace OpenSim.Region.Environment.Scenes
196 /// If true, changes to the object will be reflected in its persisted data 196 /// If true, changes to the object will be reflected in its persisted data
197 /// If false, the persisted data will not be changed even if the object in the scene is changed 197 /// If false, the persisted data will not be changed even if the object in the scene is changed
198 /// </param> 198 /// </param>
199 protected internal void AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 199 /// <returns>
200 /// true if the object was added, false if an object with the same uuid was already in the scene
201 /// </returns>
202 protected internal bool AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
200 { 203 {
201 sceneObject.RegionHandle = m_regInfo.RegionHandle; 204 sceneObject.RegionHandle = m_regInfo.RegionHandle;
202 sceneObject.SetScene(m_parentScene); 205 sceneObject.SetScene(m_parentScene);
@@ -208,7 +211,7 @@ namespace OpenSim.Region.Environment.Scenes
208 211
209 sceneObject.UpdateParentIDs(); 212 sceneObject.UpdateParentIDs();
210 213
211 AddSceneObject(sceneObject, attachToBackup); 214 return AddSceneObject(sceneObject, attachToBackup);
212 } 215 }
213 216
214 /// <summary> 217 /// <summary>
@@ -220,14 +223,15 @@ namespace OpenSim.Region.Environment.Scenes
220 /// If true, the object is made persistent into the scene. 223 /// If true, the object is made persistent into the scene.
221 /// If false, the object will not persist over server restarts 224 /// If false, the object will not persist over server restarts
222 /// </param> 225 /// </param>
223 /// <returns>true if the object was added, false if an object with the same uuid was already in the scene 226 /// <returns>
227 /// true if the object was added, false if an object with the same uuid was already in the scene
224 /// </returns> 228 /// </returns>
225 protected internal void AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 229 protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
226 { 230 {
227 // Ensure that we persist this new scene object 231 // Ensure that we persist this new scene object
228 sceneObject.HasGroupChanged = true; 232 sceneObject.HasGroupChanged = true;
229 233
230 AddSceneObject(sceneObject, attachToBackup); 234 return AddSceneObject(sceneObject, attachToBackup);
231 } 235 }
232 236
233 /// <summary> 237 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 05026c3..1564556 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1665,9 +1665,9 @@ namespace OpenSim.Region.Environment.Scenes
1665 /// Add an object into the scene that has come from storage 1665 /// Add an object into the scene that has come from storage
1666 /// </summary> 1666 /// </summary>
1667 /// <param name="sceneObject"></param> 1667 /// <param name="sceneObject"></param>
1668 public void AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 1668 public bool AddRestoredSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
1669 { 1669 {
1670 m_innerScene.AddRestoredSceneObject(sceneObject, attachToBackup); 1670 return m_innerScene.AddRestoredSceneObject(sceneObject, attachToBackup);
1671 } 1671 }
1672 1672
1673 /// <summary> 1673 /// <summary>
@@ -1678,9 +1678,9 @@ namespace OpenSim.Region.Environment.Scenes
1678 /// If true, the object is made persistent into the scene. 1678 /// If true, the object is made persistent into the scene.
1679 /// If false, the object will not persist over server restarts 1679 /// If false, the object will not persist over server restarts
1680 /// </param> 1680 /// </param>
1681 public void AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup) 1681 public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
1682 { 1682 {
1683 m_innerScene.AddNewSceneObject(sceneObject, attachToBackup); 1683 return m_innerScene.AddNewSceneObject(sceneObject, attachToBackup);
1684 } 1684 }
1685 1685
1686 /// <summary> 1686 /// <summary>