aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-11 01:56:42 +0100
committerJustin Clark-Casey (justincc)2011-08-11 01:56:42 +0100
commit4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8 (patch)
treeff44ea86dfd8ba586ae4439728ef26341085691a /OpenSim/Region
parentIf SP.MoveToTarget has been called with a force walk, begin by landing the av... (diff)
downloadopensim-SC_OLD-4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8.zip
opensim-SC_OLD-4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8.tar.gz
opensim-SC_OLD-4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8.tar.bz2
opensim-SC_OLD-4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8.tar.xz
Get NPCs to revert to the correct 'resting' animation (e.g. stand or hover) after finishing their movement. This also fixes judder after an avatar has finished "go here"/autopilot movement in a viewer.
This meant reseting the SP.AgentControlFlags since the Animator uses these to determine the correct default animation.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs8
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs2
5 files changed, 19 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4ab818f..e07d8b4 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
77 if (m_scenePresence.IsChildAgent) 77 if (m_scenePresence.IsChildAgent)
78 return; 78 return;
79 79
80// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
81
80 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) 82 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
81 SendAnimPack(); 83 SendAnimPack();
82 } 84 }
@@ -91,6 +93,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
91 if (animID == UUID.Zero) 93 if (animID == UUID.Zero)
92 return; 94 return;
93 95
96// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name);
97
94 AddAnimation(animID, objectID); 98 AddAnimation(animID, objectID);
95 } 99 }
96 100
@@ -127,13 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation
127 /// </summary> 131 /// </summary>
128 public void TrySetMovementAnimation(string anim) 132 public void TrySetMovementAnimation(string anim)
129 { 133 {
130 //m_log.DebugFormat("Updating movement animation to {0}", anim);
131
132 if (!m_scenePresence.IsChildAgent) 134 if (!m_scenePresence.IsChildAgent)
133 { 135 {
134 if (m_animations.TrySetDefaultAnimation( 136 if (m_animations.TrySetDefaultAnimation(
135 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) 137 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
136 { 138 {
139// m_log.DebugFormat(
140// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}",
141// anim, m_scenePresence.Name);
142
137 // 16384 is CHANGED_ANIMATION 143 // 16384 is CHANGED_ANIMATION
138 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); 144 m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION});
139 SendAnimPack(); 145 SendAnimPack();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 12a4712..7a30684 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1745,6 +1745,12 @@ namespace OpenSim.Region.Framework.Scenes
1745 1745
1746 MovingToTarget = false; 1746 MovingToTarget = false;
1747 MoveToPositionTarget = Vector3.Zero; 1747 MoveToPositionTarget = Vector3.Zero;
1748
1749 // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct
1750 // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag.
1751 // However, the line is here rather than in the NPC module since it also appears necessary to stop a
1752 // viewer that uses "go here" from juddering on all subsequent avatar movements.
1753 AgentControlFlags = (uint)AgentManager.ControlFlags.NONE;
1748 } 1754 }
1749 1755
1750 private void CheckAtSitTarget() 1756 private void CheckAtSitTarget()
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index f38af46..0e313df 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -95,11 +95,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC
95// } 95// }
96 } 96 }
97 97
98 // FIXME: This doesn't work 98// m_log.DebugFormat(
99 if (presence.PhysicsActor.Flying) 99// "[NPC MODULE]: AgentControlFlags {0}, MovementFlag {1} for {2}",
100 presence.Animator.TrySetMovementAnimation("HOVER"); 100// presence.AgentControlFlags, presence.MovementFlag, presence.Name);
101 else
102 presence.Animator.TrySetMovementAnimation("STAND");
103 } 101 }
104 else 102 else
105 { 103 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index d220fab..2742b67 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -131,6 +131,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
131 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); 131 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos);
132 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); 132 Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move");
133 Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); 133 Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos));
134 Assert.That(npc.AgentControlFlags, Is.EqualTo((uint)AgentManager.ControlFlags.NONE));
134 135
135 // Try a second movement 136 // Try a second movement
136 startPos = npc.AbsolutePosition; 137 startPos = npc.AbsolutePosition;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index f83304b..71fc15f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -870,7 +870,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
870 ScenePresence target = (ScenePresence)World.Entities[avatarID]; 870 ScenePresence target = (ScenePresence)World.Entities[avatarID];
871 if (target != null) 871 if (target != null)
872 { 872 {
873 UUID animID=UUID.Zero; 873 UUID animID = UUID.Zero;
874 lock (m_host.TaskInventory) 874 lock (m_host.TaskInventory)
875 { 875 {
876 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) 876 foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)