* 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 PhysicsCrash();
public delegate void ObjectDuplicateDelegate(EntityBase original, EntityBase clone);
public delegate void ObjectCreateDelegate(EntityBase obj);
public delegate void ObjectDeleteDelegate(EntityBase obj);
/// <summary> /// <summary>
/// This class used to be called InnerScene and may not yet truly be a SceneGraph. The non scene graph components /// 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. /// should be migrated out over time.
@ -52,6 +58,10 @@ namespace OpenSim.Region.Environment.Scenes
protected internal event PhysicsCrash UnRecoverableError; protected internal event PhysicsCrash UnRecoverableError;
private PhysicsCrash handlerPhysicsCrash = null; private PhysicsCrash handlerPhysicsCrash = null;
public event ObjectDuplicateDelegate OnObjectDuplicate;
public event ObjectCreateDelegate OnObjectCreate;
public event ObjectDeleteDelegate OnObjectRemove;
#endregion #endregion
#region Fields #region Fields
@ -288,6 +298,9 @@ namespace OpenSim.Region.Environment.Scenes
if (attachToBackup) if (attachToBackup)
sceneObject.AttachToBackup(); sceneObject.AttachToBackup();
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
return true; return true;
} }
} }
@ -313,12 +326,12 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
Entities.Remove(uuid); Entities.Remove(uuid);
//SceneObjectGroup part; //SceneObjectGroup part;
//((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
return true; return true;
} }
@ -1694,7 +1707,7 @@ namespace OpenSim.Region.Environment.Scenes
protected internal SceneObjectGroup DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) protected internal SceneObjectGroup DuplicateObject(uint originalPrim, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
{ {
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
List<EntityBase> EntityList = GetEntities(); List<EntityBase> EntityList = GetEntities();
SceneObjectGroup originPrim = null; SceneObjectGroup originPrim = null;
@ -1739,6 +1752,10 @@ namespace OpenSim.Region.Environment.Scenes
// required for physics to update it's position // required for physics to update it's position
copy.AbsolutePosition = copy.AbsolutePosition; copy.AbsolutePosition = copy.AbsolutePosition;
if (OnObjectDuplicate != null)
OnObjectDuplicate(originPrim, copy);
return copy; return copy;
} }
} }