From 8714833986cef44787fd57a61699b7bdcfd3d3bb Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 12 Jun 2008 17:49:08 +0000
Subject: * 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
---
.../Region/Environment/Scenes/SceneObjectGroup.cs | 49 +++++-----------------
1 file changed, 10 insertions(+), 39 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs')
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 67e2c70..336009b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -351,15 +351,13 @@ namespace OpenSim.Region.Environment.Scenes
RegionHandle = regionHandle;
- AttachToBackup();
-
ApplyPhysics(scene.m_physicalPrim);
ScheduleGroupForFullUpdate();
}
///
- /// Restore the object from its serialized xml representation.
+ /// Create an object using serialized data in OpenSim's original xml format.
///
public SceneObjectGroup(Scene scene, ulong regionHandle, string xmlData)
{
@@ -417,15 +415,13 @@ namespace OpenSim.Region.Environment.Scenes
m_rootPart.RegionHandle = m_regionHandle;
UpdateParentIDs();
- AttachToBackup();
-
ApplyPhysics(scene.m_physicalPrim);
ScheduleGroupForFullUpdate();
}
///
- ///
+ /// Create an object using serialized data in OpenSim's xml2 format.
///
public SceneObjectGroup(string xmlData)
{
@@ -495,6 +491,7 @@ namespace OpenSim.Region.Environment.Scenes
//ApplyPhysics(scene.m_physicalPrim);
}
+
///
///
///
@@ -527,7 +524,7 @@ namespace OpenSim.Region.Environment.Scenes
///
/// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes.
///
- private void AttachToBackup()
+ public void AttachToBackup()
{
if (InSceneBackup)
{
@@ -822,7 +819,6 @@ namespace OpenSim.Region.Environment.Scenes
public void SetScene(Scene scene)
{
m_scene = scene;
- AttachToBackup();
}
///
@@ -1848,38 +1844,9 @@ namespace OpenSim.Region.Environment.Scenes
linkPart.RotationOffset = worldRot;
- // This chunk is probably unnecesary now - delete later on
- /*
- Quaternion oldRot
- = new Quaternion(
- linkPart.RotationOffset.W,
- linkPart.RotationOffset.X,
- linkPart.RotationOffset.Y,
- linkPart.RotationOffset.Z);
- Quaternion newRot = parentRot*oldRot;
- linkPart.RotationOffset = new LLQuaternion(newRot.x, newRot.y, newRot.z, newRot.w);
- */
-
- // Add physics information back to delinked part if appropriate
- // XXX This is messy and should be refactorable with the similar section in
- // SceneObjectPart.UpdatePrimFlags()
- //if (m_rootPart.PhysActor != null)
- //{
- //linkPart.PhysActor = m_scene.PhysicsScene.AddPrimShape(
- //linkPart.Name,
- //linkPart.Shape,
- //new PhysicsVector(linkPart.AbsolutePosition.X, linkPart.AbsolutePosition.Y,
- //linkPart.AbsolutePosition.Z),
- //new PhysicsVector(linkPart.Scale.X, linkPart.Scale.Y, linkPart.Scale.Z),
- //new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X,
- //linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
- //m_rootPart.PhysActor.IsPhysical);
- //m_rootPart.DoPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
- //}
-
SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart);
- m_scene.AddSceneObject(objectGroup);
+ m_scene.AddSceneObject(objectGroup, true);
ScheduleGroupForFullUpdate();
}
@@ -1891,7 +1858,11 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- private void DetachFromBackup(SceneObjectGroup objectGroup)
+ ///
+ /// Stop this object from being persisted over server restarts.
+ ///
+ ///
+ public void DetachFromBackup(SceneObjectGroup objectGroup)
{
m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup;
}
--
cgit v1.1