aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
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')
-rw-r--r--OpenSim/Framework/SLUtil.cs52
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs27
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs36
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs2
4 files changed, 55 insertions, 62 deletions
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index b337e03..f9cb851 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Xml;
31using log4net; 32using log4net;
32using OpenMetaverse; 33using OpenMetaverse;
33 34
@@ -39,6 +40,13 @@ namespace OpenSim.Framework
39 40
40 #region SL / file extension / content-type conversions 41 #region SL / file extension / content-type conversions
41 42
43 public static Dictionary<string, UUID> DefaultAvatarAnimations = new Dictionary<string, UUID>();
44
45 static SLUtil()
46 {
47 DefaultAvatarAnimations = LoadDefaultAvatarAnimations("data/avataranimations.xml");
48 }
49
42 public static string SLAssetTypeToContentType(int assetType) 50 public static string SLAssetTypeToContentType(int assetType)
43 { 51 {
44 switch ((AssetType)assetType) 52 switch ((AssetType)assetType)
@@ -374,5 +382,47 @@ namespace OpenSim.Framework
374 382
375 return output; 383 return output;
376 } 384 }
385
386 /// <summary>
387 /// Load the default SL avatar animations.
388 /// </summary>
389 /// <returns></returns>
390 public static Dictionary<string, UUID> LoadDefaultAvatarAnimations(string path)
391 {
392 Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
393
394 using (XmlTextReader reader = new XmlTextReader(path))
395 {
396 XmlDocument doc = new XmlDocument();
397 doc.Load(reader);
398 if (doc.DocumentElement != null)
399 {
400 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
401 {
402 if (nod.Attributes["name"] != null)
403 {
404 string name = nod.Attributes["name"].Value.ToLower();
405 string id = nod.InnerText;
406 animations.Add(name, (UUID)id);
407 }
408 }
409 }
410 }
411
412 return animations;
413 }
414
415 /// <summary>
416 /// Get the default SL avatar animation with the given name.
417 /// </summary>
418 /// <param name="name"></param>
419 /// <returns></returns>
420 public static UUID GetDefaultAvatarAnimation(string name)
421 {
422 if (DefaultAvatarAnimations.ContainsKey(name))
423 return DefaultAvatarAnimations[name];
424
425 return UUID.Zero;
426 }
377 } 427 }
378} 428} \ No newline at end of file
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
317 protected readonly UUID m_agentId; 317 protected readonly UUID m_agentId;
318 private readonly uint m_circuitCode; 318 private readonly uint m_circuitCode;
319 private readonly byte[] m_channelVersion = Utils.EmptyBytes; 319 private readonly byte[] m_channelVersion = Utils.EmptyBytes;
320 private readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
321 private readonly IGroupsModule m_GroupsModule; 320 private readonly IGroupsModule m_GroupsModule;
322 321
323 private int m_cachedTextureSerial; 322 private int m_cachedTextureSerial;
@@ -452,10 +451,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
452 RegisterInterface<IClientChat>(this); 451 RegisterInterface<IClientChat>(this);
453 RegisterInterface<IClientIPEndpoint>(this); 452 RegisterInterface<IClientIPEndpoint>(this);
454 453
455 InitDefaultAnimations();
456
457 m_scene = scene; 454 m_scene = scene;
458
459 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); 455 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
460 m_entityProps = new PriorityQueue(m_scene.Entities.Count); 456 m_entityProps = new PriorityQueue(m_scene.Entities.Count);
461 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); 457 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
@@ -11210,30 +11206,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11210 OutPacket(scriptQuestion, ThrottleOutPacketType.Task); 11206 OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
11211 } 11207 }
11212 11208
11213 private void InitDefaultAnimations()
11214 {
11215 using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
11216 {
11217 XmlDocument doc = new XmlDocument();
11218 doc.Load(reader);
11219 if (doc.DocumentElement != null)
11220 foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
11221 {
11222 if (nod.Attributes["name"] != null)
11223 {
11224 string name = nod.Attributes["name"].Value.ToLower();
11225 string id = nod.InnerText;
11226 m_defaultAnimations.Add(name, (UUID)id);
11227 }
11228 }
11229 }
11230 }
11231
11232 public UUID GetDefaultAnimation(string name) 11209 public UUID GetDefaultAnimation(string name)
11233 { 11210 {
11234 if (m_defaultAnimations.ContainsKey(name)) 11211 return SLUtil.GetDefaultAvatarAnimation(name);
11235 return m_defaultAnimations[name];
11236 return UUID.Zero;
11237 } 11212 }
11238 11213
11239 /// <summary> 11214 /// <summary>
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
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
712 712
713 List<Vector3> CoarseLocations = new List<Vector3>(); 713 List<Vector3> CoarseLocations = new List<Vector3>();
714 List<UUID> AvatarUUIDs = new List<UUID>(); 714 List<UUID> AvatarUUIDs = new List<UUID>();
715 715
716 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp) 716 connectiondata.RegionScene.ForEachRootScenePresence(delegate(ScenePresence sp)
717 { 717 {
718 if (sp.UUID != presence.UUID) 718 if (sp.UUID != presence.UUID)