From 0e2b717b4d262363995b2b351b4afe7c84889342 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 7 Dec 2012 20:15:32 -0500 Subject: [PATCH 1/5] * Should promote faster self appearance. --- .../ClientStack/Linden/UDP/LLClientView.cs | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8e0b72fe50..c261f32104 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -459,6 +459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } + private Dictionary agentWearables = new Dictionary(); #endregion Properties @@ -2749,8 +2750,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } - - //m_log.Debug("sending asset " + req.RequestAssetID); + UUID WearableOut = UUID.Zero; + bool isWearable = false; + isWearable = agentWearables.TryGetValue(req.RequestAssetID, out WearableOut); + // m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; Transfer.TransferInfo.Status = 0; @@ -2772,7 +2775,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP Transfer.TransferInfo.Size = req.AssetInf.Data.Length; Transfer.TransferInfo.TransferID = req.TransferRequestID; Transfer.Header.Zerocoded = true; - OutPacket(Transfer, ThrottleOutPacketType.Asset); + OutPacket(Transfer, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); if (req.NumPackets == 1) { @@ -2783,7 +2786,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Data = req.AssetInf.Data; TransferPacket.TransferData.Status = 1; TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); } else { @@ -2816,7 +2819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP TransferPacket.TransferData.Status = 1; } TransferPacket.Header.Zerocoded = true; - OutPacket(TransferPacket, ThrottleOutPacketType.Asset); + OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.State : ThrottleOutPacketType.Asset); processedLength += chunkSize; packetNumber++; @@ -3571,24 +3574,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; AgentWearablesUpdatePacket.WearableDataBlock awb; int idx = 0; - for (int i = 0; i < wearables.Length; i++) + lock (agentWearables) { - for (int j = 0; j < wearables[i].Count; j++) + agentWearables.Clear(); + for (int i = 0; i < wearables.Length; i++) { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte)i; - awb.AssetID = wearables[i][j].AssetID; - awb.ItemID = wearables[i][j].ItemID; - aw.WearableData[idx] = awb; - idx++; + for (int j = 0; j < wearables[i].Count; j++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte) i; + awb.AssetID = wearables[i][j].AssetID; + awb.ItemID = wearables[i][j].ItemID; + agentWearables.Add(awb.AssetID, awb.ItemID); + aw.WearableData[idx] = awb; + idx++; -// m_log.DebugFormat( -// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", -// awb.ItemID, awb.AssetID, i, Name); + // m_log.DebugFormat( + // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", + // awb.ItemID, awb.AssetID, i, Name); + } } } - OutPacket(aw, ThrottleOutPacketType.Task); + OutPacket(aw, ThrottleOutPacketType.State); } public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) @@ -3613,7 +3621,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP avp.Sender.IsTrial = false; avp.Sender.ID = agentID; //m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString()); - OutPacket(avp, ThrottleOutPacketType.Task); + OutPacket(avp, ThrottleOutPacketType.State); } public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) @@ -7770,6 +7778,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; + UUID wearableout = UUID.Zero; + if (agentWearables.TryGetValue(block.Image, out wearableout)) + { + args.Priority *= 2.0f; + } + ImageManager.EnqueueReq(args); } From 6c1a852137e3a66db5befa4c6ec50b3a93268304 Mon Sep 17 00:00:00 2001 From: teravus Date: Sat, 8 Dec 2012 00:05:12 -0500 Subject: [PATCH 2/5] * This is a better way to do the last commit. --- .../ClientStack/Linden/UDP/LLClientView.cs | 61 ++++++++++--------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index c261f32104..7cf6cf1e0c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -459,7 +459,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } - private Dictionary agentWearables = new Dictionary(); + #endregion Properties @@ -585,6 +585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Disable UDP handling for this client m_udpClient.Shutdown(); + //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); @@ -2750,10 +2751,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP req.AssetInf.ID, req.AssetInf.Metadata.ContentType); return; } - UUID WearableOut = UUID.Zero; + int WearableOut = 0; bool isWearable = false; - isWearable = agentWearables.TryGetValue(req.RequestAssetID, out WearableOut); - // m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); + + if (req.AssetInf != null) + isWearable = + ((AssetType) req.AssetInf.Type == + AssetType.Bodypart || (AssetType) req.AssetInf.Type == AssetType.Clothing); + + + //m_log.Debug("sending asset " + req.RequestAssetID + ", iswearable: " + isWearable); + + + //if (isWearable) + // m_log.Debug((AssetType)req.AssetInf.Type); + TransferInfoPacket Transfer = new TransferInfoPacket(); Transfer.TransferInfo.ChannelType = 2; Transfer.TransferInfo.Status = 0; @@ -3574,27 +3586,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count]; AgentWearablesUpdatePacket.WearableDataBlock awb; int idx = 0; - lock (agentWearables) - { - agentWearables.Clear(); - for (int i = 0; i < wearables.Length; i++) - { - for (int j = 0; j < wearables[i].Count; j++) + + for (int i = 0; i < wearables.Length; i++) { - awb = new AgentWearablesUpdatePacket.WearableDataBlock(); - awb.WearableType = (byte) i; - awb.AssetID = wearables[i][j].AssetID; - awb.ItemID = wearables[i][j].ItemID; - agentWearables.Add(awb.AssetID, awb.ItemID); - aw.WearableData[idx] = awb; - idx++; + for (int j = 0; j < wearables[i].Count; j++) + { + awb = new AgentWearablesUpdatePacket.WearableDataBlock(); + awb.WearableType = (byte) i; + awb.AssetID = wearables[i][j].AssetID; + awb.ItemID = wearables[i][j].ItemID; + aw.WearableData[idx] = awb; + idx++; - // m_log.DebugFormat( - // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", - // awb.ItemID, awb.AssetID, i, Name); - } - } - } + // m_log.DebugFormat( + // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", + // awb.ItemID, awb.AssetID, i, Name); + } + } OutPacket(aw, ThrottleOutPacketType.State); } @@ -7777,12 +7785,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // surrounding scene if ((ImageType)block.Type == ImageType.Baked) args.Priority *= 2.0f; - - UUID wearableout = UUID.Zero; - if (agentWearables.TryGetValue(block.Image, out wearableout)) - { - args.Priority *= 2.0f; - } + int wearableout = 0; ImageManager.EnqueueReq(args); } From d1dd5a8ba9f707e63597d42cbe199a3f7ec15fe7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 19 Dec 2012 13:04:41 +0100 Subject: [PATCH 3/5] Add the interfaces for the new Avination baked texture cache service --- .../Interfaces/IBakedTextureModule.cs | 19 +++++++++++++++++++ .../Interfaces/IBakedTextureService.cs | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs create mode 100644 OpenSim/Services/Interfaces/IBakedTextureService.cs diff --git a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs new file mode 100644 index 0000000000..d63898acd8 --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs @@ -0,0 +1,19 @@ +//////////////////////////////////////////////////////////////// +// +// (c) 2009, 2010 Careminster Limited and Melanie Thielker +// +// All rights reserved +// +using System; +using Nini.Config; +using OpenSim.Framework; +using OpenMetaverse; + +namespace OpenSim.Services.Interfaces +{ + public interface IBakedTextureModule + { + AssetBase[] Get(UUID id); + void Store(UUID id, AssetBase[] data); + } +} diff --git a/OpenSim/Services/Interfaces/IBakedTextureService.cs b/OpenSim/Services/Interfaces/IBakedTextureService.cs new file mode 100644 index 0000000000..8206ecd4ab --- /dev/null +++ b/OpenSim/Services/Interfaces/IBakedTextureService.cs @@ -0,0 +1,17 @@ +//////////////////////////////////////////////////////////////// +// +// (c) 2009, 2010 Careminster Limited and Melanie Thielker +// +// All rights reserved +// +using System; +using Nini.Config; + +namespace OpenSim.Services.Interfaces +{ + public interface IBakedTextureService + { + string Get(string id); + void Store(string id, string data); + } +} From f9051c22d8170bb2824d9a38540f2fdce4367f6e Mon Sep 17 00:00:00 2001 From: teravus Date: Wed, 19 Dec 2012 22:14:20 -0500 Subject: [PATCH 4/5] * Send an Unsolicited AgentDataUpdate packet upon Root Agent Status to synchronize with Agni. --- .../Region/Framework/Scenes/ScenePresence.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7ff163b4da..70e7af552d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -925,6 +925,26 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); + UUID groupUUID = UUID.Zero; + string GroupName = string.Empty; + ulong groupPowers = 0; + + // ---------------------------------- + // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status + if (gm != null) + { + groupUUID = ControllingClient.ActiveGroupId; + GroupRecord record = gm.GetGroupRecord(groupUUID); + if (record != null) + GroupName = record.GroupName; + GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); + if (groupMembershipData != null) + groupPowers = groupMembershipData.GroupPowers; + } + ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, + Grouptitle); + // ------------------------------------ + if (ParentID == 0) { // Moved this from SendInitialData to ensure that Appearance is initialized From 77cc7ce399d1b1a710f3b3f4337932febdef66c8 Mon Sep 17 00:00:00 2001 From: teravus Date: Fri, 21 Dec 2012 19:12:30 -0500 Subject: [PATCH 5/5] * Partial Commit for Avatar Appearance to include the functionality of Cached Bakes. --- .../UploadBakedTextureHandler.cs | 2 +- OpenSim/Framework/AvatarAppearance.cs | 8 +++- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Framework/WearableCacheItem.cs | 39 +++++++++++++++++++ .../ClientStack/Linden/UDP/LLClientView.cs | 26 ++++++++++--- .../AvatarFactory/AvatarFactoryModule.cs | 34 +++++++++++----- .../Tests/AvatarFactoryModuleTests.cs | 4 +- .../Interfaces/IAvatarFactoryModule.cs | 6 ++- .../Region/Framework/Scenes/ScenePresence.cs | 27 ++++++++----- .../Server/IRCClientView.cs | 2 +- .../World/NPC/Tests/NPCModuleTests.cs | 2 +- .../Tests/Performance/NPCPerformanceTests.cs | 2 +- 12 files changed, 120 insertions(+), 34 deletions(-) create mode 100644 OpenSim/Framework/WearableCacheItem.cs diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 8849a59ce3..4fa604fc30 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -117,7 +117,7 @@ namespace OpenSim.Capabilities.Handlers /// private void BakedTextureUploaded(UUID assetID, byte[] data) { -// m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString()); + m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString()); AssetBase asset; asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 2183fb6c8a..4df4fb6717 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -66,7 +66,7 @@ namespace OpenSim.Framework protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); protected float m_avatarFeetOffset = 0; protected float m_avatarAnimOffset = 0; - + protected WearableCacheItem[] cacheitems; public virtual int Serial { get { return m_serial; } @@ -115,6 +115,12 @@ namespace OpenSim.Framework get { return m_avatarHeight; } set { m_avatarHeight = value; } } + + public virtual WearableCacheItem[] WearableCacheItems + { + get { return cacheitems; } + set { cacheitems = value; } + } public AvatarAppearance() { diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c9b67defdf..04650425bf 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -64,7 +64,7 @@ namespace OpenSim.Framework public delegate void NetworkStats(int inPackets, int outPackets, int unAckedBytes); - public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize); + public delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems); public delegate void StartAnim(IClientAPI remoteClient, UUID animID); diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs new file mode 100644 index 0000000000..83b1346230 --- /dev/null +++ b/OpenSim/Framework/WearableCacheItem.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public class WearableCacheItem + { + public uint TextureIndex { get; set; } + public UUID CacheId { get; set; } + public UUID TextureID { get; set; } + } +} diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 363ee54287..d18b026bc8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6298,12 +6298,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP byte[] visualparams = new byte[appear.VisualParam.Length]; for (int i = 0; i < appear.VisualParam.Length; i++) visualparams[i] = appear.VisualParam[i].ParamValue; - + //var b = appear.WearableData[0]; + Primitive.TextureEntry te = null; if (appear.ObjectData.TextureEntry.Length > 1) te = new Primitive.TextureEntry(appear.ObjectData.TextureEntry, 0, appear.ObjectData.TextureEntry.Length); + + WearableCacheItem[] cacheitems = new WearableCacheItem[appear.WearableData.Length]; + for (int i=0; i(); + // var item = fac.GetBakedTextureFaces(AgentId); + //WearableCacheItem[] items = fac.GetCachedItems(AgentId); + IImprovedAssetCache cache = m_scene.RequestModuleInterface(); if (cache == null) { @@ -11720,7 +11732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].TextureID = UUID.Zero; //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } @@ -11730,10 +11742,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock(); cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex; - if(cache.Check(cachedtex.WearableData[i].ID.ToString())) + + + + if (cache.Check(cachedtex.WearableData[i].ID.ToString())) cachedresp.WearableData[i].TextureID = UUID.Zero; + //UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); else - cachedresp.WearableData[i].TextureID = UUID.Zero; + cachedresp.WearableData[i].TextureID = UUID.Zero; // UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46"); cachedresp.WearableData[i].HostName = new byte[0]; } } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 3532b1dfe2..3080023c0f 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -140,18 +140,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - public void SetAppearance(IScenePresence sp, AvatarAppearance appearance) + public void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems) { - SetAppearance(sp, appearance.Texture, appearance.VisualParams); + SetAppearance(sp, appearance.Texture, appearance.VisualParams, cacheItems); } - public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) + public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) { float oldoff = sp.Appearance.AvatarFeetOffset; Vector3 oldbox = sp.Appearance.AvatarBoxSize; - SetAppearance(sp, textureEntry, visualParams); + SetAppearance(sp, textureEntry, visualParams, cacheItems); sp.Appearance.SetSize(avSize); float off = sp.Appearance.AvatarFeetOffset; @@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams) + public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems) { // m_log.DebugFormat( // "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}", @@ -205,11 +205,14 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory // ((ScenePresence)sp).SetSize(box,off); } - + //if (cacheItems.Length > 0) + //{ + sp.Appearance.WearableCacheItems = cacheItems; + //} // Process the baked texture array if (textureEntry != null) { -// m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); + m_log.DebugFormat("[AVFACTORY]: Received texture update for {0} {1}", sp.Name, sp.UUID); // WriteBakedTexturesReport(sp, m_log.DebugFormat); @@ -278,6 +281,19 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return GetBakedTextureFaces(sp); } + public WearableCacheItem[] GetCachedItems(UUID agentId) + { + ScenePresence sp = m_scene.GetScenePresence(agentId); + Dictionary bakedTextures = GetBakedTextureFaces(sp); + + WearableCacheItem[] items = sp.Appearance.WearableCacheItems; + //foreach (WearableCacheItem item in items) + //{ + + //} + return items; + } + public bool SaveBakedTextures(UUID agentId) { ScenePresence sp = m_scene.GetScenePresence(agentId); @@ -660,12 +676,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize) + private void Client_OnSetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems) { // m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance called for {0} ({1})", client.Name, client.AgentId); ScenePresence sp = m_scene.GetScenePresence(client.AgentId); if (sp != null) - SetAppearance(sp, textureEntry, visualParams,avSize); + SetAppearance(sp, textureEntry, visualParams,avSize, cacheItems); else m_log.WarnFormat("[AVFACTORY]: Client_OnSetAppearance unable to find presence for {0}", client.AgentId); } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 848b3bfc08..e21547ca6a 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory for (byte i = 0; i < visualParams.Length; i++) visualParams[i] = i; - afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); + afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]); // TODO: Check baked texture Assert.AreEqual(visualParams, sp.Appearance.VisualParams); @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); eyesFace.TextureID = eyesTextureId; - afm.SetAppearance(sp, bakedTextureEntry, visualParams); + afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]); afm.SaveBakedTextures(userId); // Dictionary bakedTextures = afm.GetBakedTextureFaces(userId); diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs index 34aca33349..d25c930d8b 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs @@ -35,8 +35,8 @@ namespace OpenSim.Region.Framework.Interfaces public interface IAvatarFactoryModule { - void SetAppearance(IScenePresence sp, AvatarAppearance appearance); - void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams); + void SetAppearance(IScenePresence sp, AvatarAppearance appearance, WearableCacheItem[] cacheItems); + void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams, WearableCacheItem[] cacheItems); /// /// Send the appearance of an avatar to others in the scene. @@ -52,6 +52,8 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if this agent has no baked textures (e.g. because it's a child agent) Dictionary GetBakedTextureFaces(UUID agentId); + + WearableCacheItem[] GetCachedItems(UUID agentId); /// /// Save the baked textures for the given agent permanently in the asset database. /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 70e7af552d..ff9df37dba 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -931,18 +931,25 @@ namespace OpenSim.Region.Framework.Scenes // ---------------------------------- // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status - if (gm != null) + try { - groupUUID = ControllingClient.ActiveGroupId; - GroupRecord record = gm.GetGroupRecord(groupUUID); - if (record != null) - GroupName = record.GroupName; - GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); - if (groupMembershipData != null) - groupPowers = groupMembershipData.GroupPowers; + if (gm != null) + { + groupUUID = ControllingClient.ActiveGroupId; + GroupRecord record = gm.GetGroupRecord(groupUUID); + if (record != null) + GroupName = record.GroupName; + GroupMembershipData groupMembershipData = gm.GetMembershipData(groupUUID, m_uuid); + if (groupMembershipData != null) + groupPowers = groupMembershipData.GroupPowers; + } + ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, + Grouptitle); + } + catch (Exception e) + { + m_log.Debug("[AGENTUPDATE]: " + e.ToString()); } - ControllingClient.SendAgentDataUpdate(m_uuid, groupUUID, Firstname, Lastname, groupPowers, GroupName, - Grouptitle); // ------------------------------------ if (ParentID == 0) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 1b4ed1e76e..5ac4e27d71 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -911,7 +911,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server // Mimicking LLClientView which gets always set appearance from client. AvatarAppearance appearance; m_scene.GetAvatarAppearance(this, out appearance); - OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize); + OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize, new WearableCacheItem[0]); } public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 52ed8468c6..ef4005b43f 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -108,7 +108,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // ScenePresence.SendInitialData() to reset our entire appearance. m_scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); - m_afMod.SetAppearance(sp, originalTe, null); + m_afMod.SetAppearance(sp, originalTe, null, new WearableCacheItem[0] ); UUID npcId = m_npcMod.CreateNPC("John", "Smith", new Vector3(128, 128, 30), UUID.Zero, true, m_scene, sp.Appearance); diff --git a/OpenSim/Tests/Performance/NPCPerformanceTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs index 627765b325..afda574cc7 100644 --- a/OpenSim/Tests/Performance/NPCPerformanceTests.cs +++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs @@ -144,7 +144,7 @@ namespace OpenSim.Tests.Performance // ScenePresence.SendInitialData() to reset our entire appearance. scene.AssetService.Store(AssetHelpers.CreateNotecardAsset(originalFace8TextureId)); - afm.SetAppearance(sp, originalTe, null); + afm.SetAppearance(sp, originalTe, null, new WearableCacheItem[0]); INPCModule npcModule = scene.RequestModuleInterface();