From 9cb4ba9d6b8def715018aab7d69ab64b9cf875c0 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 14 Jul 2008 16:23:59 +0000
Subject: * For now, when loading an archive all the existing scene objects get
deleted by default
---
.../Modules/World/Archiver/ArchiveReadRequest.cs | 5 +++++
OpenSim/Region/Environment/Scenes/Scene.cs | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 40c7a69..fbda830 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -112,6 +112,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
if (failedAssetRestores > 0)
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
+ m_log.Info("[ARCHIVER]: Clearing all existing scene objects");
+ m_scene.DeleteAllSceneObjects();
+
// Reload serialized prims
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
@@ -122,6 +125,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
SceneObjectGroup sceneObject = serialiser.LoadGroupFromXml2(m_scene, serialisedSceneObject);
+ // TODO: Change object creator/owner here
+
if (null != sceneObject)
sceneObjects.Add(sceneObject);
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index a6a5264..ad9646f 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1684,6 +1684,23 @@ namespace OpenSim.Region.Environment.Scenes
}
///
+ /// Delete every object from the scene
+ ///
+ public void DeleteAllSceneObjects()
+ {
+ lock (Entities)
+ {
+ ICollection entities = new List(Entities.Values);
+
+ foreach (EntityBase e in entities)
+ {
+ if (e is SceneObjectGroup)
+ DeleteSceneObject((SceneObjectGroup)e);
+ }
+ }
+ }
+
+ ///
/// Delete the given object from the scene.
///
///
--
cgit v1.1