diff options
author | Melanie | 2013-02-15 21:42:16 +0000 |
---|---|---|
committer | Melanie | 2013-02-15 21:42:16 +0000 |
commit | ea8c5ba707f0c6afd98968b68d13ab03b151b75b (patch) | |
tree | 9b67be5dd03a8012fb832590b05c550f869601fa /OpenSim/Region/Framework/Scenes | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of git://opensimulator.org/git/opensim (diff) | |
download | opensim-SC-ea8c5ba707f0c6afd98968b68d13ab03b151b75b.zip opensim-SC-ea8c5ba707f0c6afd98968b68d13ab03b151b75b.tar.gz opensim-SC-ea8c5ba707f0c6afd98968b68d13ab03b151b75b.tar.bz2 opensim-SC-ea8c5ba707f0c6afd98968b68d13ab03b151b75b.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 |
2 files changed, 60 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 052a05e..4733547 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -792,6 +792,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
792 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 792 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
793 | 793 | ||
794 | /// <summary> | 794 | /// <summary> |
795 | /// Triggered when an object is placed into the physical scene (PhysicsActor created). | ||
796 | /// </summary> | ||
797 | public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene; | ||
798 | /// <summary> | ||
799 | /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed). | ||
800 | /// </summary> | ||
801 | /// <remarks> | ||
802 | /// Note: this is triggered just before the PhysicsActor is removed from the | ||
803 | /// physics engine so the receiver can do any necessary cleanup before its destruction. | ||
804 | /// </remarks> | ||
805 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; | ||
806 | |||
807 | /// <summary> | ||
795 | /// Triggered when an object is removed from the scene. | 808 | /// Triggered when an object is removed from the scene. |
796 | /// </summary> | 809 | /// </summary> |
797 | /// <remarks> | 810 | /// <remarks> |
@@ -1541,6 +1554,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
1541 | } | 1554 | } |
1542 | } | 1555 | } |
1543 | 1556 | ||
1557 | public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj) | ||
1558 | { | ||
1559 | Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene; | ||
1560 | if (handler != null) | ||
1561 | { | ||
1562 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1563 | { | ||
1564 | try | ||
1565 | { | ||
1566 | d(obj); | ||
1567 | } | ||
1568 | catch (Exception e) | ||
1569 | { | ||
1570 | m_log.ErrorFormat( | ||
1571 | "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}", | ||
1572 | e.Message, e.StackTrace); | ||
1573 | } | ||
1574 | } | ||
1575 | } | ||
1576 | } | ||
1577 | |||
1578 | public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj) | ||
1579 | { | ||
1580 | Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene; | ||
1581 | if (handler != null) | ||
1582 | { | ||
1583 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1584 | { | ||
1585 | try | ||
1586 | { | ||
1587 | d(obj); | ||
1588 | } | ||
1589 | catch (Exception e) | ||
1590 | { | ||
1591 | m_log.ErrorFormat( | ||
1592 | "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}", | ||
1593 | e.Message, e.StackTrace); | ||
1594 | } | ||
1595 | } | ||
1596 | } | ||
1597 | } | ||
1598 | |||
1544 | public void TriggerShutdown() | 1599 | public void TriggerShutdown() |
1545 | { | 1600 | { |
1546 | Action handlerShutdown = OnShutdown; | 1601 | Action handlerShutdown = OnShutdown; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ce0820c..7cab841 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4738,7 +4738,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4738 | } | 4738 | } |
4739 | 4739 | ||
4740 | PhysActor = pa; | 4740 | PhysActor = pa; |
4741 | } | 4741 | |
4742 | ParentGroup.Scene.EventManager.TriggerObjectAddedToPhysicalScene(this); | ||
4743 | } | ||
4742 | 4744 | ||
4743 | /// <summary> | 4745 | /// <summary> |
4744 | /// This removes the part from the physics scene. | 4746 | /// This removes the part from the physics scene. |
@@ -4757,6 +4759,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4757 | pa.OnOutOfBounds -= PhysicsOutOfBounds; | 4759 | pa.OnOutOfBounds -= PhysicsOutOfBounds; |
4758 | 4760 | ||
4759 | ParentGroup.Scene.PhysicsScene.RemovePrim(pa); | 4761 | ParentGroup.Scene.PhysicsScene.RemovePrim(pa); |
4762 | |||
4763 | ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this); | ||
4760 | } | 4764 | } |
4761 | PhysActor = null; | 4765 | PhysActor = null; |
4762 | } | 4766 | } |