mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
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.
This commit is contained in:
@@ -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
|
||||
///
|
||||
|
||||
@@ -292,7 +292,31 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user