* For now, when loading an archive all the existing scene objects get deleted by default

0.6.0-stable
Justin Clarke Casey 2008-07-14 16:23:59 +00:00
parent 31e5d348f6
commit 9cb4ba9d6b
2 changed files with 22 additions and 0 deletions

View File

@ -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);
}

View File

@ -1683,6 +1683,23 @@ namespace OpenSim.Region.Environment.Scenes
return m_innerScene.AddNewSceneObject(sceneObject, attachToBackup);
}
/// <summary>
/// Delete every object from the scene
/// </summary>
public void DeleteAllSceneObjects()
{
lock (Entities)
{
ICollection<EntityBase> entities = new List<EntityBase>(Entities.Values);
foreach (EntityBase e in entities)
{
if (e is SceneObjectGroup)
DeleteSceneObject((SceneObjectGroup)e);
}
}
}
/// <summary>
/// Delete the given object from the scene.
/// </summary>