aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs55
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
2 files changed, 57 insertions, 0 deletions
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
791 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); 791 public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
792 792
793 /// <summary> 793 /// <summary>
794 /// Triggered when an object is placed into the physical scene (PhysicsActor created).
795 /// </summary>
796 public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene;
797 /// <summary>
798 /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed).
799 /// </summary>
800 /// <remarks>
801 /// Note: this is triggered just before the PhysicsActor is removed from the
802 /// physics engine so the receiver can do any necessary cleanup before its destruction.
803 /// </remarks>
804 public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene;
805
806 /// <summary>
794 /// Triggered when an object is removed from the scene. 807 /// Triggered when an object is removed from the scene.
795 /// </summary> 808 /// </summary>
796 /// <remarks> 809 /// <remarks>
@@ -1516,6 +1529,48 @@ namespace OpenSim.Region.Framework.Scenes
1516 } 1529 }
1517 } 1530 }
1518 1531
1532 public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj)
1533 {
1534 Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene;
1535 if (handler != null)
1536 {
1537 foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
1538 {
1539 try
1540 {
1541 d(obj);
1542 }
1543 catch (Exception e)
1544 {
1545 m_log.ErrorFormat(
1546 "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}",
1547 e.Message, e.StackTrace);
1548 }
1549 }
1550 }
1551 }
1552
1553 public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj)
1554 {
1555 Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene;
1556 if (handler != null)
1557 {
1558 foreach (Action<SceneObjectPart> d in handler.GetInvocationList())
1559 {
1560 try
1561 {
1562 d(obj);
1563 }
1564 catch (Exception e)
1565 {
1566 m_log.ErrorFormat(
1567 "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}",
1568 e.Message, e.StackTrace);
1569 }
1570 }
1571 }
1572 }
1573
1519 public void TriggerShutdown() 1574 public void TriggerShutdown()
1520 { 1575 {
1521 Action handlerShutdown = OnShutdown; 1576 Action handlerShutdown = OnShutdown;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 9b29973..cce8b21 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4316,6 +4316,7 @@ namespace OpenSim.Region.Framework.Scenes
4316 } 4316 }
4317 4317
4318 PhysActor = pa; 4318 PhysActor = pa;
4319 ParentGroup.Scene.EventManager.TriggerObjectAddedToPhysicalScene(this);
4319 } 4320 }
4320 4321
4321 /// <summary> 4322 /// <summary>
@@ -4328,6 +4329,7 @@ namespace OpenSim.Region.Framework.Scenes
4328 /// </remarks> 4329 /// </remarks>
4329 public void RemoveFromPhysics() 4330 public void RemoveFromPhysics()
4330 { 4331 {
4332 ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this);
4331 ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); 4333 ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor);
4332 PhysActor = null; 4334 PhysActor = null;
4333 } 4335 }