aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/SLUtil.cs
diff options
context:
space:
mode:
authorMelanie2012-03-11 02:29:43 +0000
committerMelanie2012-03-11 02:29:43 +0000
commitf292e19689f9b01a5706e765543064b6ad61caa9 (patch)
tree0752aaa6a4ddc23c2f3a9296f02143cea3b6e6e1 /OpenSim/Framework/SLUtil.cs
parentMerge branch 'master' into careminster (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-f292e19689f9b01a5706e765543064b6ad61caa9.zip
opensim-SC-f292e19689f9b01a5706e765543064b6ad61caa9.tar.gz
opensim-SC-f292e19689f9b01a5706e765543064b6ad61caa9.tar.bz2
opensim-SC-f292e19689f9b01a5706e765543064b6ad61caa9.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Application/OpenSimBase.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/SLUtil.cs52
1 files changed, 51 insertions, 1 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