Bunch of fixes that reduce the number of times appearance

and avatar data are sent. And the number of times they
are stored.
This commit is contained in:
Master ScienceSim
2010-10-29 13:37:13 -07:00
parent 68666efd25
commit f5c9a56c8b
5 changed files with 132 additions and 81 deletions

View File

@@ -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);
}
/// <summary>
@@ -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
/// <summary>
/// Create an OSDMap from the appearance data
/// </summary>
@@ -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
/// <summary>
/// Viewer Params Array Element for AgentSetAppearance
@@ -1460,5 +1458,6 @@ namespace OpenSim.Framework
SKIRT_SKIRT_GREEN = 216,
SKIRT_SKIRT_BLUE = 217
}
#endregion
}
}