Merge branch 'master' of /home/opensim/var/repo/opensim

iar_mods
BlueWall 2011-12-02 20:21:35 -05:00
commit b94ab10922
3 changed files with 35 additions and 29 deletions

View File

@ -54,11 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// <value>
/// The current movement animation
/// </value>
public string CurrentMovementAnimation
{
get { return m_movementAnimation; }
}
protected string m_movementAnimation = "CROUCH";
public string CurrentMovementAnimation { get; private set; }
private int m_animTickFall;
public int m_animTickJump; // ScenePresence has to see this to control +Z force
public bool m_jumping = false;
@ -79,6 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public ScenePresenceAnimator(ScenePresence sp)
{
m_scenePresence = sp;
CurrentMovementAnimation = "CROUCH";
}
public void AddAnimation(UUID animID, UUID objectID)
@ -146,6 +144,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
{
if (!m_scenePresence.IsChildAgent)
{
// m_log.DebugFormat(
// "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}",
// anim, m_scenePresence.Name);
if (m_animations.TrySetDefaultAnimation(
anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
{
@ -158,20 +160,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
SendAnimPack();
}
}
// Don't leave this on since on teleports SP.HandleAgentUpdate() still hammers us for a while after it teleports
// else
// {
// m_log.WarnFormat(
// "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
// anim, m_scenePresence.Name);
// throw new Exception(string.Format("aaargh on setting {0}", anim));
// }
else
{
m_log.WarnFormat(
"[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
anim, m_scenePresence.Name);
}
}
/// <summary>
/// This method determines the proper movement related animation
/// </summary>
public string GetMovementAnimation()
private string DetermineMovementAnimation()
{
const float FALL_DELAY = 800f;
const float PREJUMP_DELAY = 200f;
@ -274,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
return "FALLDOWN";
}
return m_movementAnimation;
return CurrentMovementAnimation;
}
#endregion Falling/Floating/Landing
@ -285,7 +285,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation
int jumptime;
jumptime = Environment.TickCount - m_animTickJump;
if ((move.Z > 0f) && (!m_jumping))
{
// Start jumping, prejump
@ -329,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
#region Ground Movement
if (m_movementAnimation == "FALLDOWN")
if (CurrentMovementAnimation == "FALLDOWN")
{
m_falling = false;
m_animTickFall = Environment.TickCount;
@ -342,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation
else
return "LAND";
}
else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP"))
else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP"))
{
int landElapsed = Environment.TickCount - m_animTickFall;
int limit = 1000;
if(m_movementAnimation == "LAND") limit = 350;
if (CurrentMovementAnimation == "LAND")
limit = 350;
// NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client
if ((m_animTickFall != 0) && (landElapsed <= limit))
{
return m_movementAnimation;
return CurrentMovementAnimation;
}
else
{
@ -389,7 +389,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
#endregion Ground Movement
m_falling = false;
return m_movementAnimation;
return CurrentMovementAnimation;
}
/// <summary>
@ -397,8 +398,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary>
public void UpdateMovementAnimations()
{
m_movementAnimation = GetMovementAnimation();
TrySetMovementAnimation(m_movementAnimation);
CurrentMovementAnimation = DetermineMovementAnimation();
TrySetMovementAnimation(CurrentMovementAnimation);
}
public UUID[] GetAnimationArray()

View File

@ -1293,11 +1293,11 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: In {0} received agent update from {1}",
// Scene.RegionInfo.RegionName, remoteClient.Name);
//if (IsChildAgent)
//{
if (IsChildAgent)
{
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
// return;
//}
return;
}
++m_movementUpdateCount;
if (m_movementUpdateCount < 1)
@ -3195,7 +3195,9 @@ namespace OpenSim.Region.Framework.Scenes
}
catch { }
Animator.Animations.FromArray(cAgent.Anims);
// FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
if (cAgent.Anims != null)
Animator.Animations.FromArray(cAgent.Anims);
if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
{
@ -3280,6 +3282,9 @@ namespace OpenSim.Region.Framework.Scenes
// Event called by the physics plugin to tell the avatar about a collision.
private void PhysicsCollisionUpdate(EventArgs e)
{
if (IsChildAgent)
return;
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
// The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene

View File

@ -5554,7 +5554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
flags |= ScriptBaseClass.AGENT_TYPING;
}
string agentMovementAnimation = agent.Animator.GetMovementAnimation();
string agentMovementAnimation = agent.Animator.CurrentMovementAnimation;
if (agentMovementAnimation == "CROUCH")
{