From e84ac65b58b63ae4af18ab8ebd9a82664ff4ea21 Mon Sep 17 00:00:00 2001 From: diva Date: Tue, 24 Feb 2009 23:06:15 +0000 Subject: [PATCH] Close-to-final tweaking with appearance. This time sending *everything*. Addresses mantis #3223. --- .../Framework/Scenes/ChildAgentDataUpdate.cs | 36 +++++++++++-------- .../Region/Framework/Scenes/ScenePresence.cs | 29 +++++---------- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs index be3069a0ec..17d3bb97db 100644 --- a/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs +++ b/OpenSim/Region/Framework/Scenes/ChildAgentDataUpdate.cs @@ -251,7 +251,7 @@ namespace OpenSim.Region.Framework.Scenes public UUID GranterID; // Appearance - public UUID[] AgentTextures; + public byte[] AgentTextures; public byte[] VisualParams; public UUID[] Wearables; @@ -311,13 +311,16 @@ namespace OpenSim.Region.Framework.Scenes args["animations"] = anims; } + //if ((AgentTextures != null) && (AgentTextures.Length > 0)) + //{ + // OSDArray textures = new OSDArray(AgentTextures.Length); + // foreach (UUID uuid in AgentTextures) + // textures.Add(OSD.FromUUID(uuid)); + // args["agent_textures"] = textures; + //} + if ((AgentTextures != null) && (AgentTextures.Length > 0)) - { - OSDArray textures = new OSDArray(AgentTextures.Length); - foreach (UUID uuid in AgentTextures) - textures.Add(OSD.FromUUID(uuid)); - args["agent_textures"] = textures; - } + args["texture_entry"] = OSD.FromBinary(AgentTextures); if ((VisualParams != null) && (VisualParams.Length > 0)) args["visual_params"] = OSD.FromBinary(VisualParams); @@ -448,14 +451,17 @@ namespace OpenSim.Region.Framework.Scenes } } - if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) - { - OSDArray textures = (OSDArray)(args["agent_textures"]); - AgentTextures = new UUID[textures.Count]; - int i = 0; - foreach (OSD o in textures) - AgentTextures[i++] = o.AsUUID(); - } + //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array) + //{ + // OSDArray textures = (OSDArray)(args["agent_textures"]); + // AgentTextures = new UUID[textures.Count]; + // int i = 0; + // foreach (OSD o in textures) + // AgentTextures[i++] = o.AsUUID(); + //} + + if (args["texture_entry"] != null) + AgentTextures = args["texture_entry"].AsBinary(); if (args["visual_params"] != null) VisualParams = args["visual_params"].AsBinary(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 672567bfa8..6fade39b50 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2688,20 +2688,8 @@ namespace OpenSim.Region.Framework.Scenes cAgent.VisualParams = m_appearance.VisualParams; - // Textures is not really needed in the base case, I think. But it's handy for - // the Hypergrid and other decentralized models, so that we know which - // textures to fecth from the user's asset server. - i = 0; - UUID[] textures = new UUID[m_appearance.Texture.FaceTextures.Length]; - foreach (Primitive.TextureEntryFace face in m_appearance.Texture.FaceTextures) - { - if (face != null) - textures[i] = face.TextureID; - else - textures[i] = UUID.Zero; - ++i; - } - cAgent.AgentTextures = textures; + if (m_appearance.Texture != null) + cAgent.AgentTextures = m_appearance.Texture.ToBytes(); } catch (Exception e) { @@ -2758,13 +2746,12 @@ namespace OpenSim.Region.Framework.Scenes } m_appearance.Wearables = wears; - // We're setting it here to default, but the viewer will soon send a SetAppearance that will - // set things straight. We should probably parse these textures too, we have them... - // In any case, the least we need to do is to check if this is HG and fetch the textures - // so that they can then be distributed to the other clients that ask for them later. - Primitive.TextureEntry te = AvatarAppearance.GetDefaultTexture(); //new Primitive.TextureEntry(UUID.Random()); - - m_appearance.SetAppearance(te.ToBytes(), new List(cAgent.VisualParams)); + byte[] te = null; + if (cAgent.AgentTextures != null) + te = cAgent.AgentTextures; + else + te = AvatarAppearance.GetDefaultTexture().ToBytes(); + m_appearance.SetAppearance(te, new List(cAgent.VisualParams)); } catch (Exception e) {