From 8e7f2d6d0efe37108b2931cfdda36e695830abb0 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 15 May 2008 14:39:54 +0000 Subject: [PATCH] refactoring to move AvatarAppearance into Framework and move the appearance sending bits to ScenePresence --- .../Scenes => Framework}/AvatarAppearance.cs | 22 +++-------------- .../Environment/Interfaces/IAvatarFactory.cs | 1 + .../Environment/Scenes/ScenePresence.cs | 24 ++++++++++++------- 3 files changed, 20 insertions(+), 27 deletions(-) rename OpenSim/{Region/Environment/Scenes => Framework}/AvatarAppearance.cs (92%) diff --git a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs similarity index 92% rename from OpenSim/Region/Environment/Scenes/AvatarAppearance.cs rename to OpenSim/Framework/AvatarAppearance.cs index a88306f09b..50afa758e7 100644 --- a/OpenSim/Region/Environment/Scenes/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -33,7 +33,7 @@ using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework; -namespace OpenSim.Region.Environment.Scenes +namespace OpenSim.Framework { [Serializable] public class AvatarAppearance : ISerializable @@ -153,28 +153,12 @@ namespace OpenSim.Region.Environment.Scenes // (float)m_visualParams[25] = Height // (float)m_visualParams[125] = LegLength m_avatarHeight = (1.50856f + (((float) m_visualParams[25]/255.0f)*(2.525506f - 1.50856f))) - + (((float) m_visualParams[125]/255.0f)/1.5f); + + (((float) m_visualParams[125]/255.0f)/1.5f); } - /// - /// - /// - /// - public void SendAppearanceToOtherAgent(ScenePresence avatar) - { - avatar.ControllingClient.SendAppearance(m_scenePresenceID, m_visualParams, - m_textureEntry.ToBytes()); - } - - public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) + public void SetWearable(int wearableId, AvatarWearable wearable) { m_wearables[wearableId] = wearable; - SendOwnWearables(client); - } - - public void SendOwnWearables(IClientAPI ourClient) - { - ourClient.SendWearables(m_wearables, m_wearablesSerial++); } public static LLObject.TextureEntry GetDefaultTextureEntry() diff --git a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs index 3ebbaab843..86958d1055 100644 --- a/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Region/Environment/Interfaces/IAvatarFactory.cs @@ -26,6 +26,7 @@ */ using libsecondlife; +using OpenSim.Framework; using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Interfaces diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 8ac1a77eec..6f591e8156 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -1461,16 +1461,20 @@ namespace OpenSim.Region.Environment.Scenes SendAppearanceToAllOtherAgents(); } + + public void SetWearable(IClientAPI client, int wearableId, AvatarWearable wearable) + { + m_appearance.SetWearable(wearableId, wearable); + client.SendWearables(m_appearance.Wearables, m_appearance.WearablesSerial++); + } + /// /// /// /// public void SendOwnAppearance() { - m_appearance.SendOwnWearables(ControllingClient); - - // TODO: remove this once the SunModule is slightly more tested - // m_controllingClient.SendViewerTime(m_scene.TimePhase); + ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.WearablesSerial++); } /// @@ -1484,15 +1488,19 @@ namespace OpenSim.Region.Environment.Scenes { if (scenePresence.UUID != UUID) { - m_appearance.SendAppearanceToOtherAgent(scenePresence); + SendAppearanceToOtherAgent(scenePresence); } }); m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); } public void SendAppearanceToOtherAgent(ScenePresence avatar) - { - m_appearance.SendAppearanceToOtherAgent(avatar); + { + avatar.ControllingClient.SendAppearance( + m_appearance.ScenePresenceID, + m_appearance.VisualParams, + m_appearance.TextureEntry.ToBytes() + ); } public void SetAppearance(byte[] texture, List visualParam) @@ -1505,7 +1513,7 @@ namespace OpenSim.Region.Environment.Scenes public void SetWearable(int wearableId, AvatarWearable wearable) { - m_appearance.SetWearable(ControllingClient, wearableId, wearable); + m_appearance.SetWearable(wearableId, wearable); } ///