mirror of
https://github.com/opensim/opensim.git
synced 2026-08-13 05:05:43 +08:00
Instead of loading default avatar animations in both SLUtil and AvatarAnimations, load just in AvatarAnimations instead.
This lets us remove the dependency of OpenSim.Framework.dll on data/avataranimations.xml, which is not necessary for ROBUST. This commit also takes care of the odd situation where animations are stored and used internally with uppercase names (e.g. "STAND") but scripts refer to them with lowercase names (e.g. "sit").
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml;
|
||||
using log4net;
|
||||
@@ -40,13 +41,6 @@ namespace OpenSim.Framework
|
||||
|
||||
#region SL / file extension / content-type conversions
|
||||
|
||||
public static Dictionary<string, UUID> DefaultAvatarAnimations = new Dictionary<string, UUID>();
|
||||
|
||||
static SLUtil()
|
||||
{
|
||||
DefaultAvatarAnimations = LoadDefaultAvatarAnimations("data/avataranimations.xml");
|
||||
}
|
||||
|
||||
public static string SLAssetTypeToContentType(int assetType)
|
||||
{
|
||||
switch ((AssetType)assetType)
|
||||
@@ -382,47 +376,5 @@ namespace OpenSim.Framework
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the default SL avatar animations.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Dictionary<string, UUID> LoadDefaultAvatarAnimations(string path)
|
||||
{
|
||||
Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
|
||||
|
||||
using (XmlTextReader reader = new XmlTextReader(path))
|
||||
{
|
||||
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;
|
||||
animations.Add(name, (UUID)id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return animations;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default SL avatar animation with the given name.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static UUID GetDefaultAvatarAnimation(string name)
|
||||
{
|
||||
if (DefaultAvatarAnimations.ContainsKey(name))
|
||||
return DefaultAvatarAnimations[name];
|
||||
|
||||
return UUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user