From 1ff9709ea3d5e7c9ef21f6f59ae0dce62dd7b1c4 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 28 Oct 2008 21:31:23 +0000 Subject: [PATCH] * Possibly fix grey avatar appearance problems * And hopefully rebaking all the time should no longer be necessary now * It turns out that when the client baked the texture, the uploaded asset had the Temporary flag to true (Temporary is actually deprecated). * It also had the StoreLocal flag set to true, which signifies that the asset should be stored locally. If it disappears we should reply to the asset request with ImageNotInDatabasePacket * However, last time this was enabled some clients started crashing. This may well no longer be the case and needs to be tested, but in the mean time we will store the asset instead. * This needs to be resolved in a better way, possibly by starting to send the ImageNotInDatabase packet again instead --- OpenSim/Framework/AvatarAppearance.cs | 25 ++++++++++++---- OpenSim/Framework/AvatarWearable.cs | 10 +++---- .../Communications/Cache/AssetCache.cs | 29 +++++++++++++++++-- .../ClientStack/LindenUDP/LLClientView.cs | 7 ++++- .../Environment/Scenes/ScenePresence.cs | 4 +-- 5 files changed, 58 insertions(+), 17 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 0c0cfd54cf..e1d0bbe8c2 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -28,8 +28,10 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Reflection; using System.Runtime.Serialization; using System.Security.Permissions; +using log4net; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; @@ -39,6 +41,9 @@ namespace OpenSim.Framework [Serializable] public class AvatarAppearance : ISerializable { +// private static readonly ILog m_log +// = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + // these are guessed at by the list here - // http://wiki.secondlife.com/wiki/Avatar_Appearance. We'll // correct them over time for when were are wrong. @@ -258,7 +263,7 @@ namespace OpenSim.Framework } /// - /// + /// Set up appearance textures and avatar parameters, including a height calculation /// /// /// @@ -266,7 +271,15 @@ namespace OpenSim.Framework { Primitive.TextureEntry textureEnt = new Primitive.TextureEntry(texture, 0, texture.Length); m_texture = textureEnt; - + +// m_log.DebugFormat("[APPEARANCE]: Setting an avatar appearance with {0} faces", m_texture.FaceTextures.Length); +// for (int i = 0; i < m_texture.FaceTextures.Length; i++) +// { +// Primitive.TextureEntryFace face = m_texture.FaceTextures[i]; +// String textureIdString = (face != null ? face.TextureID.ToString() : "none"); +// m_log.DebugFormat("[APPEARANCE]: Texture {0} is {1}", i, textureIdString); +// } + m_visualparams = visualParam.ToArray(); // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. @@ -297,10 +310,10 @@ namespace OpenSim.Framework public override String ToString() { String s = "[Wearables] =>"; - s += "Body Item: " + BodyItem.ToString() + ";"; - s += "Skin Item: " + SkinItem.ToString() + ";"; - s += "Shirt Item: " + ShirtItem.ToString() + ";"; - s += "Pants Item: " + PantsItem.ToString() + ";"; + s += " Body Item: " + BodyItem.ToString() + ";"; + s += " Skin Item: " + SkinItem.ToString() + ";"; + s += " Shirt Item: " + ShirtItem.ToString() + ";"; + s += " Pants Item: " + PantsItem.ToString() + ";"; return s; } diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 62971ea78d..52f162eb78 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -73,19 +73,19 @@ namespace OpenSim.Framework } // Body - defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); - defaultWearables[0].ItemID = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); + defaultWearables[0].ItemID = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); + defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); // Skin - defaultWearables[1].ItemID = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9"); + defaultWearables[1].ItemID = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9"); defaultWearables[1].AssetID = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); // Shirt - defaultWearables[4].ItemID = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); + defaultWearables[4].ItemID = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); defaultWearables[4].AssetID = new UUID("00000000-38f9-1111-024e-222222111110"); // Pants - defaultWearables[5].ItemID = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); + defaultWearables[5].ItemID = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); defaultWearables[5].AssetID = new UUID("00000000-38f9-1111-024e-222222111120"); return defaultWearables; diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs index 1a442ea2bf..1ae7eb71c4 100644 --- a/OpenSim/Framework/Communications/Cache/AssetCache.cs +++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs @@ -334,6 +334,10 @@ namespace OpenSim.Framework.Communications.Cache /// public void AddAsset(AssetBase asset) { +// m_log.DebugFormat( +// "[ASSET CACHE]: Uploaded asset {0}, temporary {1}, store local {2}", +// asset.ID, asset.Temporary, asset.Local); + if (asset.Type == (int)AssetType.Texture) { if (!Textures.ContainsKey(asset.FullID)) @@ -344,11 +348,23 @@ namespace OpenSim.Framework.Communications.Cache if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.AddTexture(textur); - if (!asset.Temporary) + // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the + // information is stored locally. It could disappear, in which case we could send the + // ImageNotInDatabase packet to tell the client this. However, when this was enabled in + // TextureNotFoundSender it ended up crashing clients - we need to go back and try this again. + // + // In the mean time, we're just going to push local assets to the permanent store instead. + // TODO: Need to come back and address this. + // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. + if (!asset.Temporary || asset.Local) { m_assetServer.StoreAsset(asset); } } +// else +// { +// m_log.DebugFormat("[ASSET CACHE]: Textures already contains {0}", asset.ID); +// } } else { @@ -360,11 +376,16 @@ namespace OpenSim.Framework.Communications.Cache if (StatsManager.SimExtraStats != null) StatsManager.SimExtraStats.AddAsset(assetInf); - if (!asset.Temporary) + // See comment above. + if (!asset.Temporary || asset.Local) { m_assetServer.StoreAsset(asset); } } +// else +// { +// m_log.DebugFormat("[ASSET CACHE]: Assets already contains {0}", asset.ID); +// } } } @@ -394,6 +415,8 @@ namespace OpenSim.Framework.Communications.Cache // See IAssetReceiver public void AssetReceived(AssetBase asset, bool IsTexture) { +// m_log.DebugFormat("[ASSET CACHE]: Received asset {0}", asset.ID); + //check if it is a texture or not //then add to the correct cache list //then check for waiting requests for this asset/texture (in the Requested lists) @@ -464,7 +487,7 @@ namespace OpenSim.Framework.Communications.Cache // See IAssetReceiver public void AssetNotFound(UUID assetID, bool IsTexture) { - //m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); +// m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); if (IsTexture) { diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index aaa5e1ce97..86ec7e245b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2239,6 +2239,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP awb.AssetID = wearables[i].AssetID; awb.ItemID = wearables[i].ItemID; aw.WearableData[i] = awb; + +// m_log.DebugFormat( +// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", +// awb.ItemID, awb.AssetID, i, Name); } OutPacket(aw, ThrottleOutPacketType.Task); @@ -4205,6 +4209,8 @@ Console.WriteLine(msgpack.ToString()); if (handlerRequestWearables != null) { + m_log.DebugFormat("[APPEARANCE]: Wearables requested by {0}", Name); + handlerRequestWearables(); } @@ -7076,7 +7082,6 @@ Console.WriteLine(msgpack.ToString()); public void SendAsset(AssetRequestToClient req) { - //Console.WriteLine("sending asset " + req.RequestAssetID); TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 7bc0360314..5a28f2fce1 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1851,7 +1851,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.DebugFormat("[APPEARANCE]: Sending wearables to {0}", Name); ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); - // ControllingClient.SendAppearance( + //ControllingClient.SendAppearance( // m_appearance.Owner, // m_appearance.VisualParams, // m_appearance.Texture.ToBytes() @@ -1896,7 +1896,7 @@ namespace OpenSim.Region.Environment.Scenes m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); SendAppearanceToAllOtherAgents(); - SendWearables(); + //SendWearables(); } public void SetWearable(int wearableId, AvatarWearable wearable)