From 96e649189f24b6261d0bcdd6aa7f5a078b8d3f7f Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Fri, 25 Jun 2010 14:25:39 -0700 Subject: Add two events: OnAttachToBackup and OnDetachFromBackup. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 26 ++++++++++++++++++++++ .../Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++++ 2 files changed, 30 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 80f9114..904e38a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -43,6 +43,10 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ObjectDuplicateDelegate(EntityBase original, EntityBase clone); + public delegate void AttachToBackupDelegate(SceneObjectGroup sog); + + public delegate void DetachFromBackupDelegate(SceneObjectGroup sog); + public delegate void ObjectCreateDelegate(EntityBase obj); public delegate void ObjectDeleteDelegate(EntityBase obj); @@ -61,6 +65,8 @@ namespace OpenSim.Region.Framework.Scenes private PhysicsCrash handlerPhysicsCrash = null; public event ObjectDuplicateDelegate OnObjectDuplicate; + public event AttachToBackupDelegate OnAttachToBackup; + public event DetachFromBackupDelegate OnDetachFromBackup; public event ObjectCreateDelegate OnObjectCreate; public event ObjectDeleteDelegate OnObjectRemove; @@ -388,10 +394,14 @@ namespace OpenSim.Region.Framework.Scenes m_numPrim += sceneObject.Children.Count; if (attachToBackup) + { sceneObject.AttachToBackup(); + } if (OnObjectCreate != null) + { OnObjectCreate(sceneObject); + } lock (m_dictionary_lock) { @@ -458,6 +468,22 @@ namespace OpenSim.Region.Framework.Scenes } } + public void FireAttachToBackup(SceneObjectGroup obj) + { + if (OnAttachToBackup != null) + { + OnAttachToBackup(obj); + } + } + + public void FireDetachFromBackup(SceneObjectGroup obj) + { + if (OnDetachFromBackup != null) + { + OnDetachFromBackup(obj); + } + } + /// /// Process all pending updates /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3e92954..e18dfd2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -658,6 +658,8 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void AttachToBackup() { + m_scene.SceneGraph.FireAttachToBackup(this); + if (InSceneBackup) { //m_log.DebugFormat( @@ -2703,6 +2705,8 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void DetachFromBackup() { + m_scene.SceneGraph.FireDetachFromBackup(this); + if (m_isBackedUp) m_scene.EventManager.OnBackup -= ProcessBackup; -- cgit v1.1 From f64d1cb3967b5352921b296348f618a62fdfa622 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Fri, 25 Jun 2010 14:39:15 -0700 Subject: Add new event: OnChangedBackup --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 11 +++++++++++ OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index ce7b0eb..81ef54f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -47,6 +47,8 @@ namespace OpenSim.Region.Framework.Scenes public delegate void DetachFromBackupDelegate(SceneObjectGroup sog); + public delegate void ChangedBackupDelegate(SceneObjectGroup sog); + public delegate void ObjectCreateDelegate(EntityBase obj); public delegate void ObjectDeleteDelegate(EntityBase obj); @@ -67,6 +69,7 @@ namespace OpenSim.Region.Framework.Scenes public event ObjectDuplicateDelegate OnObjectDuplicate; public event AttachToBackupDelegate OnAttachToBackup; public event DetachFromBackupDelegate OnDetachFromBackup; + public event ChangedBackupDelegate OnChangeBackup; public event ObjectCreateDelegate OnObjectCreate; public event ObjectDeleteDelegate OnObjectRemove; @@ -484,6 +487,14 @@ namespace OpenSim.Region.Framework.Scenes } } + public void FireChangeBackup(SceneObjectGroup obj) + { + if (OnChangeBackup != null) + { + OnChangeBackup(obj); + } + } + /// /// Process all pending updates /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index e18dfd2..7081ced 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -200,6 +200,10 @@ namespace OpenSim.Region.Framework.Scenes { if (value) { + if (m_isBackedUp) + { + m_scene.SceneGraph.FireChangeBackup(this); + } timeLastChanged = DateTime.Now.Ticks; if (!m_hasGroupChanged) timeFirstChanged = DateTime.Now.Ticks; -- cgit v1.1