From 5920abbf8d1b1770c03bc6232f1afe0551b4a331 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Thu, 14 Feb 2013 09:48:11 -0800
Subject: Add EventManager events triggered when a SOP is added or removed from
the physical scene. Invocations added in SceneObjectPart.
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 55 +++++++++++++++++++++++++
1 file changed, 55 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes/EventManager.cs')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 9ee1520..59d0148 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -791,6 +791,19 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
///
+ /// Triggered when an object is placed into the physical scene (PhysicsActor created).
+ ///
+ public event Action OnObjectAddedToPhysicalScene;
+ ///
+ /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed).
+ ///
+ ///
+ /// 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.
+ ///
+ public event Action OnObjectRemovedFromPhysicalScene;
+
+ ///
/// Triggered when an object is removed from the scene.
///
///
@@ -1516,6 +1529,48 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj)
+ {
+ Action handler = OnObjectAddedToPhysicalScene;
+ if (handler != null)
+ {
+ foreach (Action 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 handler = OnObjectRemovedFromPhysicalScene;
+ if (handler != null)
+ {
+ foreach (Action 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()
{
Action handlerShutdown = OnShutdown;
--
cgit v1.1