From 7a52b35c574da5180131e1b5df613c4df09a5065 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 19 May 2008 20:33:54 +0000 Subject: fix crash in standalone mode for initial appearance setup --- OpenSim/Region/Environment/Scenes/Scene.cs | 12 +++++++++--- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 6 +++--- OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs | 5 ++++- 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d02d22f..b2d45d1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1549,6 +1549,14 @@ namespace OpenSim.Region.Environment.Scenes presence = m_restorePresences[client.AgentId]; m_restorePresences.Remove(client.AgentId); + // This is one of two paths to create avatars that are + // used. This tends to get called more in standalone + // than grid, not really sure why, but as such needs + // an explicity appearance lookup here. + AvatarAppearance appearance = null; + GetAvatarAppearance(client, out appearance); + presence.Appearance = appearance; + presence.initializeScenePresence(client, RegionInfo, this); m_innerScene.AddScenePresence(presence); @@ -1789,10 +1797,8 @@ namespace OpenSim.Region.Environment.Scenes return avatar; } - protected void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) + public void GetAvatarAppearance(IClientAPI client, out AvatarAppearance appearance) { - appearance = CommsManager.UserService.GetUserAppearance(client.AgentId); - if (m_AvatarFactory == null || !m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) { diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index f7c9b8d..a913a98 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -405,8 +405,6 @@ namespace OpenSim.Region.Environment.Scenes RegisterToEvents(); SetDirectionVectors(); - m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId); - try { m_scene.LandChannel.SendLandUpdate(this, true); @@ -1445,6 +1443,9 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendInitialData() { + // Needed for standalone + m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); + m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, m_pos, m_appearance.Texture.ToBytes(), m_parentID); @@ -2049,7 +2050,6 @@ namespace OpenSim.Region.Environment.Scenes m_controllingClient = client; m_regionInfo = region; m_scene = scene; - m_appearance = m_scene.CommsManager.UserService.GetUserAppearance(client.AgentId); RegisterToEvents(); diff --git a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs index 7dae702..837a4ec 100644 --- a/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/Modules/AvatarFactory/AvatarFactoryModule.cs @@ -60,7 +60,10 @@ namespace OpenSim.Region.Modules.AvatarFactory public bool TryGetAvatarAppearance(LLUUID avatarId, out AvatarAppearance appearance) { appearance = m_scene.CommsManager.UserService.GetUserAppearance(avatarId); - return true; + if (appearance != null) + return true; + else + return false; // //should only let one thread at a time do this part // EventWaitHandle waitHandle = null; -- cgit v1.1