Plumb the path for multiple object deletes

avinationmerge
Melanie 2010-10-06 19:59:30 +02:00
parent ca50f6a82c
commit 42f76773a1
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. // currently calls this with multiple items.
UUID ret = UUID.Zero; UUID ret = UUID.Zero;
Dictionary<UUID, List<SceneObjectGroup>> deletes =
new Dictionary<UUID, List<SceneObjectGroup>>();
foreach (SceneObjectGroup g in objectGroups) 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; return ret;
} }
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, private UUID DeleteToInventory(DeRezAction action, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient) SceneObjectGroup objectGroup, IClientAPI remoteClient)
{ {
UUID assetID = UUID.Zero; UUID assetID = UUID.Zero;
@ -320,10 +331,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
else 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

@ -1688,37 +1688,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, public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
UUID groupID, DeRezAction action, UUID destinationID) UUID groupID, DeRezAction action, UUID destinationID)
{ {
@ -2003,14 +1972,19 @@ namespace OpenSim.Region.Framework.Scenes
return group; 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) foreach (SceneObjectGroup grp in returnobjects)
{ {
AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition,
DeRezObject(null, grp.RootPart.LocalId, "parcel owner return");
grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); localIDs.Add(grp.RootPart.LocalId);
} }
DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return,
UUID.Zero);
return true; return true;
} }

View File

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

View File

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

View File

@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 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); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

View File

@ -556,7 +556,7 @@ namespace OpenSim.Tests.Common.Setup
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false; 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(); sogd.InventoryDeQueueAndDelete();
} }
} }