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/Scenes/Animation | |
parent | Add methods to Animation and AnimationSet for easier manipulation and (diff) | |
download | opensim-SC-4d32ca19bf27048105aeb01c67f0f9647ed3e700.zip opensim-SC-4d32ca19bf27048105aeb01c67f0f9647ed3e700.tar.gz opensim-SC-4d32ca19bf27048105aeb01c67f0f9647ed3e700.tar.bz2 opensim-SC-4d32ca19bf27048105aeb01c67f0f9647ed3e700.tar.xz |
Trigger OnScenePresenceUpdated when the avatar's animations change.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Animation')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 17 |
1 files changed, 14 insertions, 3 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() |