diff options
author | Robert Adams | 2013-05-30 19:15:14 -0700 |
---|---|---|
committer | Robert Adams | 2013-05-30 19:16:36 -0700 |
commit | 4d32ca19bf27048105aeb01c67f0f9647ed3e700 (patch) | |
tree | 403d99ad25e4e1fd2f2c9883501eafcb3390bff6 /OpenSim/Region/Framework | |
parent | Add methods to Animation and AnimationSet for easier manipulation and (diff) | |
download | opensim-SC_OLD-4d32ca19bf27048105aeb01c67f0f9647ed3e700.zip opensim-SC_OLD-4d32ca19bf27048105aeb01c67f0f9647ed3e700.tar.gz opensim-SC_OLD-4d32ca19bf27048105aeb01c67f0f9647ed3e700.tar.bz2 opensim-SC_OLD-4d32ca19bf27048105aeb01c67f0f9647ed3e700.tar.xz |
Trigger OnScenePresenceUpdated when the avatar's animations change.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 8 |
2 files changed, 21 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index e92a087..a701a79 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -92,7 +92,9 @@ 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 | } | ||
96 | } | 98 | } |
97 | 99 | ||
98 | // Called from scripts | 100 | // Called from scripts |
@@ -131,7 +133,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
131 | GetAnimName(animID), animID, m_scenePresence.Name); | 133 | GetAnimName(animID), animID, m_scenePresence.Name); |
132 | 134 | ||
133 | if (m_animations.Remove(animID, allowNoDefault)) | 135 | if (m_animations.Remove(animID, allowNoDefault)) |
136 | { | ||
134 | SendAnimPack(); | 137 | SendAnimPack(); |
138 | } | ||
135 | } | 139 | } |
136 | 140 | ||
137 | // Called from scripts | 141 | // Called from scripts |
@@ -163,8 +167,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
163 | /// The movement animation is reserved for "main" animations | 167 | /// The movement animation is reserved for "main" animations |
164 | /// that are mutually exclusive, e.g. flying and sitting. | 168 | /// that are mutually exclusive, e.g. flying and sitting. |
165 | /// </summary> | 169 | /// </summary> |
166 | public void TrySetMovementAnimation(string anim) | 170 | /// <returns>'true' if the animation was updated</returns> |
171 | public bool TrySetMovementAnimation(string anim) | ||
167 | { | 172 | { |
173 | bool ret = false; | ||
168 | if (!m_scenePresence.IsChildAgent) | 174 | if (!m_scenePresence.IsChildAgent) |
169 | { | 175 | { |
170 | // m_log.DebugFormat( | 176 | // m_log.DebugFormat( |
@@ -181,6 +187,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
181 | // 16384 is CHANGED_ANIMATION | 187 | // 16384 is CHANGED_ANIMATION |
182 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); | 188 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); |
183 | SendAnimPack(); | 189 | SendAnimPack(); |
190 | ret = true; | ||
184 | } | 191 | } |
185 | } | 192 | } |
186 | else | 193 | else |
@@ -189,6 +196,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
189 | "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", | 196 | "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", |
190 | anim, m_scenePresence.Name); | 197 | anim, m_scenePresence.Name); |
191 | } | 198 | } |
199 | return ret; | ||
192 | } | 200 | } |
193 | 201 | ||
194 | /// <summary> | 202 | /// <summary> |
@@ -422,8 +430,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
422 | /// <summary> | 430 | /// <summary> |
423 | /// Update the movement animation of this avatar according to its current state | 431 | /// Update the movement animation of this avatar according to its current state |
424 | /// </summary> | 432 | /// </summary> |
425 | public void UpdateMovementAnimations() | 433 | /// <returns>'true' if the animation was changed</returns> |
434 | public bool UpdateMovementAnimations() | ||
426 | { | 435 | { |
436 | bool ret = false; | ||
427 | lock (m_animations) | 437 | lock (m_animations) |
428 | { | 438 | { |
429 | string newMovementAnimation = DetermineMovementAnimation(); | 439 | string newMovementAnimation = DetermineMovementAnimation(); |
@@ -437,9 +447,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
437 | 447 | ||
438 | // Only set it if it's actually changed, give a script | 448 | // Only set it if it's actually changed, give a script |
439 | // a chance to stop a default animation | 449 | // a chance to stop a default animation |
440 | TrySetMovementAnimation(CurrentMovementAnimation); | 450 | ret = TrySetMovementAnimation(CurrentMovementAnimation); |
441 | } | 451 | } |
442 | } | 452 | } |
453 | return ret; | ||
443 | } | 454 | } |
444 | 455 | ||
445 | public UUID[] GetAnimationArray() | 456 | public UUID[] GetAnimationArray() |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e8aa52e..b8ff7f7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -2039,6 +2039,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2039 | } | 2039 | } |
2040 | 2040 | ||
2041 | Animator.TrySetMovementAnimation("STAND"); | 2041 | Animator.TrySetMovementAnimation("STAND"); |
2042 | TriggerScenePresenceUpdated(); | ||
2042 | } | 2043 | } |
2043 | 2044 | ||
2044 | private SceneObjectPart FindNextAvailableSitTarget(UUID targetID) | 2045 | private SceneObjectPart FindNextAvailableSitTarget(UUID targetID) |
@@ -2432,6 +2433,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2432 | } | 2433 | } |
2433 | Animator.TrySetMovementAnimation(sitAnimation); | 2434 | Animator.TrySetMovementAnimation(sitAnimation); |
2434 | SendAvatarDataToAllAgents(); | 2435 | SendAvatarDataToAllAgents(); |
2436 | TriggerScenePresenceUpdated(); | ||
2435 | } | 2437 | } |
2436 | } | 2438 | } |
2437 | 2439 | ||
@@ -2440,6 +2442,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2440 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. | 2442 | // m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.. |
2441 | m_AngularVelocity = Vector3.Zero; | 2443 | m_AngularVelocity = Vector3.Zero; |
2442 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 2444 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
2445 | TriggerScenePresenceUpdated(); | ||
2443 | SitGround = true; | 2446 | SitGround = true; |
2444 | RemoveFromPhysicalScene(); | 2447 | RemoveFromPhysicalScene(); |
2445 | } | 2448 | } |
@@ -2456,11 +2459,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2456 | public void HandleStartAnim(IClientAPI remoteClient, UUID animID) | 2459 | public void HandleStartAnim(IClientAPI remoteClient, UUID animID) |
2457 | { | 2460 | { |
2458 | Animator.AddAnimation(animID, UUID.Zero); | 2461 | Animator.AddAnimation(animID, UUID.Zero); |
2462 | TriggerScenePresenceUpdated(); | ||
2459 | } | 2463 | } |
2460 | 2464 | ||
2461 | public void HandleStopAnim(IClientAPI remoteClient, UUID animID) | 2465 | public void HandleStopAnim(IClientAPI remoteClient, UUID animID) |
2462 | { | 2466 | { |
2463 | Animator.RemoveAnimation(animID, false); | 2467 | Animator.RemoveAnimation(animID, false); |
2468 | TriggerScenePresenceUpdated(); | ||
2464 | } | 2469 | } |
2465 | 2470 | ||
2466 | /// <summary> | 2471 | /// <summary> |
@@ -3465,7 +3470,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3465 | 3470 | ||
3466 | // if (m_updateCount > 0) | 3471 | // if (m_updateCount > 0) |
3467 | // { | 3472 | // { |
3468 | Animator.UpdateMovementAnimations(); | 3473 | if (Animator.UpdateMovementAnimations()) |
3474 | TriggerScenePresenceUpdated(); | ||
3469 | // m_updateCount--; | 3475 | // m_updateCount--; |
3470 | // } | 3476 | // } |
3471 | 3477 | ||