Fixed: custom walking animations didn't stop when the avatar stopped walking.
This happened because the scripts were notified about control changes (e.g., the user stopped pressing the Forward key) when the animation was still WALK, so the script didn't stop the walking animation. Fixing this required: a) Update the movement animation *before* notifying the script; b) Add locking to prevent clashes with the Heartbeat thread (which also updates the animations); c) Handle the case of a user who stops walking just as the avatar is in the air: the avatar should STAND in that case, not WALK.
This reverts commit feef1dd732
.
0.7.4.1
parent
9622e8ac72
commit
6473674bbf
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -278,6 +278,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
return "FALLDOWN";
|
||||
}
|
||||
|
||||
// Check if the user has stopped walking just now
|
||||
if (CurrentMovementAnimation == "WALK" && (move == Vector3.Zero))
|
||||
return "STAND";
|
||||
|
||||
return CurrentMovementAnimation;
|
||||
}
|
||||
|
||||
|
@ -401,6 +405,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
/// Update the movement animation of this avatar according to its current state
|
||||
/// </summary>
|
||||
public void UpdateMovementAnimations()
|
||||
{
|
||||
lock (m_animations)
|
||||
{
|
||||
CurrentMovementAnimation = DetermineMovementAnimation();
|
||||
|
||||
|
@ -410,6 +416,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
|
|||
|
||||
TrySetMovementAnimation(CurrentMovementAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
public UUID[] GetAnimationArray()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -45,6 +45,7 @@ using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags;
|
|||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
[Flags]
|
||||
enum ScriptControlled : uint
|
||||
{
|
||||
CONTROL_ZERO = 0,
|
||||
|
@ -1220,7 +1221,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}",
|
||||
// Scene.RegionInfo.RegionName, remoteClient.Name, agentData.ControlFlags);
|
||||
// Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags);
|
||||
|
||||
if (IsChildAgent)
|
||||
{
|
||||
|
@ -1320,14 +1321,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
if (scriptedcontrols.Count > 0)
|
||||
{
|
||||
SendControlToScripts((uint)flags);
|
||||
uint flagsForScripts = (uint)flags;
|
||||
flags = RemoveIgnoredControls(flags, IgnoredControls);
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
|
||||
HandleAgentSitOnGround();
|
||||
|
@ -1514,8 +1509,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// }
|
||||
// }
|
||||
|
||||
// if (update_movementflag && ParentID == 0)
|
||||
// Animator.UpdateMovementAnimations();
|
||||
if (update_movementflag && ParentID == 0)
|
||||
Animator.UpdateMovementAnimations();
|
||||
|
||||
lock (scriptedcontrols)
|
||||
{
|
||||
if (scriptedcontrols.Count > 0)
|
||||
{
|
||||
// Notify the scripts only after calling UpdateMovementAnimations(), so that if a script
|
||||
// (e.g., a walking script) checks which animation is active it will be the correct animation.
|
||||
SendControlToScripts(flagsForScripts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||
|
|
Loading…
Reference in New Issue