From bdc968f1fcd4008e9f2a6099a7d30edb075ca0f1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 23:57:24 +0000 Subject: Factor out common default animations code into SLUtil. LLClientView now makes use of the SLUtil copy via a method rather than each LLClientView loading a separate copy. As per opensim-users mailing list discussion. --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 27 +--------------- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 36 ++-------------------- .../RegionCombinerModule/RegionCombinerModule.cs | 2 +- 3 files changed, 4 insertions(+), 61 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d98ff68..b388b10 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -317,7 +317,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected readonly UUID m_agentId; private readonly uint m_circuitCode; private readonly byte[] m_channelVersion = Utils.EmptyBytes; - private readonly Dictionary m_defaultAnimations = new Dictionary(); private readonly IGroupsModule m_GroupsModule; private int m_cachedTextureSerial; @@ -452,10 +451,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP RegisterInterface(this); RegisterInterface(this); - InitDefaultAnimations(); - m_scene = scene; - m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); m_entityProps = new PriorityQueue(m_scene.Entities.Count); m_fullUpdateDataBlocksBuilder = new List(); @@ -11210,30 +11206,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(scriptQuestion, ThrottleOutPacketType.Task); } - private void InitDefaultAnimations() - { - using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) - { - XmlDocument doc = new XmlDocument(); - doc.Load(reader); - if (doc.DocumentElement != null) - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) - { - string name = nod.Attributes["name"].Value.ToLower(); - string id = nod.InnerText; - m_defaultAnimations.Add(name, (UUID)id); - } - } - } - } - public UUID GetDefaultAnimation(string name) { - if (m_defaultAnimations.ContainsKey(name)) - return m_defaultAnimations[name]; - return UUID.Zero; + return SLUtil.GetDefaultAvatarAnimation(name); } /// diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 69c16c7..24b9e6b 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -42,9 +42,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC { public class NPCAvatar : IClientAPI, INPC { - private static readonly Dictionary m_defaultAnimations = new Dictionary(); - public bool SenseAsAgent { get; set; } + private readonly string m_firstname; private readonly string m_lastname; private readonly Vector3 m_startPos; @@ -61,16 +60,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_scene = scene; m_ownerID = ownerID; SenseAsAgent = senseAsAgent; - } - static NPCAvatar() - { - InitDefaultAnimations(); - } - - - public IScene Scene { get { return m_scene; } @@ -142,32 +133,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC } - private static void InitDefaultAnimations() - { - using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) - { - XmlDocument doc = new XmlDocument(); - doc.Load(reader); - if (doc.DocumentElement != null) - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) - { - string name = nod.Attributes["name"].Value.ToLower(); - string id = nod.InnerText; - m_defaultAnimations.Add(name, (UUID)id); - } - } - } - } - public UUID GetDefaultAnimation(string name) { - if (m_defaultAnimations.ContainsKey(name)) - { - return m_defaultAnimations[name]; - } - return UUID.Zero; + return SLUtil.GetDefaultAvatarAnimation(name); } public Vector3 Position diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index eb633b3..a142f26 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -712,7 +712,7 @@ namespace OpenSim.Region.RegionCombinerModule List CoarseLocations = new List(); List AvatarUUIDs = new List(); - + connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp) { if (sp.UUID != presence.UUID) -- cgit v1.1