aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-03-09 23:57:24 +0000
committerJustin Clark-Casey (justincc)2012-03-09 23:57:24 +0000
commitbdc968f1fcd4008e9f2a6099a7d30edb075ca0f1 (patch)
tree7c2c45cc97fb1b2181605313ed50e5db9cd6ec0f /OpenSim/Region/OptionalModules
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-bdc968f1fcd4008e9f2a6099a7d30edb075ca0f1.zip
opensim-SC_OLD-bdc968f1fcd4008e9f2a6099a7d30edb075ca0f1.tar.gz
opensim-SC_OLD-bdc968f1fcd4008e9f2a6099a7d30edb075ca0f1.tar.bz2
opensim-SC_OLD-bdc968f1fcd4008e9f2a6099a7d30edb075ca0f1.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs36
1 files changed, 2 insertions, 34 deletions
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
42{ 42{
43 public class NPCAvatar : IClientAPI, INPC 43 public class NPCAvatar : IClientAPI, INPC
44 { 44 {
45 private static readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
46
47 public bool SenseAsAgent { get; set; } 45 public bool SenseAsAgent { get; set; }
46
48 private readonly string m_firstname; 47 private readonly string m_firstname;
49 private readonly string m_lastname; 48 private readonly string m_lastname;
50 private readonly Vector3 m_startPos; 49 private readonly Vector3 m_startPos;
@@ -61,16 +60,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
61 m_scene = scene; 60 m_scene = scene;
62 m_ownerID = ownerID; 61 m_ownerID = ownerID;
63 SenseAsAgent = senseAsAgent; 62 SenseAsAgent = senseAsAgent;
64
65 } 63 }
66 64
67 static NPCAvatar()
68 {
69 InitDefaultAnimations();
70 }
71
72
73
74 public IScene Scene 65 public IScene Scene
75 { 66 {
76 get { return m_scene; } 67 get { return m_scene; }
@@ -142,32 +133,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
142 133
143 } 134 }
144 135
145 private static void InitDefaultAnimations()
146 {
147 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
148 {
149 XmlDocument doc = new XmlDocument();
150 doc.Load(reader);
151 if (doc.DocumentElement != null)
152 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
153 {
154 if (nod.Attributes["name"] != null)
155 {
156 string name = nod.Attributes["name"].Value.ToLower();
157 string id = nod.InnerText;
158 m_defaultAnimations.Add(name, (UUID)id);
159 }
160 }
161 }
162 }
163
164 public UUID GetDefaultAnimation(string name) 136 public UUID GetDefaultAnimation(string name)
165 { 137 {
166 if (m_defaultAnimations.ContainsKey(name)) 138 return SLUtil.GetDefaultAvatarAnimation(name);
167 {
168 return m_defaultAnimations[name];
169 }
170 return UUID.Zero;
171 } 139 }
172 140
173 public Vector3 Position 141 public Vector3 Position