refactor: split out the code which actually copies a particular bundle to inventory
parent
71114d4ad1
commit
61619ddefc
|
@ -214,18 +214,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a scene object from a scene and place in the given avatar's inventory.
|
||||
/// Returns the UUID of the newly created asset.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="objectGroup"></param>
|
||||
/// <param name="remoteClient"> </param>
|
||||
public virtual UUID CopyToInventory(DeRezAction action, UUID folderID,
|
||||
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
|
||||
{
|
||||
Dictionary<UUID, List<SceneObjectGroup>> deletes = new Dictionary<UUID, List<SceneObjectGroup>>();
|
||||
Dictionary<UUID, List<SceneObjectGroup>> bundlesToCopy = new Dictionary<UUID, List<SceneObjectGroup>>();
|
||||
|
||||
if (CoalesceMultipleObjectsToInventory)
|
||||
{
|
||||
|
@ -234,10 +226,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
// reasons.
|
||||
foreach (SceneObjectGroup g in objectGroups)
|
||||
{
|
||||
if (!deletes.ContainsKey(g.OwnerID))
|
||||
deletes[g.OwnerID] = new List<SceneObjectGroup>();
|
||||
if (!bundlesToCopy.ContainsKey(g.OwnerID))
|
||||
bundlesToCopy[g.OwnerID] = new List<SceneObjectGroup>();
|
||||
|
||||
deletes[g.OwnerID].Add(g);
|
||||
bundlesToCopy[g.OwnerID].Add(g);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -247,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
{
|
||||
List<SceneObjectGroup> bundle = new List<SceneObjectGroup>();
|
||||
bundle.Add(g);
|
||||
deletes[g.UUID] = bundle;
|
||||
bundlesToCopy[g.UUID] = bundle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,8 +249,26 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
// Each iteration is really a separate asset being created,
|
||||
// with distinct destinations as well.
|
||||
foreach (List<SceneObjectGroup> objlist in deletes.Values)
|
||||
foreach (List<SceneObjectGroup> bundle in bundlesToCopy.Values)
|
||||
assetID = CopyBundleToInventory(action, folderID, bundle, remoteClient);
|
||||
|
||||
return assetID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy a bundle of objects to inventory. If there is only one object, then this will create an object
|
||||
/// item. If there are multiple objects then these will be saved as a single coalesced item.
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="objlist"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <returns></returns>
|
||||
protected UUID CopyBundleToInventory(
|
||||
DeRezAction action, UUID folderID, List<SceneObjectGroup> objlist, IClientAPI remoteClient)
|
||||
{
|
||||
UUID assetID = UUID.Zero;
|
||||
|
||||
CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
|
||||
Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
|
||||
|
||||
|
@ -362,7 +372,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
|
||||
// This is a hook to do some per-asset post-processing for subclasses that need that
|
||||
ExportAsset(remoteClient.AgentId, assetID);
|
||||
}
|
||||
|
||||
return assetID;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue