mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
locate default anims also by uuid, rename/chage a few things
This commit is contained in:
@@ -171,9 +171,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}",
|
||||
// anim, sequenceNum, objectID);
|
||||
|
||||
if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim))
|
||||
if (DefaultAvatarAnimations.AnimsUUIDbyName.TryGetValue(anim, out UUID id))
|
||||
{
|
||||
return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID);
|
||||
return SetDefaultAnimation(id, sequenceNum, objectID);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
|
||||
public static readonly string DefaultAnimationsPath = "data/avataranimations.xml";
|
||||
|
||||
public static Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
|
||||
public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
|
||||
public static Dictionary<string, UUID> AnimsUUIDbyName = new Dictionary<string, UUID>();
|
||||
public static Dictionary<UUID, string> AnimsNamesbyUUID = new Dictionary<UUID, string>();
|
||||
public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
|
||||
|
||||
static DefaultAvatarAnimations()
|
||||
@@ -70,8 +70,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
UUID id = (UUID)nod.InnerText;
|
||||
string animState = (string)nod.Attributes["state"].Value;
|
||||
|
||||
AnimsUUID.Add(name, id);
|
||||
AnimsNames.Add(id, name);
|
||||
AnimsUUIDbyName.Add(name, id);
|
||||
AnimsNamesbyUUID.Add(id, name);
|
||||
if (animState != "")
|
||||
AnimStateNames.Add(id, animState);
|
||||
|
||||
@@ -93,13 +93,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name);
|
||||
|
||||
if (AnimsUUID.ContainsKey(name))
|
||||
UUID id;
|
||||
if (AnimsUUIDbyName.TryGetValue(name, out id))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name);
|
||||
|
||||
return AnimsUUID[name];
|
||||
return id;
|
||||
}
|
||||
if(UUID.TryParse(name, out id))
|
||||
{
|
||||
if(AnimsNamesbyUUID.ContainsKey(id))
|
||||
return id;
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
@@ -111,24 +116,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
/// </summary>
|
||||
public static string GetDefaultAnimationName(UUID uuid)
|
||||
{
|
||||
string ret = "unknown";
|
||||
if (AnimsUUID.ContainsValue(uuid))
|
||||
{
|
||||
foreach (KeyValuePair<string, UUID> kvp in AnimsUUID)
|
||||
{
|
||||
if (kvp.Value == uuid)
|
||||
{
|
||||
ret = kvp.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(AnimsNamesbyUUID.TryGetValue(uuid, out string ret))
|
||||
return ret;
|
||||
else
|
||||
{
|
||||
ret = uuid.ToString();
|
||||
}
|
||||
|
||||
return ret;
|
||||
return uuid.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
{
|
||||
if (anim == "SITGROUND")
|
||||
{
|
||||
UUID defsit = DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"];
|
||||
UUID defsit = DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"];
|
||||
if (defsit == UUID.Zero)
|
||||
return false;
|
||||
m_animations.SetDefaultAnimation(defsit, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID);
|
||||
@@ -863,7 +863,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
||||
{
|
||||
string animName;
|
||||
|
||||
if (!DefaultAvatarAnimations.AnimsNames.TryGetValue(animId, out animName))
|
||||
if (!DefaultAvatarAnimations.AnimsNamesbyUUID.TryGetValue(animId, out animName))
|
||||
{
|
||||
AssetMetadata amd = m_scenePresence.Scene.AssetService.GetMetadata(animId.ToString());
|
||||
if (amd != null)
|
||||
|
||||
Reference in New Issue
Block a user