mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
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.
This commit is contained in:
@@ -42,9 +42,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
{
|
||||
public class NPCAvatar : IClientAPI, INPC
|
||||
{
|
||||
private static readonly Dictionary<string, UUID> m_defaultAnimations = new Dictionary<string, UUID>();
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user