From 247b806134819f3806c078ca891791b718ff8984 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 28 Oct 2008 17:35:36 +0000 Subject: * minor: Add documentation to some of the appearance methods, change some logging messages --- OpenSim/Framework/AvatarWearable.cs | 6 ++++++ OpenSim/Framework/IClientAPI.cs | 12 +++++++++++ .../Region/ClientStack/LindenUDP/LLClientView.cs | 15 ++++---------- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 24 +++++++++++++--------- OpenSim/Region/Environment/Scenes/Scene.cs | 2 -- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 23 +++++++++++++-------- 6 files changed, 50 insertions(+), 32 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/AvatarWearable.cs b/OpenSim/Framework/AvatarWearable.cs index 59e6a1b..62971ea 100644 --- a/OpenSim/Framework/AvatarWearable.cs +++ b/OpenSim/Framework/AvatarWearable.cs @@ -71,17 +71,23 @@ namespace OpenSim.Framework { defaultWearables[i] = new AvatarWearable(); } + + // Body defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73"); defaultWearables[0].ItemID = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9"); + // Skin defaultWearables[1].ItemID = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9"); defaultWearables[1].AssetID = new UUID("77c41e39-38f9-f75a-024e-585989bbabbb"); + // Shirt defaultWearables[4].ItemID = new UUID("77c41e39-38f9-f75a-0000-585989bf0000"); defaultWearables[4].AssetID = new UUID("00000000-38f9-1111-024e-222222111110"); + // Pants defaultWearables[5].ItemID = new UUID("77c41e39-38f9-f75a-0000-5859892f1111"); defaultWearables[5].AssetID = new UUID("00000000-38f9-1111-024e-222222111120"); + return defaultWearables; } } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 46615cc..c8a54a7 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -635,8 +635,20 @@ namespace OpenSim.Framework // void ActivateGesture(UUID assetId, UUID gestureId); + /// + /// Tell this client what items it should be wearing now + /// + /// void SendWearables(AvatarWearable[] wearables, int serial); + + /// + /// Send information about the given agent's appearance to another client. + /// + /// The id of the agent associated with the appearance + /// + /// void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry); + void SendStartPingCheck(byte seq); /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3c9034b..aaa5e1c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -2221,11 +2221,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Gesture #region Appearance/ Wearables Methods - - /// - /// - /// - /// + public void SendWearables(AvatarWearable[] wearables, int serial) { AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate); @@ -2248,12 +2244,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(aw, ThrottleOutPacketType.Task); } - /// - /// - /// - /// - /// - /// public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry) { AvatarAppearancePacket avp = (AvatarAppearancePacket)PacketPool.Instance.GetPacket(PacketType.AvatarAppearance); @@ -4199,6 +4189,7 @@ Console.WriteLine(msgpack.ToString()); } break; + case PacketType.RegionHandshakeReply: handlerRegionHandShakeReply = OnRegionHandShakeReply; @@ -4208,6 +4199,7 @@ Console.WriteLine(msgpack.ToString()); } break; + case PacketType.AgentWearablesRequest: handlerRequestWearables = OnRequestWearables; @@ -4224,6 +4216,7 @@ Console.WriteLine(msgpack.ToString()); } break; + case PacketType.AgentSetAppearance: AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; diff --git a/OpenSim/Region/Environment/Modules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/Environment/Modules/Avatar/AvatarFactory/AvatarFactoryModule.cs index d3b782f..94c27a5 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -131,8 +131,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory } else { - // UUID assetId; - InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID); if (baseItem != null) @@ -141,7 +139,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory } else { - m_log.ErrorFormat("[APPEARANCE] Can't find inventory item {0}, setting to default", appearance.Wearables[i].ItemID); + m_log.ErrorFormat("[APPEARANCE]: Can't find inventory item {0}, setting to default", appearance.Wearables[i].ItemID); appearance.Wearables[i].AssetID = def.Wearables[i].AssetID; } } @@ -149,7 +147,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory } else { - m_log.Error("[APPEARANCE] you have no inventory, appearance stuff isn't going to work"); + m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work"); } } @@ -157,19 +155,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory { IClientAPI clientView = (IClientAPI)sender; ScenePresence avatar = m_scene.GetScenePresence(clientView.AgentId); - if (avatar == null) { - m_log.Info("Avatar is child agent, ignoring AvatarIsWearing event"); + + if (avatar == null) + { + m_log.Warn("[APPEARANCE]: Avatar is child agent, ignoring AvatarIsWearing event"); return; } CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); AvatarAppearance avatAppearance = null; - if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) { - m_log.Info("We didn't seem to find the appearance, falling back to ScenePresense"); + if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) + { + m_log.Info("[APPEARANCE]: We didn't seem to find the appearance, falling back to ScenePresense"); avatAppearance = avatar.Appearance; } - m_log.Info("Calling Avatar is Wearing"); + + m_log.Info("[APPEARANCE]: Calling Avatar is Wearing"); + if (profile != null) { if (profile.RootFolder != null) @@ -181,6 +184,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; } } + SetAppearanceAssets(profile, ref avatAppearance); m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); @@ -188,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.AvatarFactory } else { - m_log.Error("Root Profile is null, we can't set the appearance"); + m_log.Error("[APPEARANCE]: Root Profile is null, we can't set the appearance"); } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 8d94c68..77afc43 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2236,8 +2236,6 @@ namespace OpenSim.Region.Environment.Scenes protected virtual void SubscribeToClientEvents(IClientAPI client) { client.OnRegionHandShakeReply += SendLayerData; - //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); - // client.OnRequestWearables += InformClientOfNeighbours; client.OnAddPrim += AddNewPrim; client.OnUpdatePrimGroupPosition += m_innerScene.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += m_innerScene.UpdatePrimSinglePosition; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 6f6e0cb..7bc0360 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -527,7 +527,7 @@ namespace OpenSim.Region.Environment.Scenes public void RegisterToEvents() { - m_controllingClient.OnRequestWearables += SendOwnAppearance; + m_controllingClient.OnRequestWearables += SendWearables; m_controllingClient.OnSetAppearance += SetAppearance; m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; m_controllingClient.OnCompleteMovementToRegion += SendInitialData; @@ -1843,12 +1843,13 @@ namespace OpenSim.Region.Environment.Scenes } /// - /// + /// Tell the client for this scene presence what items it should be wearing now /// /// - public void SendOwnAppearance() + public void SendWearables() { - m_log.Info("[APPEARANCE]: Sending Own Appearance"); + m_log.DebugFormat("[APPEARANCE]: Sending wearables to {0}", Name); + ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); // ControllingClient.SendAppearance( // m_appearance.Owner, @@ -1862,8 +1863,9 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendAppearanceToAllOtherAgents() { - m_log.Info("[APPEARANCE]: Sending Appearance to All Other Agents"); - m_perfMonMS=System.Environment.TickCount; + m_log.DebugFormat("[APPEARANCE]: Sending appearance to all other agents for {0}", Name); + + m_perfMonMS = System.Environment.TickCount; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) { @@ -1872,6 +1874,7 @@ namespace OpenSim.Region.Environment.Scenes SendAppearanceToOtherAgent(scenePresence); } }); + m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS); } @@ -1886,18 +1889,20 @@ namespace OpenSim.Region.Environment.Scenes public void SetAppearance(byte[] texture, List visualParam) { - m_log.Info("[APPEARANCE]: Setting Appearance"); + m_log.DebugFormat("[APPEARANCE]: Setting appearance for {0}", Name); + m_appearance.SetAppearance(texture, visualParam); SetHeight(m_appearance.AvatarHeight); m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); SendAppearanceToAllOtherAgents(); - SendOwnAppearance(); + SendWearables(); } public void SetWearable(int wearableId, AvatarWearable wearable) { - m_log.Info("[APPEARANCE]: Setting Wearable"); + m_log.DebugFormat("[APPEARANCE]: Setting wearable for {0}", Name); + m_appearance.SetWearable(wearableId, wearable); m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance); m_controllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++); -- cgit v1.1