Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
This commit is contained in:
Melanie
2013-02-15 21:42:16 +00:00
13 changed files with 270 additions and 106 deletions

View File

@@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool CreateStore(string value, ref UUID result);
bool DestroyStore(UUID storeID);
JsonStoreNodeType PathType(UUID storeID, string path);
JsonStoreNodeType GetPathType(UUID storeID, string path);
bool TestStore(UUID storeID);
bool TestPath(UUID storeID, string path, bool useJson);
@@ -60,6 +60,6 @@ namespace OpenSim.Region.Framework.Interfaces
void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback);
void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback);
int ArrayLength(UUID storeID, string path);
int GetArrayLength(UUID storeID, string path);
}
}

View File

@@ -791,6 +791,19 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="obj">The object being removed from the scene</param>
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>
/// Triggered when an object is removed from the scene.
/// </summary>
@@ -1541,6 +1554,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()
{
Action handlerShutdown = OnShutdown;

View File

@@ -4738,7 +4738,9 @@ namespace OpenSim.Region.Framework.Scenes
}
PhysActor = pa;
}
ParentGroup.Scene.EventManager.TriggerObjectAddedToPhysicalScene(this);
}
/// <summary>
/// This removes the part from the physics scene.
@@ -4757,6 +4759,8 @@ namespace OpenSim.Region.Framework.Scenes
pa.OnOutOfBounds -= PhysicsOutOfBounds;
ParentGroup.Scene.PhysicsScene.RemovePrim(pa);
ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this);
}
PhysActor = null;
}