From 84c2a72140822fc28da3590b48db392d132ef0ea Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 25 Mar 2007 20:23:06 +0000 Subject: [PATCH] Hopefully fixed the texture uploading and the crashing when a prim with a uploaded texture on it is moved. --- OpenSim.RegionServer/AgentAssetUpload.cs | 6 ++---- OpenSim.RegionServer/Assets/AssetCache.cs | 18 ++++++++++++------ OpenSim.RegionServer/Assets/InventoryCache.cs | 6 +++--- OpenSim.RegionServer/SimClient.cs | 16 ++++++++-------- OpenSim.RegionServer/world/Primitive.cs | 8 +++++--- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/OpenSim.RegionServer/AgentAssetUpload.cs b/OpenSim.RegionServer/AgentAssetUpload.cs index 2b4d78fe8b..5d40c88f63 100644 --- a/OpenSim.RegionServer/AgentAssetUpload.cs +++ b/OpenSim.RegionServer/AgentAssetUpload.cs @@ -20,7 +20,6 @@ namespace OpenSim public void AddUpload(LLUUID transactionID, AssetBase asset) { - Console.WriteLine("adding upload asset"); AssetTransaction upload = new AssetTransaction(); lock (this.transactions) { @@ -40,7 +39,6 @@ namespace OpenSim } else { - Console.WriteLine(" no data in upload request so use xfer system"); upload.UploadComplete = false; upload.XferID = Util.GetNextXferID(); RequestXferPacket xfer = new RequestXferPacket(); @@ -155,7 +153,7 @@ namespace OpenSim OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, trans.InventFolder, trans.Asset); } - Console.WriteLine(Helpers.FieldToString(trans.Asset.Data)); + } break; } @@ -183,7 +181,7 @@ namespace OpenSim { //already complete so we can add it to the inventory OpenSimRoot.Instance.AssetCache.AddAsset(trans.Asset); - OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset); + Console.WriteLine( "ITem created is " +OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this.ourClient, packet.InventoryBlock.FolderID, trans.Asset).ToStringHyphenated()); } else { diff --git a/OpenSim.RegionServer/Assets/AssetCache.cs b/OpenSim.RegionServer/Assets/AssetCache.cs index c1b3472892..3c28e1c6c0 100644 --- a/OpenSim.RegionServer/Assets/AssetCache.cs +++ b/OpenSim.RegionServer/Assets/AssetCache.cs @@ -139,17 +139,23 @@ namespace OpenSim.Assets 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); + if (!this.Textures.ContainsKey(asset.FullID)) + { //texture + TextureImage textur = new TextureImage(asset); + this.Textures.Add(textur.FullID, textur); + this._assetServer.UploadNewAsset(asset); + } } else { - AssetInfo assetInf = new AssetInfo(asset); - this.Assets.Add(assetInf.FullID, assetInf); + if (!this.Assets.ContainsKey(asset.FullID)) + { + AssetInfo assetInf = new AssetInfo(asset); + this.Assets.Add(assetInf.FullID, assetInf); + this._assetServer.UploadNewAsset(asset); + } } } diff --git a/OpenSim.RegionServer/Assets/InventoryCache.cs b/OpenSim.RegionServer/Assets/InventoryCache.cs index 9e73fe555b..f50047a643 100644 --- a/OpenSim.RegionServer/Assets/InventoryCache.cs +++ b/OpenSim.RegionServer/Assets/InventoryCache.cs @@ -191,10 +191,10 @@ namespace OpenSim.Assets InventoryReply.InventoryData[0].AssetID = Item.AssetID; InventoryReply.InventoryData[0].CreatorID = Item.CreatorID; InventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; - InventoryReply.InventoryData[0].CreationDate = 1000; + InventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; - InventoryReply.InventoryData[0].Flags = 1; + InventoryReply.InventoryData[0].Flags = 0; InventoryReply.InventoryData[0].FolderID = Item.FolderID; InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; @@ -228,7 +228,7 @@ namespace OpenSim.Assets InventoryReply.InventoryData[0].CreationDate = 1000; InventoryReply.InventoryData[0].Description = _enc.GetBytes(Item.Description + "\0"); InventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; - InventoryReply.InventoryData[0].Flags = 1; + InventoryReply.InventoryData[0].Flags = 0; InventoryReply.InventoryData[0].FolderID = Item.FolderID; InventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); InventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs index 9ae1bafd70..dea385c360 100644 --- a/OpenSim.RegionServer/SimClient.cs +++ b/OpenSim.RegionServer/SimClient.cs @@ -281,15 +281,15 @@ namespace OpenSim case PacketType.AssetUploadRequest: //this.debug = true; AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack; - Console.WriteLine(Pack.ToString()); - if (request.AssetBlock.Type == 0) - { - this.UploadAssets.HandleUploadPacket(request, LLUUID.Random()); - } - else - { + // Console.WriteLine(Pack.ToString()); + // if (request.AssetBlock.Type == 0) + // { + //this.UploadAssets.HandleUploadPacket(request, LLUUID.Random()); + //} + //else + //{*/ this.UploadAssets.HandleUploadPacket(request, request.AssetBlock.TransactionID.Combine(this.SecureSessionID)); - } + //} break; case PacketType.SendXferPacket: Console.WriteLine(Pack.ToString()); diff --git a/OpenSim.RegionServer/world/Primitive.cs b/OpenSim.RegionServer/world/Primitive.cs index b190d818df..6ff66a3847 100644 --- a/OpenSim.RegionServer/world/Primitive.cs +++ b/OpenSim.RegionServer/world/Primitive.cs @@ -220,7 +220,8 @@ namespace OpenSim.world public void UpdateTexture(byte[] tex) { - this.primData.Texture = this.OurPacket.ObjectData[0].TextureEntry = tex; + this.OurPacket.ObjectData[0].TextureEntry = tex; + this.primData.Texture = tex; this.dirtyFlag = true; } @@ -401,8 +402,9 @@ namespace OpenSim.world int i = 0; ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); - dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; - + //dat.TextureEntry = this.OurPacket.ObjectData[0].TextureEntry; + dat.TextureEntry = new byte[0]; + //Console.WriteLine("texture-entry length in improvedterse block is " + this.OurPacket.ObjectData[0].TextureEntry.Length); bytes[i++] = (byte)(ID % 256); bytes[i++] = (byte)((ID >> 8) % 256); bytes[i++] = (byte)((ID >> 16) % 256);