aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2011-12-02 20:21:35 -0500
committerBlueWall2011-12-02 20:21:35 -0500
commitb94ab10922f65237546c4a9bf56af3544f9c3257 (patch)
tree57fd17350743352ecbb29dcbe54948de1064b703
parentMerge branch 'master' of /home/opensim/var/repo/opensim (diff)
parentrefactor: Use just ScenePresenceAnimator.CurrentMovementAnimation rather than... (diff)
downloadopensim-SC_OLD-b94ab10922f65237546c4a9bf56af3544f9c3257.zip
opensim-SC_OLD-b94ab10922f65237546c4a9bf56af3544f9c3257.tar.gz
opensim-SC_OLD-b94ab10922f65237546c4a9bf56af3544f9c3257.tar.bz2
opensim-SC_OLD-b94ab10922f65237546c4a9bf56af3544f9c3257.tar.xz
Merge branch 'master' of /home/opensim/var/repo/opensim
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs2
3 files changed, 35 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 6b1208c..2a6b8ea 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -54,11 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
54 /// <value> 54 /// <value>
55 /// The current movement animation 55 /// The current movement animation
56 /// </value> 56 /// </value>
57 public string CurrentMovementAnimation 57 public string CurrentMovementAnimation { get; private set; }
58 { 58
59 get { return m_movementAnimation; }
60 }
61 protected string m_movementAnimation = "CROUCH";
62 private int m_animTickFall; 59 private int m_animTickFall;
63 public int m_animTickJump; // ScenePresence has to see this to control +Z force 60 public int m_animTickJump; // ScenePresence has to see this to control +Z force
64 public bool m_jumping = false; 61 public bool m_jumping = false;
@@ -79,6 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
79 public ScenePresenceAnimator(ScenePresence sp) 76 public ScenePresenceAnimator(ScenePresence sp)
80 { 77 {
81 m_scenePresence = sp; 78 m_scenePresence = sp;
79 CurrentMovementAnimation = "CROUCH";
82 } 80 }
83 81
84 public void AddAnimation(UUID animID, UUID objectID) 82 public void AddAnimation(UUID animID, UUID objectID)
@@ -146,6 +144,10 @@ namespace OpenSim.Region.Framework.Scenes.Animation
146 { 144 {
147 if (!m_scenePresence.IsChildAgent) 145 if (!m_scenePresence.IsChildAgent)
148 { 146 {
147// m_log.DebugFormat(
148// "[SCENE PRESENCE ANIMATOR]: Setting movement animation {0} for {1}",
149// anim, m_scenePresence.Name);
150
149 if (m_animations.TrySetDefaultAnimation( 151 if (m_animations.TrySetDefaultAnimation(
150 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) 152 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
151 { 153 {
@@ -158,20 +160,18 @@ namespace OpenSim.Region.Framework.Scenes.Animation
158 SendAnimPack(); 160 SendAnimPack();
159 } 161 }
160 } 162 }
161 // Don't leave this on since on teleports SP.HandleAgentUpdate() still hammers us for a while after it teleports 163 else
162// else 164 {
163// { 165 m_log.WarnFormat(
164// m_log.WarnFormat( 166 "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}",
165// "[SCENE PRESENCE ANIMATOR]: Tried to set movement animation {0} on child presence {1}", 167 anim, m_scenePresence.Name);
166// anim, m_scenePresence.Name); 168 }
167// throw new Exception(string.Format("aaargh on setting {0}", anim));
168// }
169 } 169 }
170 170
171 /// <summary> 171 /// <summary>
172 /// This method determines the proper movement related animation 172 /// This method determines the proper movement related animation
173 /// </summary> 173 /// </summary>
174 public string GetMovementAnimation() 174 private string DetermineMovementAnimation()
175 { 175 {
176 const float FALL_DELAY = 800f; 176 const float FALL_DELAY = 800f;
177 const float PREJUMP_DELAY = 200f; 177 const float PREJUMP_DELAY = 200f;
@@ -274,7 +274,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
274 return "FALLDOWN"; 274 return "FALLDOWN";
275 } 275 }
276 276
277 return m_movementAnimation; 277 return CurrentMovementAnimation;
278 } 278 }
279 279
280 #endregion Falling/Floating/Landing 280 #endregion Falling/Floating/Landing
@@ -285,7 +285,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation
285 int jumptime; 285 int jumptime;
286 jumptime = Environment.TickCount - m_animTickJump; 286 jumptime = Environment.TickCount - m_animTickJump;
287 287
288
289 if ((move.Z > 0f) && (!m_jumping)) 288 if ((move.Z > 0f) && (!m_jumping))
290 { 289 {
291 // Start jumping, prejump 290 // Start jumping, prejump
@@ -329,7 +328,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
329 328
330 #region Ground Movement 329 #region Ground Movement
331 330
332 if (m_movementAnimation == "FALLDOWN") 331 if (CurrentMovementAnimation == "FALLDOWN")
333 { 332 {
334 m_falling = false; 333 m_falling = false;
335 m_animTickFall = Environment.TickCount; 334 m_animTickFall = Environment.TickCount;
@@ -342,16 +341,17 @@ namespace OpenSim.Region.Framework.Scenes.Animation
342 else 341 else
343 return "LAND"; 342 return "LAND";
344 } 343 }
345 else if ((m_movementAnimation == "LAND") || (m_movementAnimation == "SOFT_LAND") || (m_movementAnimation == "STANDUP")) 344 else if ((CurrentMovementAnimation == "LAND") || (CurrentMovementAnimation == "SOFT_LAND") || (CurrentMovementAnimation == "STANDUP"))
346 { 345 {
347 int landElapsed = Environment.TickCount - m_animTickFall; 346 int landElapsed = Environment.TickCount - m_animTickFall;
348 int limit = 1000; 347 int limit = 1000;
349 if(m_movementAnimation == "LAND") limit = 350; 348 if (CurrentMovementAnimation == "LAND")
349 limit = 350;
350 // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client 350 // NB if the above is set too long a weird anim reset from some place prevents STAND from being sent to client
351 351
352 if ((m_animTickFall != 0) && (landElapsed <= limit)) 352 if ((m_animTickFall != 0) && (landElapsed <= limit))
353 { 353 {
354 return m_movementAnimation; 354 return CurrentMovementAnimation;
355 } 355 }
356 else 356 else
357 { 357 {
@@ -389,7 +389,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
389 #endregion Ground Movement 389 #endregion Ground Movement
390 390
391 m_falling = false; 391 m_falling = false;
392 return m_movementAnimation; 392
393 return CurrentMovementAnimation;
393 } 394 }
394 395
395 /// <summary> 396 /// <summary>
@@ -397,8 +398,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
397 /// </summary> 398 /// </summary>
398 public void UpdateMovementAnimations() 399 public void UpdateMovementAnimations()
399 { 400 {
400 m_movementAnimation = GetMovementAnimation(); 401 CurrentMovementAnimation = DetermineMovementAnimation();
401 TrySetMovementAnimation(m_movementAnimation); 402 TrySetMovementAnimation(CurrentMovementAnimation);
402 } 403 }
403 404
404 public UUID[] GetAnimationArray() 405 public UUID[] GetAnimationArray()
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b93b67d..7156137 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1293,11 +1293,11 @@ namespace OpenSim.Region.Framework.Scenes
1293// "[SCENE PRESENCE]: In {0} received agent update from {1}", 1293// "[SCENE PRESENCE]: In {0} received agent update from {1}",
1294// Scene.RegionInfo.RegionName, remoteClient.Name); 1294// Scene.RegionInfo.RegionName, remoteClient.Name);
1295 1295
1296 //if (IsChildAgent) 1296 if (IsChildAgent)
1297 //{ 1297 {
1298 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); 1298 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
1299 // return; 1299 return;
1300 //} 1300 }
1301 1301
1302 ++m_movementUpdateCount; 1302 ++m_movementUpdateCount;
1303 if (m_movementUpdateCount < 1) 1303 if (m_movementUpdateCount < 1)
@@ -3195,7 +3195,9 @@ namespace OpenSim.Region.Framework.Scenes
3195 } 3195 }
3196 catch { } 3196 catch { }
3197 3197
3198 Animator.Animations.FromArray(cAgent.Anims); 3198 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3199 if (cAgent.Anims != null)
3200 Animator.Animations.FromArray(cAgent.Anims);
3199 3201
3200 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) 3202 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3201 { 3203 {
@@ -3280,6 +3282,9 @@ namespace OpenSim.Region.Framework.Scenes
3280 // Event called by the physics plugin to tell the avatar about a collision. 3282 // Event called by the physics plugin to tell the avatar about a collision.
3281 private void PhysicsCollisionUpdate(EventArgs e) 3283 private void PhysicsCollisionUpdate(EventArgs e)
3282 { 3284 {
3285 if (IsChildAgent)
3286 return;
3287
3283 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) 3288 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
3284 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( 3289 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
3285 // as of this comment the interval is set in AddToPhysicalScene 3290 // as of this comment the interval is set in AddToPhysicalScene
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 6c54c9b..6c418df 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5554,7 +5554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5554 flags |= ScriptBaseClass.AGENT_TYPING; 5554 flags |= ScriptBaseClass.AGENT_TYPING;
5555 } 5555 }
5556 5556
5557 string agentMovementAnimation = agent.Animator.GetMovementAnimation(); 5557 string agentMovementAnimation = agent.Animator.CurrentMovementAnimation;
5558 5558
5559 if (agentMovementAnimation == "CROUCH") 5559 if (agentMovementAnimation == "CROUCH")
5560 { 5560 {