From 06b1535ec5054068e65a085fabd25680d145594c Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sat, 17 May 2008 12:45:43 +0000 Subject: while this doesn't fix the initial no pants issue in grid (which still baffles me) it does make setting appearance in grid stick. --- OpenSim/Region/Environment/Scenes/Scene.cs | 33 +++++++++++----------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 22 +++++++++++---- 2 files changed, 32 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index bc80915..a798f40 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1779,29 +1779,28 @@ namespace OpenSim.Region.Environment.Scenes protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client, bool child) { - AvatarAppearance appearance; - GetAvatarAppearance(client, out appearance); + AvatarAppearance appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); ScenePresence avatar = m_innerScene.CreateAndAddScenePresence(client, child, appearance); return avatar; } - protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) - { - appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); - - // if (m_AvatarFactory == null || - // !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) - // { - // //not found Appearance - // m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis"); - // byte[] visualParams; - // AvatarWearable[] wearables; - // GetDefaultAvatarAppearance(out wearables, out visualParams); - // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams); - // } - } + // protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) + // { + // appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); + + // // if (m_AvatarFactory == null || + // // !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) + // // { + // // //not found Appearance + // // m_log.Warn("[AVATAR DEBUGGING]: Couldn't fetch avatar appearance from factory, please report this to the opensim mantis"); + // // byte[] visualParams; + // // AvatarWearable[] wearables; + // // GetDefaultAvatarAppearance(out wearables, out visualParams); + // // appearance = new AvatarAppearance(client.AgentId, wearables, visualParams); + // // } + // } /// /// Remove the given client from the scene. diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6977083..5221914 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1452,13 +1452,8 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendInitialData() { - // justincc - very temporary fix for the fact that m_apperance appears to be null at this point in grid mode - LLObject.TextureEntry texture = AvatarAppearance.GetDefaultTexture(); - if (null != m_appearance) - texture = m_appearance.Texture; - m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, - m_pos, texture.ToBytes(), m_parentID); + m_pos, m_appearance.Texture.ToBytes(), m_parentID); if (!m_isChildAgent) { @@ -1467,11 +1462,14 @@ namespace OpenSim.Region.Environment.Scenes SendFullUpdateToAllClients(); SendAppearanceToAllOtherAgents(); + // This is probably egregious + m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); } public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) { + m_log.Info("[APPEARANCE] Setting wearable with client, wearableid, wearable"); m_appearance.SetWearable(wearableId, wearable); m_scene.CommsManager.UserService.UpdateUserAppearance(client.AgentId, m_appearance); client.SendWearables(m_appearance.Wearables, m_appearance.Serial++); @@ -1483,6 +1481,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendOwnAppearance() { + m_log.Info("[APPEARANCE] Sending Own Appearace"); ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); } @@ -1514,19 +1513,30 @@ namespace OpenSim.Region.Environment.Scenes public void SetAppearance(byte[] texture, List visualParam) { + m_log.Warn("[APPEARANCE] Setting Appearance"); m_appearance.SetAppearance(texture, visualParam); SetHeight(m_appearance.AvatarHeight); m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); SendAppearanceToAllOtherAgents(); + SendOwnAppearance(); } public void SetWearable(int wearableId, AvatarWearable wearable) { + m_log.Warn("[APPEARANCE] Setting Wearable"); m_appearance.SetWearable(wearableId, wearable); m_scene.CommsManager.UserService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); } + // Because appearance setting is in a module, we actually need + // to give it access to our appearance directly, otherwise we + // get a synchronization issue. + public AvatarAppearance Appearance { + get { return m_appearance; } + set { m_appearance = value; } + } + /// /// /// -- cgit v1.1