From f5c9a56c8b73ef93db712fefe9f0366c4983e04f Mon Sep 17 00:00:00 2001 From: Master ScienceSim Date: Fri, 29 Oct 2010 13:37:13 -0700 Subject: Bunch of fixes that reduce the number of times appearance and avatar data are sent. And the number of times they are stored. --- OpenSim/Framework/AvatarAppearance.cs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index e66a1e7..17e4eb4 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -45,6 +45,7 @@ namespace OpenSim.Framework public readonly static int VISUALPARAM_COUNT = 218; public readonly static int TEXTURE_COUNT = 21; + public readonly static byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; protected UUID m_owner; protected int m_serial = 1; @@ -347,14 +348,8 @@ namespace OpenSim.Framework protected virtual void SetDefaultTexture() { m_texture = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); - // The initialization of these seems to force a rebake regardless of whether it is needed - // m_textures.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); - // m_textures.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; - // m_textures.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; - // m_textures.CreateFace(3).TextureID = new UUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); - // m_textures.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); - // m_textures.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); - // m_textures.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); + for (uint i = 0; i < TEXTURE_COUNT; i++) + m_texture.CreateFace(i).TextureID = new UUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE); } /// @@ -371,7 +366,7 @@ namespace OpenSim.Framework // made. We determine if any of the textures actually // changed to know if the appearance should be saved later bool changed = false; - for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) + for (uint i = 0; i < AvatarAppearance.TEXTURE_COUNT; i++) { Primitive.TextureEntryFace newface = textureEntry.FaceTextures[i]; Primitive.TextureEntryFace oldface = m_texture.FaceTextures[i]; @@ -385,7 +380,6 @@ namespace OpenSim.Framework if (oldface != null && oldface.TextureID == newface.TextureID) continue; } - m_texture.FaceTextures[i] = (newface != null) ? new Primitive.TextureEntryFace(newface) : null; changed = true; // DEBUG ON if (newface != null) @@ -393,6 +387,7 @@ namespace OpenSim.Framework // DEBUG OFF } + m_texture = textureEntry; return changed; } @@ -415,8 +410,8 @@ namespace OpenSim.Framework if (visualParams[i] != m_visualparams[i]) { // DEBUG ON - m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", - i,m_visualparams[i],visualParams[i]); +// m_log.WarnFormat("[AVATARAPPEARANCE] vparams changed [{0}] {1} ==> {2}", +// i,m_visualparams[i],visualParams[i]); // DEBUG OFF m_visualparams[i] = visualParams[i]; changed = true; @@ -581,6 +576,8 @@ namespace OpenSim.Framework m_attachments.Clear(); } + #region Packing Functions + /// /// Create an OSDMap from the appearance data /// @@ -605,7 +602,7 @@ namespace OpenSim.Framework if (m_texture.FaceTextures[i] != null) textures.Add(OSD.FromUUID(m_texture.FaceTextures[i].TextureID)); else - textures.Add(OSD.FromUUID(UUID.Zero)); + textures.Add(OSD.FromUUID(AppearanceManager.DEFAULT_AVATAR_TEXTURE)); } data["textures"] = textures; @@ -657,12 +654,10 @@ namespace OpenSim.Framework OSDArray textures = (OSDArray)(data["textures"]); for (int i = 0; i < AvatarAppearance.TEXTURE_COUNT && i < textures.Count; i++) { + UUID textureID = AppearanceManager.DEFAULT_AVATAR_TEXTURE; if (textures[i] != null) - { - UUID textureID = textures[i].AsUUID(); - if (textureID != UUID.Zero) - m_texture.CreateFace((uint)i).TextureID = textureID; - } + textureID = textures[i].AsUUID(); + m_texture.CreateFace((uint)i).TextureID = new UUID(textureID); } } else @@ -697,6 +692,9 @@ namespace OpenSim.Framework } } + #endregion + + #region VPElement /// /// Viewer Params Array Element for AgentSetAppearance @@ -1460,5 +1458,6 @@ namespace OpenSim.Framework SKIRT_SKIRT_GREEN = 216, SKIRT_SKIRT_BLUE = 217 } + #endregion } } \ No newline at end of file -- cgit v1.1