Fixed a problem with detaching attachments in situations where the user's asset server is not the same as the simulator's asset server. Unfortunately this still continues to be wasteful -- new assets are created every time an attachment is detached, but the process of storing the new asset goes through the InventoryAccess module, which does all sorts of checks regarding the users' inventory.
parent
ab1472e5b7
commit
f7b2aa0f49
|
@ -774,15 +774,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
(sbyte)AssetType.Object,
|
||||
Utils.StringToBytes(sceneObjectXml),
|
||||
sp.UUID);
|
||||
m_scene.AssetService.Store(asset);
|
||||
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
|
||||
|
||||
m_scene.InventoryService.UpdateItem(item);
|
||||
invAccess.UpdateInventoryItemAsset(sp.UUID, item, asset);
|
||||
|
||||
// If the name of the object has been changed whilst attached then we want to update the inventory
|
||||
// item in the viewer.
|
||||
|
|
|
@ -253,6 +253,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return newAssetID;
|
||||
}
|
||||
|
||||
///
|
||||
/// UpdateInventoryItemAsset
|
||||
///
|
||||
public override bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
|
||||
{
|
||||
if (base.UpdateInventoryItemAsset(ownerID, item, asset))
|
||||
{
|
||||
UploadInventoryItem(ownerID, (AssetType)asset.Type, asset.FullID, asset.Name, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Used in DeleteToInventory
|
||||
///
|
||||
|
|
|
@ -293,6 +293,30 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
return UUID.Zero;
|
||||
}
|
||||
|
||||
public virtual bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset)
|
||||
{
|
||||
if (item != null && item.Owner == ownerID && asset != null)
|
||||
{
|
||||
item.AssetID = asset.FullID;
|
||||
item.Description = asset.Description;
|
||||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
|
||||
m_Scene.AssetService.Store(asset);
|
||||
m_Scene.InventoryService.UpdateItem(item);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY ACCESS MODULE]: Given invalid item for inventory update: {0}",
|
||||
(item == null || asset == null? "null item or asset" : "wrong owner"));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public virtual List<InventoryItemBase> CopyToInventory(
|
||||
DeRezAction action, UUID folderID,
|
||||
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient, bool asAttachment)
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
{
|
||||
UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data);
|
||||
|
||||
bool UpdateInventoryItemAsset(UUID ownerID, InventoryItemBase item, AssetBase asset);
|
||||
|
||||
/// <summary>
|
||||
/// Copy objects to a user's inventory.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue