aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2012-10-04 15:20:04 +0200
committerMelanie2012-10-04 15:42:52 +0100
commitb977f962fab9be0c823b0b3ae9b4777241c9f22c (patch)
treec70b20a93616051f1889ddbaf4b9419d05c31fd5
parentOutput monitor data in response to console command on MainConsole.Instance ra... (diff)
downloadopensim-SC-b977f962fab9be0c823b0b3ae9b4777241c9f22c.zip
opensim-SC-b977f962fab9be0c823b0b3ae9b4777241c9f22c.tar.gz
opensim-SC-b977f962fab9be0c823b0b3ae9b4777241c9f22c.tar.bz2
opensim-SC-b977f962fab9be0c823b0b3ae9b4777241c9f22c.tar.xz
Allow default animation to be stopped to be replaced with another one.
Fixes Mantis #6327
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs27
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs18
2 files changed, 29 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
index 33041e9..ad421ee 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
87 { 87 {
88 if (m_defaultAnimation.AnimID == animID) 88 if (m_defaultAnimation.AnimID == animID)
89 { 89 {
90 ResetDefaultAnimation(); 90 m_defaultAnimation = new OpenSim.Framework.Animation(UUID.Zero, 1, UUID.Zero);
91 } 91 }
92 else if (HasAnimation(animID)) 92 else if (HasAnimation(animID))
93 { 93 {
@@ -149,19 +149,26 @@ namespace OpenSim.Region.Framework.Scenes.Animation
149 { 149 {
150 lock (m_animations) 150 lock (m_animations)
151 { 151 {
152 animIDs = new UUID[m_animations.Count + 1]; 152 int defaultSize = 0;
153 sequenceNums = new int[m_animations.Count + 1]; 153 if (m_defaultAnimation.AnimID != UUID.Zero)
154 objectIDs = new UUID[m_animations.Count + 1]; 154 defaultSize++;
155 155
156 animIDs[0] = m_defaultAnimation.AnimID; 156 animIDs = new UUID[m_animations.Count + defaultSize];
157 sequenceNums[0] = m_defaultAnimation.SequenceNum; 157 sequenceNums = new int[m_animations.Count + defaultSize];
158 objectIDs[0] = m_defaultAnimation.ObjectID; 158 objectIDs = new UUID[m_animations.Count + defaultSize];
159
160 if (m_defaultAnimation.AnimID != UUID.Zero)
161 {
162 animIDs[0] = m_defaultAnimation.AnimID;
163 sequenceNums[0] = m_defaultAnimation.SequenceNum;
164 objectIDs[0] = m_defaultAnimation.ObjectID;
165 }
159 166
160 for (int i = 0; i < m_animations.Count; ++i) 167 for (int i = 0; i < m_animations.Count; ++i)
161 { 168 {
162 animIDs[i + 1] = m_animations[i].AnimID; 169 animIDs[i + defaultSize] = m_animations[i].AnimID;
163 sequenceNums[i + 1] = m_animations[i].SequenceNum; 170 sequenceNums[i + defaultSize] = m_animations[i].SequenceNum;
164 objectIDs[i + 1] = m_animations[i].ObjectID; 171 objectIDs[i + defaultSize] = m_animations[i].ObjectID;
165 } 172 }
166 } 173 }
167 } 174 }
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index ff53f45..bb33f07 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -408,13 +408,19 @@ namespace OpenSim.Region.Framework.Scenes.Animation
408 { 408 {
409 lock (m_animations) 409 lock (m_animations)
410 { 410 {
411 CurrentMovementAnimation = DetermineMovementAnimation(); 411 string newMovementAnimation = DetermineMovementAnimation();
412 if (CurrentMovementAnimation != newMovementAnimation)
413 {
414 CurrentMovementAnimation = DetermineMovementAnimation();
412 415
413// m_log.DebugFormat( 416// m_log.DebugFormat(
414// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()", 417// "[SCENE PRESENCE ANIMATOR]: Determined animation {0} for {1} in UpdateMovementAnimations()",
415// CurrentMovementAnimation, m_scenePresence.Name); 418// CurrentMovementAnimation, m_scenePresence.Name);
416 419
417 TrySetMovementAnimation(CurrentMovementAnimation); 420 // Only set it if it's actually changed, give a script
421 // a chance to stop a default animation
422 TrySetMovementAnimation(CurrentMovementAnimation);
423 }
418 } 424 }
419 } 425 }
420 426
@@ -536,4 +542,4 @@ namespace OpenSim.Region.Framework.Scenes.Animation
536 SendAnimPack(animIDs, sequenceNums, objectIDs); 542 SendAnimPack(animIDs, sequenceNums, objectIDs);
537 } 543 }
538 } 544 }
539} \ No newline at end of file 545}