Allow for richer semantics of object derez. Specifically, allow the existence of region modules that do other kinds of garbage collection. Instead of placing deleted objects in the user's Trash folder, or deleting them immediately (UseTrashOnDelete = false), a module may decide to take garbage collection under its control. For example, it may place derezzed objects in a certain area inworld and delete them later.
parent
789cd4e928
commit
bb82076a4d
|
@ -787,6 +787,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public event Action<SceneObjectGroup> OnObjectAddedToScene;
|
public event Action<SceneObjectGroup> OnObjectAddedToScene;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When a client sends a derez request for an object inworld
|
||||||
|
/// but before the object is deleted
|
||||||
|
/// </summary>
|
||||||
|
public event DeRezRequested OnDeRezRequested;
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when a client sends a derez request for an object inworld
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient">The client question (it can be null)</param>
|
||||||
|
/// <param name="obj">The object in question</param>
|
||||||
|
/// <param name="action">The exact derez action</param>
|
||||||
|
/// <returns>Flag indicating whether the object should be deleted from the scene or not</returns>
|
||||||
|
public delegate bool DeRezRequested(IClientAPI remoteClient, List<SceneObjectGroup> objs, DeRezAction action);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when an object is removed from the scene.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
|
||||||
|
/// in <see cref="Scene.DeleteSceneObject"/>
|
||||||
|
/// </remarks>
|
||||||
|
public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delegate for <see cref="OnObjectBeingRemovedFromScene"/>
|
/// Delegate for <see cref="OnObjectBeingRemovedFromScene"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -806,15 +828,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene;
|
public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Triggered when an object is removed from the scene.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/>
|
|
||||||
/// in <see cref="Scene.DeleteSceneObject"/>
|
|
||||||
/// </remarks>
|
|
||||||
public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
|
|
||||||
|
|
||||||
public delegate void NoticeNoLandDataFromStorage();
|
public delegate void NoticeNoLandDataFromStorage();
|
||||||
public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
|
public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage;
|
||||||
|
|
||||||
|
@ -1523,6 +1536,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool TriggerDeRezRequested(IClientAPI client, List<SceneObjectGroup> objs, DeRezAction action)
|
||||||
|
{
|
||||||
|
bool canDeRez = true;
|
||||||
|
|
||||||
|
DeRezRequested handlerDeRezRequested = OnDeRezRequested;
|
||||||
|
if (handlerDeRezRequested != null)
|
||||||
|
{
|
||||||
|
foreach (DeRezRequested d in handlerDeRezRequested.GetInvocationList())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
canDeRez &= d(client, objs, action);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing. {0} {1}",
|
||||||
|
e.Message, e.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return canDeRez;
|
||||||
|
}
|
||||||
|
|
||||||
public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
|
public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
|
||||||
{
|
{
|
||||||
ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
|
ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;
|
||||||
|
|
|
@ -2182,13 +2182,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OK, we're done with permissions. Let's check if any part of the code prevents the objects from being deleted
|
||||||
|
bool canDelete = EventManager.TriggerDeRezRequested(remoteClient, deleteGroups, action);
|
||||||
|
|
||||||
if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete))
|
if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete))
|
||||||
{
|
{
|
||||||
m_asyncSceneObjectDeleter.DeleteToInventory(
|
m_asyncSceneObjectDeleter.DeleteToInventory(
|
||||||
action, destinationID, deleteGroups, remoteClient,
|
action, destinationID, deleteGroups, remoteClient,
|
||||||
permissionToDelete);
|
permissionToDelete && canDelete);
|
||||||
}
|
}
|
||||||
else if (permissionToDelete)
|
else if (permissionToDelete && canDelete)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectGroup g in deleteGroups)
|
foreach (SceneObjectGroup g in deleteGroups)
|
||||||
DeleteSceneObject(g, false);
|
DeleteSceneObject(g, false);
|
||||||
|
|
Loading…
Reference in New Issue