Add two events: OnAttachToBackup and OnDetachFromBackup.

avinationmerge
Tom Grimshaw 2010-06-25 14:25:39 -07:00
parent 8daa149c36
commit 96e649189f
2 changed files with 30 additions and 0 deletions

View File

@ -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);
}
}
/// <summary>
/// Process all pending updates
/// </summary>

View File

@ -658,6 +658,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public virtual void AttachToBackup()
{
m_scene.SceneGraph.FireAttachToBackup(this);
if (InSceneBackup)
{
//m_log.DebugFormat(
@ -2703,6 +2705,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="objectGroup"></param>
public virtual void DetachFromBackup()
{
m_scene.SceneGraph.FireDetachFromBackup(this);
if (m_isBackedUp)
m_scene.EventManager.OnBackup -= ProcessBackup;