diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs | 32 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 3 |
4 files changed, 48 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f7fd767..fa90ef4 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1495,7 +1495,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1495 | // Objects queue their updates onto all scene presences | 1495 | // Objects queue their updates onto all scene presences |
1496 | if (Frame % m_update_objects == 0) | 1496 | if (Frame % m_update_objects == 0) |
1497 | m_sceneGraph.UpdateObjectGroups(); | 1497 | m_sceneGraph.UpdateObjectGroups(); |
1498 | 1498 | ||
1499 | // Run through all ScenePresences looking for updates | 1499 | // Run through all ScenePresences looking for updates |
1500 | // Presence updates and queued object updates for each presence are sent to clients | 1500 | // Presence updates and queued object updates for each presence are sent to clients |
1501 | if (Frame % m_update_presences == 0) | 1501 | if (Frame % m_update_presences == 0) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d4af9fc..c8971c4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3084,9 +3084,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3084 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) | 3084 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) |
3085 | SendAvatarDataToAllAgents(); | 3085 | SendAvatarDataToAllAgents(); |
3086 | 3086 | ||
3087 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 3087 | // Allow any updates for sitting avatars to that llSetPrimitiveLinkParams() can work for very |
3088 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 3088 | // small increments (e.g. sit position adjusters). An alternative may be to eliminate the tolerance |
3089 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 3089 | // checks on all updates but the ramifications of this would need careful consideration. |
3090 | bool updateClients | ||
3091 | = IsSatOnObject && (Rotation != m_lastRotation || Velocity != m_lastVelocity || m_pos != m_lastPosition); | ||
3092 | |||
3093 | if (!updateClients) | ||
3094 | updateClients | ||
3095 | = !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) | ||
3096 | || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) | ||
3097 | || !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE); | ||
3098 | |||
3099 | if (updateClients) | ||
3090 | { | 3100 | { |
3091 | SendTerseUpdateToAllClients(); | 3101 | SendTerseUpdateToAllClients(); |
3092 | 3102 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs index 86381c4..1415925 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs | |||
@@ -77,14 +77,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
77 | m_engine.AddRegion(m_scene); | 77 | m_engine.AddRegion(m_scene); |
78 | } | 78 | } |
79 | 79 | ||
80 | /// <summary> | ||
81 | /// Test llSetLinkPrimtiveParams for agents. | ||
82 | /// </summary> | ||
83 | /// <remarks> | ||
84 | /// Also testing entity updates here as well. Possibly that's putting 2 different concerns into one test and | ||
85 | /// this should be separated. | ||
86 | /// </remarks> | ||
80 | [Test] | 87 | [Test] |
81 | public void TestllSetLinkPrimitiveParamsForAgent() | 88 | public void TestllSetLinkPrimitiveParamsForAgent() |
82 | { | 89 | { |
83 | TestHelpers.InMethod(); | 90 | TestHelpers.InMethod(); |
91 | // TestHelpers.EnableLogging(); | ||
84 | 92 | ||
85 | UUID userId = TestHelpers.ParseTail(0x1); | 93 | UUID userId = TestHelpers.ParseTail(0x1); |
86 | 94 | ||
87 | new SceneHelpers().SetupScene(); | ||
88 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; | 95 | SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; |
89 | part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f); | 96 | part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f); |
90 | 97 | ||
@@ -99,12 +106,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
99 | 106 | ||
100 | sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); | 107 | sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); |
101 | 108 | ||
109 | int entityUpdates = 0; | ||
110 | ((TestClient)sp.ControllingClient).OnReceivedEntityUpdate += (entity, flags) => { if (entity is ScenePresence) { entityUpdates++; }}; | ||
111 | |||
102 | // Test position | 112 | // Test position |
103 | { | 113 | { |
104 | Vector3 newPos = new Vector3(1, 2, 3); | 114 | Vector3 newPos = new Vector3(1, 2, 3); |
105 | apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos)); | 115 | apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos)); |
106 | 116 | ||
107 | Assert.That(sp.OffsetPosition, Is.EqualTo(newPos)); | 117 | Assert.That(sp.OffsetPosition, Is.EqualTo(newPos)); |
118 | |||
119 | m_scene.Update(1); | ||
120 | Assert.That(entityUpdates, Is.EqualTo(1)); | ||
121 | } | ||
122 | |||
123 | // Test small reposition | ||
124 | { | ||
125 | Vector3 newPos = new Vector3(1.001f, 2, 3); | ||
126 | apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos)); | ||
127 | |||
128 | Assert.That(sp.OffsetPosition, Is.EqualTo(newPos)); | ||
129 | |||
130 | m_scene.Update(1); | ||
131 | Assert.That(entityUpdates, Is.EqualTo(2)); | ||
108 | } | 132 | } |
109 | 133 | ||
110 | // Test world rotation | 134 | // Test world rotation |
@@ -114,6 +138,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
114 | 138 | ||
115 | Assert.That( | 139 | Assert.That( |
116 | sp.Rotation, new QuaternionToleranceConstraint(part.GetWorldRotation() * newRot, 0.000001)); | 140 | sp.Rotation, new QuaternionToleranceConstraint(part.GetWorldRotation() * newRot, 0.000001)); |
141 | |||
142 | m_scene.Update(1); | ||
143 | Assert.That(entityUpdates, Is.EqualTo(3)); | ||
117 | } | 144 | } |
118 | 145 | ||
119 | // Test local rotation | 146 | // Test local rotation |
@@ -123,6 +150,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
123 | 150 | ||
124 | Assert.That( | 151 | Assert.That( |
125 | sp.Rotation, new QuaternionToleranceConstraint(newRot, 0.000001)); | 152 | sp.Rotation, new QuaternionToleranceConstraint(newRot, 0.000001)); |
153 | |||
154 | m_scene.Update(1); | ||
155 | Assert.That(entityUpdates, Is.EqualTo(4)); | ||
126 | } | 156 | } |
127 | } | 157 | } |
128 | } | 158 | } |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 09ff531..c2b0935 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -62,6 +62,7 @@ namespace OpenSim.Tests.Common.Mock | |||
62 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; | 62 | public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; |
63 | public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; | 63 | public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; |
64 | public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; | 64 | public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport; |
65 | public event Action<ISceneEntity, PrimUpdateFlags> OnReceivedEntityUpdate; | ||
65 | public event Action<GridInstantMessage> OnReceivedInstantMessage; | 66 | public event Action<GridInstantMessage> OnReceivedInstantMessage; |
66 | public event Action<UUID> OnReceivedSendRebakeAvatarTextures; | 67 | public event Action<UUID> OnReceivedSendRebakeAvatarTextures; |
67 | 68 | ||
@@ -685,6 +686,8 @@ namespace OpenSim.Tests.Common.Mock | |||
685 | 686 | ||
686 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 687 | public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
687 | { | 688 | { |
689 | if (OnReceivedEntityUpdate != null) | ||
690 | OnReceivedEntityUpdate(entity, updateFlags); | ||
688 | } | 691 | } |
689 | 692 | ||
690 | public void ReprioritizeUpdates() | 693 | public void ReprioritizeUpdates() |