From 40af8c256165eb6fb56f58e3c13ee9293e052f66 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 25 Mar 2007 17:34:58 +0000 Subject: You want large textures, you shall have! - Xfer system now working for large asset uploads Fixed the VS solution file. Now forwars ViewerEffect messages onto the other clients Renamed OpenSim.Framework/Inventory.cs to OpenSim.Framework/AgentInventory.cs --- OpenSim.RegionServer/Assets/AssetCache.cs | 79 +++++++++++---------------- OpenSim.RegionServer/Assets/InventoryCache.cs | 27 ++++++++- 2 files changed, 57 insertions(+), 49 deletions(-) (limited to 'OpenSim.RegionServer/Assets') diff --git a/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim.RegionServer/Assets/AssetCache.cs index 4149cb2..c1b3472 100644 --- a/OpenSim.RegionServer/Assets/AssetCache.cs +++ b/OpenSim.RegionServer/Assets/AssetCache.cs @@ -123,6 +123,36 @@ namespace OpenSim.Assets return inventorySet; } + public AssetBase GetAsset(LLUUID assetID) + { + AssetBase asset = null; + if(this.Textures.ContainsKey(assetID)) + { + asset = this.Textures[assetID]; + } + else if (this.Assets.ContainsKey(assetID)) + { + asset = this.Assets[assetID]; + } + return asset; + } + + public void AddAsset(AssetBase asset) + { + this._assetServer.UploadNewAsset(asset); + if (asset.Type == 0) + { + //texture + TextureImage textur = new TextureImage(asset); + this.Textures.Add(textur.FullID, textur); + } + else + { + AssetInfo assetInf = new AssetInfo(asset); + this.Assets.Add(assetInf.FullID, assetInf); + } + } + /// /// /// @@ -150,7 +180,7 @@ namespace OpenSim.Assets req = (AssetRequest)this.TextureRequests[i]; if (req.PacketCounter != req.NumPackets) { - + // if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005")) if (req.PacketCounter == 0) { //first time for this request so send imagedata packet @@ -186,7 +216,7 @@ namespace OpenSim.Assets } else { - //send imagepacket + //send imagepacket //more than one packet so split file up ImagePacketPacket im = new ImagePacketPacket(); im.ImageID.Packet = (ushort)req.PacketCounter; @@ -461,7 +491,6 @@ namespace OpenSim.Assets { req.NumPackets = 1; } - this.TextureRequests.Add(req); } @@ -477,50 +506,6 @@ namespace OpenSim.Assets } #endregion - #region viewer asset uploading - public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID) - { - - AssetBase asset = null; - if (pack.AssetBlock.Type == 0) - { - if (pack.AssetBlock.AssetData.Length > 0) - { - //first packet for transaction - asset = new AssetBase(); - asset.FullID = assetID; - asset.Type = pack.AssetBlock.Type; - asset.InvType = asset.Type; - asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); - asset.Data = pack.AssetBlock.AssetData; - this._assetServer.UploadNewAsset(asset); - TextureImage image = new TextureImage(asset); - this.Textures.Add(image.FullID, image); - } - } - - return asset; - } - - /* - public AssetBase TransactionComplete(LLUUID transactionID) - { - AssetBase asset = null; - if(this.IncomingAssets.ContainsKey(transactionID)) - { - // not the first packet of this transaction - asset = this.IncomingAssets[transactionID]; - if(asset.Type == 0) - { - TextureImage image = new TextureImage(asset); - this.Textures.Add(image.FullID, image); - } - } - return asset; - }*/ - - #endregion - } public class AssetRequest diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs index e4d0a90..9e73fe5 100644 --- a/OpenSim.RegionServer/Assets/InventoryCache.cs +++ b/OpenSim.RegionServer/Assets/InventoryCache.cs @@ -65,14 +65,20 @@ namespace OpenSim.Assets } } + public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID) { + return this.CreateNewInventoryFolder(remoteClient, folderID, 0); + } + + public bool CreateNewInventoryFolder(SimClient remoteClient, LLUUID folderID, ushort type) + { bool res = false; if (folderID != LLUUID.Zero) //don't create a folder with a zero id { if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) { - res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID); + res = this._agentsInventory[remoteClient.AgentID].CreateNewFolder(folderID, type); } } return res; @@ -94,6 +100,22 @@ namespace OpenSim.Assets return newItem; } + public bool UpdateInventoryItem(SimClient remoteClient, LLUUID itemID, OpenSim.Framework.Assets.AssetBase asset) + { + if (this._agentsInventory.ContainsKey(remoteClient.AgentID)) + { + bool res = _agentsInventory[remoteClient.AgentID].UpdateItem(itemID, asset); + if (res) + { + InventoryItem Item = this._agentsInventory[remoteClient.AgentID].InventoryItems[itemID]; + this.SendItemUpdateCreate(remoteClient, Item); + } + return res; + } + + return false; + } + public void FetchInventoryDescendents(SimClient userInfo, FetchInventoryDescendentsPacket FetchDescend) { if (this._agentsInventory.ContainsKey(userInfo.AgentID)) @@ -190,6 +212,7 @@ namespace OpenSim.Assets } } } + private void SendItemUpdateCreate(SimClient remoteClient, InventoryItem Item) { @@ -223,7 +246,7 @@ namespace OpenSim.Assets } } - + public class UserServerRequest { -- cgit v1.1