Close-to-final tweaking with appearance. This time sending *everything*. Addresses mantis #3223.

GenericGridServerConcept
diva 2009-02-24 23:06:15 +00:00
parent bc0bedf75d
commit e84ac65b58
2 changed files with 29 additions and 36 deletions

View File

@ -251,7 +251,7 @@ namespace OpenSim.Region.Framework.Scenes
public UUID GranterID; public UUID GranterID;
// Appearance // Appearance
public UUID[] AgentTextures; public byte[] AgentTextures;
public byte[] VisualParams; public byte[] VisualParams;
public UUID[] Wearables; public UUID[] Wearables;
@ -311,13 +311,16 @@ namespace OpenSim.Region.Framework.Scenes
args["animations"] = anims; 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)) if ((AgentTextures != null) && (AgentTextures.Length > 0))
{ args["texture_entry"] = OSD.FromBinary(AgentTextures);
OSDArray textures = new OSDArray(AgentTextures.Length);
foreach (UUID uuid in AgentTextures)
textures.Add(OSD.FromUUID(uuid));
args["agent_textures"] = textures;
}
if ((VisualParams != null) && (VisualParams.Length > 0)) if ((VisualParams != null) && (VisualParams.Length > 0))
args["visual_params"] = OSD.FromBinary(VisualParams); 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) //if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
{ //{
OSDArray textures = (OSDArray)(args["agent_textures"]); // OSDArray textures = (OSDArray)(args["agent_textures"]);
AgentTextures = new UUID[textures.Count]; // AgentTextures = new UUID[textures.Count];
int i = 0; // int i = 0;
foreach (OSD o in textures) // foreach (OSD o in textures)
AgentTextures[i++] = o.AsUUID(); // AgentTextures[i++] = o.AsUUID();
} //}
if (args["texture_entry"] != null)
AgentTextures = args["texture_entry"].AsBinary();
if (args["visual_params"] != null) if (args["visual_params"] != null)
VisualParams = args["visual_params"].AsBinary(); VisualParams = args["visual_params"].AsBinary();

View File

@ -2688,20 +2688,8 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.VisualParams = m_appearance.VisualParams; cAgent.VisualParams = m_appearance.VisualParams;
// Textures is not really needed in the base case, I think. But it's handy for if (m_appearance.Texture != null)
// the Hypergrid and other decentralized models, so that we know which cAgent.AgentTextures = m_appearance.Texture.ToBytes();
// 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;
} }
catch (Exception e) catch (Exception e)
{ {
@ -2758,13 +2746,12 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_appearance.Wearables = wears; m_appearance.Wearables = wears;
// We're setting it here to default, but the viewer will soon send a SetAppearance that will byte[] te = null;
// set things straight. We should probably parse these textures too, we have them... if (cAgent.AgentTextures != null)
// In any case, the least we need to do is to check if this is HG and fetch the textures te = cAgent.AgentTextures;
// so that they can then be distributed to the other clients that ask for them later. else
Primitive.TextureEntry te = AvatarAppearance.GetDefaultTexture(); //new Primitive.TextureEntry(UUID.Random()); te = AvatarAppearance.GetDefaultTexture().ToBytes();
m_appearance.SetAppearance(te, new List<byte>(cAgent.VisualParams));
m_appearance.SetAppearance(te.ToBytes(), new List<byte>(cAgent.VisualParams));
} }
catch (Exception e) catch (Exception e)
{ {