From 531f64a53bbd084dd8d0b33ae6c49821c74d718a Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 16 Aug 2007 16:31:32 +0000 Subject: Taking Prims (SceneObjectGroups) in and out of inventory should now work and if left in inventory will still be there after restarts. (as with the rest of inventory it will only fully work in standalone mode with account authentication turned on). --- .../Framework/Communications/Cache/AssetCache.cs | 69 ++++++++++++++-------- 1 file changed, 43 insertions(+), 26 deletions(-) (limited to 'OpenSim/Framework/Communications/Cache/AssetCache.cs') diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 3866e21..c08bef2 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -137,6 +137,16 @@ namespace OpenSim.Framework.Communications.Caches return asset; } + public AssetBase GetAsset(LLUUID assetID, bool isTexture) + { + AssetBase asset = GetAsset(assetID); + if (asset == null) + { + this._assetServer.RequestAsset(assetID, isTexture); + } + return asset; + } + public void AddAsset(AssetBase asset) { // Console.WriteLine("adding asset " + asset.FullID.ToStringHyphenated()); @@ -241,44 +251,51 @@ namespace OpenSim.Framework.Communications.Caches if (IsTexture) { // Console.WriteLine("asset recieved from asset server"); + TextureImage image = new TextureImage(asset); - this.Textures.Add(image.FullID, image); - if (this.RequestedTextures.ContainsKey(image.FullID)) + if (!this.Textures.ContainsKey(image.FullID)) { - AssetRequest req = this.RequestedTextures[image.FullID]; - req.ImageInfo = image; - if (image.Data.LongLength > 600) - { - //over 600 bytes so split up file - req.NumPackets = 1 + (int)(image.Data.Length - 600 ) / 1000; - } - else + this.Textures.Add(image.FullID, image); + if (this.RequestedTextures.ContainsKey(image.FullID)) { - req.NumPackets = 1; + AssetRequest req = this.RequestedTextures[image.FullID]; + req.ImageInfo = image; + if (image.Data.LongLength > 600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(image.Data.Length - 600) / 1000; + } + else + { + req.NumPackets = 1; + } + this.RequestedTextures.Remove(image.FullID); + this.TextureRequests.Add(req); } - this.RequestedTextures.Remove(image.FullID); - this.TextureRequests.Add(req); } } else { AssetInfo assetInf = new AssetInfo(asset); - this.Assets.Add(assetInf.FullID, assetInf); - if (this.RequestedAssets.ContainsKey(assetInf.FullID)) + if (!this.Assets.ContainsKey(assetInf.FullID)) { - AssetRequest req = this.RequestedAssets[assetInf.FullID]; - req.AssetInf = assetInf; - if (assetInf.Data.LongLength > 600) - { - //over 600 bytes so split up file - req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; - } - else + this.Assets.Add(assetInf.FullID, assetInf); + if (this.RequestedAssets.ContainsKey(assetInf.FullID)) { - req.NumPackets = 1; + AssetRequest req = this.RequestedAssets[assetInf.FullID]; + req.AssetInf = assetInf; + if (assetInf.Data.LongLength > 600) + { + //over 600 bytes so split up file + req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000; + } + else + { + req.NumPackets = 1; + } + this.RequestedAssets.Remove(assetInf.FullID); + this.AssetRequests.Add(req); } - this.RequestedAssets.Remove(assetInf.FullID); - this.AssetRequests.Add(req); } } } -- cgit v1.1