mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
* Apply second patch in http://opensimulator.org/mantis/view.php?id=2561
* Inserts proper animation state names into data/avataranimations.xml file so that llGetAnimation() works as one would expect. * Thanks StrawberryFride!
This commit is contained in:
@@ -35,6 +35,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
|
||||
public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
|
||||
public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
|
||||
|
||||
public AvatarAnimations()
|
||||
{
|
||||
@@ -46,11 +47,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||
{
|
||||
if (nod.Attributes["name"] != null)
|
||||
{
|
||||
string name = (string)nod.Attributes["name"].Value;
|
||||
string name = (string)nod.Attributes["name"].Value;
|
||||
UUID id = (UUID)nod.InnerText;
|
||||
string animState = (string)nod.Attributes["state"].Value;
|
||||
|
||||
AnimsUUID.Add(name, id);
|
||||
AnimsNames.Add(id, name);
|
||||
if (animState != "")
|
||||
AnimStateNames.Add(id, animState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3486,14 +3486,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
ScenePresence presence = World.GetScenePresence(avatar);
|
||||
if (m_host.RegionHandle == presence.RegionHandle)
|
||||
{
|
||||
Dictionary<UUID, string> animationNames = AnimationSet.Animations.AnimsNames;
|
||||
Dictionary<UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames;
|
||||
|
||||
if (presence != null)
|
||||
{
|
||||
AnimationSet currentAnims = presence.Animations;
|
||||
string currentAnimation = String.Empty;
|
||||
if (animationNames.TryGetValue(currentAnims.DefaultAnimation.AnimID, out currentAnimation))
|
||||
return currentAnimation;
|
||||
string currentAnimationState = String.Empty;
|
||||
if (animationstateNames.TryGetValue(currentAnims.DefaultAnimation.AnimID, out currentAnimationState))
|
||||
return currentAnimationState;
|
||||
}
|
||||
}
|
||||
return String.Empty;
|
||||
|
||||
Reference in New Issue
Block a user