Add EventManager events triggered when a SOP is added or removed
from the physical scene. Invocations added in SceneObjectPart.user_profiles
parent
ef662fc959
commit
5920abbf8d
|
@ -790,6 +790,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="obj">The object being removed from the scene</param>
|
/// <param name="obj">The object being removed from the scene</param>
|
||||||
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
|
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when an object is placed into the physical scene (PhysicsActor created).
|
||||||
|
/// </summary>
|
||||||
|
public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene;
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when an object is removed from the physical scene (PhysicsActor destroyed).
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Note: this is triggered just before the PhysicsActor is removed from the
|
||||||
|
/// physics engine so the receiver can do any necessary cleanup before its destruction.
|
||||||
|
/// </remarks>
|
||||||
|
public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Triggered when an object is removed from the scene.
|
/// Triggered when an object is removed from the scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1516,6 +1529,48 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj)
|
||||||
|
{
|
||||||
|
Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d(obj);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj)
|
||||||
|
{
|
||||||
|
Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene;
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
d(obj);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void TriggerShutdown()
|
public void TriggerShutdown()
|
||||||
{
|
{
|
||||||
Action handlerShutdown = OnShutdown;
|
Action handlerShutdown = OnShutdown;
|
||||||
|
|
|
@ -4316,6 +4316,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysActor = pa;
|
PhysActor = pa;
|
||||||
|
ParentGroup.Scene.EventManager.TriggerObjectAddedToPhysicalScene(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4328,6 +4329,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void RemoveFromPhysics()
|
public void RemoveFromPhysics()
|
||||||
{
|
{
|
||||||
|
ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this);
|
||||||
ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
|
||||||
PhysActor = null;
|
PhysActor = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue