Addresses some issues with appearance after TPs. Appearance.Owner was not being set, and that's what's being used in SendAppearanceToOtherAgent. Mantis #3204.

GenericGridServerConcept
diva 2009-02-22 01:26:11 +00:00
parent 551bebdc84
commit 99b051ccbe
4 changed files with 28 additions and 8 deletions

View File

@ -241,6 +241,11 @@ namespace OpenSim.Framework
} }
public AvatarAppearance() public AvatarAppearance()
: this(UUID.Zero)
{
}
public AvatarAppearance(UUID owner)
{ {
m_wearables = new AvatarWearable[MAX_WEARABLES]; m_wearables = new AvatarWearable[MAX_WEARABLES];
for (int i = 0; i < MAX_WEARABLES; i++) for (int i = 0; i < MAX_WEARABLES; i++)
@ -249,7 +254,7 @@ namespace OpenSim.Framework
m_wearables[i] = new AvatarWearable(); m_wearables[i] = new AvatarWearable();
} }
m_serial = 0; m_serial = 0;
m_owner = UUID.Zero; m_owner = owner;
m_visualparams = new byte[VISUALPARAM_COUNT]; m_visualparams = new byte[VISUALPARAM_COUNT];
SetDefaultWearables(); SetDefaultWearables();
m_texture = GetDefaultTexture(); m_texture = GetDefaultTexture();
@ -286,7 +291,18 @@ namespace OpenSim.Framework
+ 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height
+ 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length
- m_avatarHeight / 2) * 0.3f - 0.04f; - m_avatarHeight / 2) * 0.3f - 0.04f;
//System.Console.WriteLine("[APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); //System.Console.WriteLine(">>>>>>> [APPEARANCE]: Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset);
//System.Console.WriteLine("------------- Set Appearance Texture ---------------");
//Primitive.TextureEntryFace[] faces = Texture.FaceTextures;
//foreach (Primitive.TextureEntryFace face in faces)
//{
// if (face != null)
// System.Console.WriteLine(" ++ " + face.TextureID);
// else
// System.Console.WriteLine(" ++ NULL ");
//}
//System.Console.WriteLine("----------------------------");
} }
public virtual void SetWearable(int wearableId, AvatarWearable wearable) public virtual void SetWearable(int wearableId, AvatarWearable wearable)

View File

@ -406,7 +406,7 @@ namespace OpenSim.Grid.UserServer
else else
{ {
m_log.DebugFormat("[LOGIN]: Appearance not for {0} {1}. Creating default.", user.FirstName, user.SurName); m_log.DebugFormat("[LOGIN]: Appearance not for {0} {1}. Creating default.", user.FirstName, user.SurName);
appearance = new AvatarAppearance(); appearance = new AvatarAppearance(user.ID);
} }
ArrayList SendParams = new ArrayList(); ArrayList SendParams = new ArrayList();

View File

@ -2118,7 +2118,7 @@ namespace OpenSim.Region.Framework.Scenes
if (appearance == null) if (appearance == null)
{ {
m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
appearance = new AvatarAppearance(); appearance = new AvatarAppearance(client.AgentId);
} }
} }

View File

@ -854,7 +854,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName); m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName);
// emergency; this really shouldn't happen // emergency; this really shouldn't happen
m_appearance = new AvatarAppearance(); m_appearance = new AvatarAppearance(UUID);
} }
// Don't send an animation pack here, since on a region crossing this will sometimes cause a flying // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
@ -2708,15 +2708,19 @@ namespace OpenSim.Region.Framework.Scenes
try try
{ {
AvatarWearable[] wearables = new AvatarWearable[cAgent.AgentTextures.Length / 2]; AvatarWearable[] wearables = new AvatarWearable[cAgent.AgentTextures.Length / 2];
Primitive.TextureEntry te = new Primitive.TextureEntry(UUID.Random());
for (uint n = 0; n < cAgent.AgentTextures.Length; n += 2) for (uint n = 0; n < cAgent.AgentTextures.Length; n += 2)
{ {
UUID itemId = cAgent.AgentTextures[n]; UUID itemId = cAgent.AgentTextures[n];
UUID assetId = cAgent.AgentTextures[n + 1]; UUID assetId = cAgent.AgentTextures[n + 1];
wearables[i] = new AvatarWearable(itemId, assetId); wearables[i++] = new AvatarWearable(itemId, assetId);
te.CreateFace(i++).TextureID = assetId; //te.CreateFace(i++).TextureID = assetId;
} }
m_appearance.Wearables = wearables; m_appearance.Wearables = wearables;
// We're setting it here to default, but the viewer will soon send a SetAppearance that will
// set things straight. We should probably pass these textures too...
Primitive.TextureEntry te = AvatarAppearance.GetDefaultTexture(); //new Primitive.TextureEntry(UUID.Random());
m_appearance.SetAppearance(te.ToBytes(), new List<byte>(cAgent.VisualParams)); m_appearance.SetAppearance(te.ToBytes(), new List<byte>(cAgent.VisualParams));
} }
catch (Exception e) catch (Exception e)