locate default anims also by uuid, rename/chage a few things
parent
e2f84f0c1f
commit
c097f148dd
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = uuid.ToString();
|
||||
}
|
||||
|
||||
if(AnimsNamesbyUUID.TryGetValue(uuid, out string ret))
|
||||
return ret;
|
||||
else
|
||||
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)
|
||||
|
|
|
@ -6662,7 +6662,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
}
|
||||
|
||||
if (agent.Animator.Animations.ImplicitDefaultAnimation.AnimID
|
||||
== DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
||||
== DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"])
|
||||
{
|
||||
flags |= ScriptBaseClass.AGENT_SITTING;
|
||||
}
|
||||
|
@ -11212,7 +11212,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
Vector3 box = presence.Appearance.AvatarBoxSize * 0.5f;
|
||||
|
||||
if (presence.Animator.Animations.ImplicitDefaultAnimation.AnimID
|
||||
== DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
||||
== DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"])
|
||||
/*
|
||||
{
|
||||
// This is for ground sitting avatars
|
||||
|
@ -11310,7 +11310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
upper = new Vector3(m_lABB2SitX0, m_lABB2SitY0, m_lABB2SitZ0 + m_lABB2SitZ1 * height);
|
||||
}
|
||||
// When avatar is groundsitting
|
||||
else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
|
||||
else if (sp.Animator.Animations.ImplicitDefaultAnimation.AnimID == DefaultAvatarAnimations.AnimsUUIDbyName["SIT_GROUND_CONSTRAINED"])
|
||||
{
|
||||
lower = new Vector3(m_lABB1GrsX0, m_lABB1GrsY0, m_lABB1GrsZ0 + m_lABB1GrsZ1 * height);
|
||||
upper = new Vector3(m_lABB2GrsX0, m_lABB2GrsY0, m_lABB2GrsZ0 + m_lABB2GrsZ1 * height);
|
||||
|
@ -17365,7 +17365,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (animID == UUID.Zero)
|
||||
{
|
||||
String animupper = ((string)anim).ToUpperInvariant();
|
||||
DefaultAvatarAnimations.AnimsUUID.TryGetValue(animupper, out animID);
|
||||
DefaultAvatarAnimations.AnimsUUIDbyName.TryGetValue(animupper, out animID);
|
||||
}
|
||||
|
||||
if (animID == UUID.Zero)
|
||||
|
@ -17458,7 +17458,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (animID == UUID.Zero)
|
||||
return animState;
|
||||
|
||||
foreach (KeyValuePair<string, UUID> kvp in DefaultAvatarAnimations.AnimsUUID)
|
||||
foreach (KeyValuePair<string, UUID> kvp in DefaultAvatarAnimations.AnimsUUIDbyName)
|
||||
{
|
||||
if (kvp.Value == animID)
|
||||
return kvp.Key.ToLower();
|
||||
|
|
Loading…
Reference in New Issue