Plumb the path for multiple object deletes

viewer-2-initial-appearance
Melanie 2010-10-06 19:59:30 +02:00
parent d45276b3f6
commit abfede7819
6 changed files with 45 additions and 46 deletions

View File

@ -196,13 +196,24 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// currently calls this with multiple items.
UUID ret = UUID.Zero;
Dictionary<UUID, List<SceneObjectGroup>> deletes =
new Dictionary<UUID, List<SceneObjectGroup>>();
foreach (SceneObjectGroup g in objectGroups)
ret = DeleteToInventory(action, folderID, g, remoteClient);
{
if (!deletes.ContainsKey(g.OwnerID))
deletes[g.OwnerID] = new List<SceneObjectGroup>();
deletes[g.OwnerID].Add(g);
}
foreach (List<SceneObjectGroup> objlist in deletes.Values)
ret = DeleteToInventory(action, folderID, objlist, remoteClient);
return ret;
}
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
private UUID DeleteToInventory(DeRezAction action, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient)
{
UUID assetID = UUID.Zero;
@ -315,10 +326,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
}
else
{
// Catch all. Use lost & found
//
if (remoteClient == null ||
objectGroup.OwnerID != remoteClient.AgentId)
{
// Taking copy of another person's item. Take to
// Objects folder.
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
}
else
{
// Catch all. Use lost & found
//
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
}
}
}

View File

@ -1689,37 +1689,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Called when one or more objects are removed from the environment into inventory.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="localID"></param>
/// <param name="groupID"></param>
/// <param name="action"></param>
/// <param name="destinationID"></param>
public virtual void DeRezObject(IClientAPI remoteClient, List<uint> localIDs,
UUID groupID, DeRezAction action, UUID destinationID)
{
foreach (uint localID in localIDs)
{
DeRezObject(remoteClient, localID, groupID, action, destinationID);
}
}
/// <summary>
/// Called when an object is removed from the environment into inventory.
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="localID"></param>
/// <param name="groupID"></param>
/// <param name="action"></param>
/// <param name="destinationID"></param>
public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
UUID groupID, DeRezAction action, UUID destinationID)
{
DeRezObjects(remoteClient, new List<uint>() { localID }, groupID, action, destinationID);
}
public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
UUID groupID, DeRezAction action, UUID destinationID)
{
@ -1990,14 +1959,19 @@ namespace OpenSim.Region.Framework.Scenes
return group;
}
public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)
public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
UUID AgentId)
{
List<uint> localIDs = new List<uint>();
foreach (SceneObjectGroup grp in returnobjects)
{
AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
DeRezObject(null, grp.RootPart.LocalId,
grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero);
AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition,
"parcel owner return");
localIDs.Add(grp.RootPart.LocalId);
}
DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return,
UUID.Zero);
return true;
}

View File

@ -2735,7 +2735,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnGrabUpdate += m_sceneGraph.MoveObject;
client.OnSpinStart += m_sceneGraph.SpinStart;
client.OnSpinUpdate += m_sceneGraph.SpinObject;
client.OnDeRezObject += DeRezObject;
client.OnDeRezObject += DeRezObjects;
client.OnObjectName += m_sceneGraph.PrimName;
client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
@ -2864,7 +2864,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnGrabUpdate -= m_sceneGraph.MoveObject;
client.OnSpinStart -= m_sceneGraph.SpinStart;
client.OnSpinUpdate -= m_sceneGraph.SpinObject;
client.OnDeRezObject -= DeRezObject;
client.OnDeRezObject -= DeRezObjects;
client.OnObjectName -= m_sceneGraph.PrimName;
client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;

View File

@ -1291,6 +1291,8 @@ namespace OpenSim.Region.Framework.Scenes
ILandObject parcel = m_scene.LandChannel.GetLandObject(
m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y);
List<uint> returns = new List<uint>();
if (parcel != null && parcel.LandData != null &&
parcel.LandData.OtherCleanTime != 0)
{
@ -1304,13 +1306,15 @@ namespace OpenSim.Region.Framework.Scenes
DetachFromBackup();
m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString());
m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return");
m_scene.DeRezObject(null, RootPart.LocalId,
RootPart.GroupID, DeRezAction.Return, UUID.Zero);
returns.Add(RootPart.LocalId);
return;
}
}
}
m_scene.DeRezObjects(null, returns, UUID.Zero,
DeRezAction.Return, UUID.Zero);
}
if (HasGroupChanged)

View File

@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

View File

@ -556,7 +556,7 @@ namespace OpenSim.Tests.Common.Setup
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId);
scene.DeRezObjects(client, new List<uint>() { part.LocalId }, UUID.Zero, action, destinationId);
sogd.InventoryDeQueueAndDelete();
}
}