diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index e92a087..6d51029 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -35,7 +35,7 @@ using OpenMetaverse; | |||
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Region.Physics.Manager; | 38 | using OpenSim.Region.PhysicsModules.SharedBase; |
39 | 39 | ||
40 | namespace OpenSim.Region.Framework.Scenes.Animation | 40 | namespace OpenSim.Region.Framework.Scenes.Animation |
41 | { | 41 | { |
@@ -92,7 +92,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
92 | GetAnimName(animID), animID, m_scenePresence.Name); | 92 | GetAnimName(animID), animID, m_scenePresence.Name); |
93 | 93 | ||
94 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) | 94 | if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) |
95 | { | ||
95 | SendAnimPack(); | 96 | SendAnimPack(); |
97 | m_scenePresence.TriggerScenePresenceUpdated(); | ||
98 | } | ||
96 | } | 99 | } |
97 | 100 | ||
98 | // Called from scripts | 101 | // Called from scripts |
@@ -131,7 +134,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
131 | GetAnimName(animID), animID, m_scenePresence.Name); | 134 | GetAnimName(animID), animID, m_scenePresence.Name); |
132 | 135 | ||
133 | if (m_animations.Remove(animID, allowNoDefault)) | 136 | if (m_animations.Remove(animID, allowNoDefault)) |
137 | { | ||
134 | SendAnimPack(); | 138 | SendAnimPack(); |
139 | m_scenePresence.TriggerScenePresenceUpdated(); | ||
140 | } | ||
135 | } | 141 | } |
136 | 142 | ||
137 | // Called from scripts | 143 | // Called from scripts |
@@ -163,8 +169,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
163 | /// The movement animation is reserved for "main" animations | 169 | /// The movement animation is reserved for "main" animations |
164 | /// that are mutually exclusive, e.g. flying and sitting. | 170 | /// that are mutually exclusive, e.g. flying and sitting. |
165 | /// </summary> | 171 | /// </summary> |
166 | public void TrySetMovementAnimation(string anim) | 172 | /// <returns>'true' if the animation was updated</returns> |
173 | public bool TrySetMovementAnimation(string anim) | ||
167 | { | 174 | { |
175 | bool ret = false; | ||
168 | if (!m_scenePresence.IsChildAgent) | 176 | if (!m_scenePresence.IsChildAgent) |
169 | { | 177 | { |
170 | // m_log.DebugFormat( | 178 | // m_log.DebugFormat( |
@@ -181,6 +189,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
181 | // 16384 is CHANGED_ANIMATION | 189 | // 16384 is CHANGED_ANIMATION |
182 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); | 190 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); |
183 | SendAnimPack(); | 191 | SendAnimPack(); |
192 | ret = true; | ||
184 | } | 193 | } |
185 | } | 194 | } |
186 | else | 195 | else |
@@ -189,6 +198,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
189 | "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", | 198 | "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", |
190 | anim, m_scenePresence.Name); | 199 | anim, m_scenePresence.Name); |
191 | } | 200 | } |
201 | return ret; | ||
192 | } | 202 | } |
193 | 203 | ||
194 | /// <summary> | 204 | /// <summary> |
@@ -393,11 +403,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
393 | Falling = false; | 403 | Falling = false; |
394 | // Walking / crouchwalking / running | 404 | // Walking / crouchwalking / running |
395 | if (move.Z < 0f) | 405 | if (move.Z < 0f) |
406 | { | ||
396 | return "CROUCHWALK"; | 407 | return "CROUCHWALK"; |
397 | else if (m_scenePresence.SetAlwaysRun) | 408 | } |
398 | return "RUN"; | 409 | // We need to prevent these animations if the user tries to make their avatar walk or run whilst |
399 | else | 410 | // specifying AGENT_CONTROL_STOP (pressing down space on viewers). |
400 | return "WALK"; | 411 | else if (!m_scenePresence.AgentControlStopActive) |
412 | { | ||
413 | if (m_scenePresence.SetAlwaysRun) | ||
414 | return "RUN"; | ||
415 | else | ||
416 | return "WALK"; | ||
417 | } | ||
401 | } | 418 | } |
402 | else if (!m_jumping) | 419 | else if (!m_jumping) |
403 | { | 420 | { |
@@ -422,8 +439,12 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
422 | /// <summary> | 439 | /// <summary> |
423 | /// Update the movement animation of this avatar according to its current state | 440 | /// Update the movement animation of this avatar according to its current state |
424 | /// </summary> | 441 | /// </summary> |
425 | public void UpdateMovementAnimations() | 442 | /// <returns>'true' if the animation was changed</returns> |
443 | public bool UpdateMovementAnimations() | ||
426 | { | 444 | { |
445 | // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Updating movement animations for {0}", m_scenePresence.Name); | ||
446 | |||
447 | bool ret = false; | ||
427 | lock (m_animations) | 448 | lock (m_animations) |
428 | { | 449 | { |
429 | string newMovementAnimation = DetermineMovementAnimation(); | 450 | string newMovementAnimation = DetermineMovementAnimation(); |
@@ -437,9 +458,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
437 | 458 | ||
438 | // Only set it if it's actually changed, give a script | 459 | // Only set it if it's actually changed, give a script |
439 | // a chance to stop a default animation | 460 | // a chance to stop a default animation |
440 | TrySetMovementAnimation(CurrentMovementAnimation); | 461 | ret = TrySetMovementAnimation(CurrentMovementAnimation); |
441 | } | 462 | } |
442 | } | 463 | } |
464 | return ret; | ||
443 | } | 465 | } |
444 | 466 | ||
445 | public UUID[] GetAnimationArray() | 467 | public UUID[] GetAnimationArray() |