* refactor: For new objects, move attach to backup to occur when adding to a scene, rather than on creation of the group

* Adding to a scene is now parameterized such that one can choose not to actually persist that group
* This is to support a use case where a module wants a scene which consists of both objects which are persisted, and ones which are just temporary for the lifetime of that server instance
This commit is contained in:
Justin Clarke Casey
2008-06-12 17:49:08 +00:00
parent 74017a4331
commit 8714833986
7 changed files with 46 additions and 58 deletions

View File

@@ -193,6 +193,7 @@ namespace OpenSim.Region.Environment.Scenes
{
sceneObject.RegionHandle = m_regInfo.RegionHandle;
sceneObject.SetScene(m_parentScene);
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
part.LocalId = m_parentScene.PrimIDAllocate();
@@ -200,16 +201,20 @@ namespace OpenSim.Region.Environment.Scenes
}
sceneObject.UpdateParentIDs();
AddSceneObject(sceneObject);
AddSceneObject(sceneObject, true);
}
/// <summary>
/// Add an object to the scene.
/// </summary>
/// <param name="sceneObject"></param>
/// <param name="attachToBackup">
/// If true, the object is made persistent into the scene.
/// If false, the object will not persist over server restarts
/// </param>
/// <returns>true if the object was added, false if an object with the same uuid was already in the scene
/// </returns>
protected internal bool AddSceneObject(SceneObjectGroup sceneObject)
protected internal bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup)
{
lock (Entities)
{
@@ -218,6 +223,9 @@ namespace OpenSim.Region.Environment.Scenes
// QuadTree.AddSceneObject(sceneObject);
Entities.Add(sceneObject.UUID, sceneObject);
m_numPrim += sceneObject.Children.Count;
if (attachToBackup)
sceneObject.AttachToBackup();
return true;
}