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

View File

@ -1293,11 +1293,11 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: In {0} received agent update from {1}", // "[SCENE PRESENCE]: In {0} received agent update from {1}",
// Scene.RegionInfo.RegionName, remoteClient.Name); // Scene.RegionInfo.RegionName, remoteClient.Name);
//if (IsChildAgent) if (IsChildAgent)
//{ {
// // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
// return; return;
//} }
++m_movementUpdateCount; ++m_movementUpdateCount;
if (m_movementUpdateCount < 1) if (m_movementUpdateCount < 1)
@ -3195,7 +3195,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
catch { } 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) 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. // Event called by the physics plugin to tell the avatar about a collision.
private void PhysicsCollisionUpdate(EventArgs e) private void PhysicsCollisionUpdate(EventArgs e)
{ {
if (IsChildAgent)
return;
//if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) //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( // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
// as of this comment the interval is set in AddToPhysicalScene // 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; flags |= ScriptBaseClass.AGENT_TYPING;
} }
string agentMovementAnimation = agent.Animator.GetMovementAnimation(); string agentMovementAnimation = agent.Animator.CurrentMovementAnimation;
if (agentMovementAnimation == "CROUCH") if (agentMovementAnimation == "CROUCH")
{ {