* Added three new events to SceneGraph:

- OnObjectCreate
- OnObjectDuplicate
- OnObjectRemove
0.6.2-post-fixes
Adam Frisby 2009-01-06 15:14:15 +00:00
parent b6ee2f15ba
commit 79bf2c8096
1 changed files with 20 additions and 3 deletions

View File

@ -39,6 +39,12 @@ namespace OpenSim.Region.Environment.Scenes
{
public delegate void PhysicsCrash();
public delegate void ObjectDuplicateDelegate(EntityBase original, EntityBase clone);
public delegate void ObjectCreateDelegate(EntityBase obj);
public delegate void ObjectDeleteDelegate(EntityBase obj);
/// <summary>
/// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components
/// should be migrated out over time.
@ -52,6 +58,10 @@ namespace OpenSim.Region.Environment.Scenes
protected internal event PhysicsCrash UnRecoverableError;
private PhysicsCrash handlerPhysicsCrash = null;
public event ObjectDuplicateDelegate OnObjectDuplicate;
public event ObjectCreateDelegate OnObjectCreate;
public event ObjectDeleteDelegate OnObjectRemove;
#endregion
#region Fields
@ -288,6 +298,9 @@ namespace OpenSim.Region.Environment.Scenes
if (attachToBackup)
sceneObject.AttachToBackup();
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
return true;
}
}
@ -313,13 +326,13 @@ namespace OpenSim.Region.Environment.Scenes
}
}
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
Entities.Remove(uuid);
//SceneObjectGroup part;
//((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
return true;
}
@ -1739,6 +1752,10 @@ namespace OpenSim.Region.Environment.Scenes
// required for physics to update it's position
copy.AbsolutePosition = copy.AbsolutePosition;
if (OnObjectDuplicate != null)
OnObjectDuplicate(originPrim, copy);
return copy;
}
}