From d44b7c486a5b51bbfbea2c3d2efd2c9dc0f99d0e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 6 Mar 2012 01:27:30 +0000 Subject: Go back to setting appearance directly in NPCModule.SetAppearance() to fix mantis 5914 The part reverted is from commit 2ebb421. Unfortunately, IAvatarFactoryModule.SetAppearance() does not transfer attachments. I'm not sure how to do this separately, unfortunately I'll need to leave it to Dan :) Regression test added for this case. Mantis ref: http://opensimulator.org/mantis/view.php?id=5914 --- .../Region/OptionalModules/World/NPC/NPCModule.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 2052cdb..2b8379d 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -88,22 +88,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) { - ScenePresence sp = scene.GetScenePresence(agentId); - if (sp == null || sp.IsChildAgent) + ScenePresence npc = scene.GetScenePresence(agentId); + if (npc == null || npc.IsChildAgent) return false; lock (m_avatars) if (!m_avatars.ContainsKey(agentId)) return false; - // Delete existing sp attachments - scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, false); + // Delete existing npc attachments + scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); - // Set new sp appearance. Also sends to clients. - scene.RequestModuleInterface().SetAppearance(sp, new AvatarAppearance(appearance, true)); + // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); + npc.Appearance = npcAppearance; - // Rez needed sp attachments - scene.AttachmentsModule.RezAttachments(sp); + // Rez needed npc attachments + scene.AttachmentsModule.RezAttachments(npc); + + IAvatarFactoryModule module = scene.RequestModuleInterface(); + module.SendAppearance(npc.UUID); return true; } -- cgit v1.1