diff options
author | Melanie | 2010-11-27 01:08:12 +0000 |
---|---|---|
committer | Melanie | 2010-11-27 01:08:12 +0000 |
commit | e05f728b084d66de964b8d7fa0a9318b94526c4e (patch) | |
tree | 43feb59eae181a09e3a35c4f6a961e3cd8ad2352 /OpenSim | |
parent | Convert the scope id in the im session id to a URL variable. Fixes offline (diff) | |
parent | llVecNorm nant test (diff) | |
download | opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.zip opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.tar.gz opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.tar.bz2 opensim-SC-e05f728b084d66de964b8d7fa0a9318b94526c4e.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/Tests/InventoryTests.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/AssetLandmark.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 24 |
7 files changed, 79 insertions, 36 deletions
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index dc03259..9c2a2d6 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs | |||
@@ -323,7 +323,7 @@ namespace OpenSim.Data.Tests | |||
323 | .IgnoreProperty(x => x.InvType) | 323 | .IgnoreProperty(x => x.InvType) |
324 | .IgnoreProperty(x => x.CreatorIdAsUuid) | 324 | .IgnoreProperty(x => x.CreatorIdAsUuid) |
325 | .IgnoreProperty(x => x.Description) | 325 | .IgnoreProperty(x => x.Description) |
326 | .IgnoreProperty(x => x.CreatorId) | 326 | .IgnoreProperty(x => x.CreatorIdentification) |
327 | .IgnoreProperty(x => x.CreatorData)); | 327 | .IgnoreProperty(x => x.CreatorData)); |
328 | 328 | ||
329 | inventoryScrambler.Scramble(expected); | 329 | inventoryScrambler.Scramble(expected); |
@@ -334,7 +334,7 @@ namespace OpenSim.Data.Tests | |||
334 | .IgnoreProperty(x => x.InvType) | 334 | .IgnoreProperty(x => x.InvType) |
335 | .IgnoreProperty(x => x.CreatorIdAsUuid) | 335 | .IgnoreProperty(x => x.CreatorIdAsUuid) |
336 | .IgnoreProperty(x => x.Description) | 336 | .IgnoreProperty(x => x.Description) |
337 | .IgnoreProperty(x => x.CreatorId) | 337 | .IgnoreProperty(x => x.CreatorIdentification) |
338 | .IgnoreProperty(x => x.CreatorData)); | 338 | .IgnoreProperty(x => x.CreatorData)); |
339 | } | 339 | } |
340 | 340 | ||
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs index 7806c1f..f433235 100644 --- a/OpenSim/Framework/AssetLandmark.cs +++ b/OpenSim/Framework/AssetLandmark.cs | |||
@@ -51,8 +51,16 @@ namespace OpenSim.Framework | |||
51 | string[] parts = temp.Split('\n'); | 51 | string[] parts = temp.Split('\n'); |
52 | int.TryParse(parts[0].Substring(17, 1), out Version); | 52 | int.TryParse(parts[0].Substring(17, 1), out Version); |
53 | UUID.TryParse(parts[1].Substring(10, 36), out RegionID); | 53 | UUID.TryParse(parts[1].Substring(10, 36), out RegionID); |
54 | // the vector is stored with spaces as separators, not with commas ("10.3 32.5 43" instead of "10.3, 32.5, 43") | 54 | // The position is a vector with spaces as separators ("10.3 32.5 43"). |
55 | Vector3.TryParse(parts[2].Substring(10, parts[2].Length - 10).Replace(" ", ","), out Position); | 55 | // Parse each scalar separately to take into account the system's culture setting. |
56 | string[] scalars = parts[2].Substring(10, parts[2].Length - 10).Split(' '); | ||
57 | if (scalars.Length > 0) | ||
58 | System.Single.TryParse(scalars[0], out Position.X); | ||
59 | if (scalars.Length > 1) | ||
60 | System.Single.TryParse(scalars[1], out Position.Y); | ||
61 | if (scalars.Length > 2) | ||
62 | System.Single.TryParse(scalars[2], out Position.Z); | ||
63 | |||
56 | ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle); | 64 | ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle); |
57 | } | 65 | } |
58 | } | 66 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e479628..216eb51 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2384,16 +2384,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2384 | m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); | 2384 | m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); |
2385 | return false; | 2385 | return false; |
2386 | } | 2386 | } |
2387 | 2387 | ||
2388 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2); | 2388 | newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject)); |
2389 | 2389 | ||
2390 | newObject.ResumeScripts(); | 2390 | newObject.ResumeScripts(); |
2391 | 2391 | ||
2392 | // Do this as late as possible so that listeners have full access to the incoming object | 2392 | // Do this as late as possible so that listeners have full access to the incoming object |
2393 | EventManager.TriggerOnIncomingSceneObject(newObject); | 2393 | EventManager.TriggerOnIncomingSceneObject(newObject); |
2394 | 2394 | ||
2395 | TriggerChangedTeleport(newObject); | ||
2396 | |||
2397 | return true; | 2395 | return true; |
2398 | } | 2396 | } |
2399 | 2397 | ||
@@ -2520,7 +2518,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2520 | return true; | 2518 | return true; |
2521 | } | 2519 | } |
2522 | 2520 | ||
2523 | private void TriggerChangedTeleport(SceneObjectGroup sog) | 2521 | private int GetStateSource(SceneObjectGroup sog) |
2524 | { | 2522 | { |
2525 | ScenePresence sp = GetScenePresence(sog.OwnerID); | 2523 | ScenePresence sp = GetScenePresence(sog.OwnerID); |
2526 | 2524 | ||
@@ -2531,13 +2529,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2531 | if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) | 2529 | if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) |
2532 | { | 2530 | { |
2533 | // This will get your attention | 2531 | // This will get your attention |
2534 | //m_log.Error("[XXX] Triggering "); | 2532 | //m_log.Error("[XXX] Triggering CHANGED_TELEPORT"); |
2535 | 2533 | ||
2536 | // Trigger CHANGED_TELEPORT | 2534 | return 5; // StateSource.Teleporting |
2537 | sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT); | ||
2538 | } | 2535 | } |
2539 | |||
2540 | } | 2536 | } |
2537 | return 2; // StateSource.PrimCrossing | ||
2541 | } | 2538 | } |
2542 | 2539 | ||
2543 | #endregion | 2540 | #endregion |
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index aee2d10..3978a7d 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
86 | /// <param name="assetUuids">The assets gathered</param> | 86 | /// <param name="assetUuids">The assets gathered</param> |
87 | public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids) | 87 | public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids) |
88 | { | 88 | { |
89 | assetUuids[assetUuid] = assetType; | 89 | try |
90 | 90 | { | |
91 | if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType) | 91 | assetUuids[assetUuid] = assetType; |
92 | { | 92 | |
93 | GetWearableAssetUuids(assetUuid, assetUuids); | 93 | if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType) |
94 | } | 94 | { |
95 | else if (AssetType.Gesture == assetType) | 95 | GetWearableAssetUuids(assetUuid, assetUuids); |
96 | { | 96 | } |
97 | GetGestureAssetUuids(assetUuid, assetUuids); | 97 | else if (AssetType.Gesture == assetType) |
98 | } | 98 | { |
99 | else if (AssetType.LSLText == assetType) | 99 | GetGestureAssetUuids(assetUuid, assetUuids); |
100 | { | 100 | } |
101 | GetScriptAssetUuids(assetUuid, assetUuids); | 101 | else if (AssetType.LSLText == assetType) |
102 | { | ||
103 | GetScriptAssetUuids(assetUuid, assetUuids); | ||
104 | } | ||
105 | else if (AssetType.Object == assetType) | ||
106 | { | ||
107 | GetSceneObjectAssetUuids(assetUuid, assetUuids); | ||
108 | } | ||
102 | } | 109 | } |
103 | else if (AssetType.Object == assetType) | 110 | catch (Exception) |
104 | { | 111 | { |
105 | GetSceneObjectAssetUuids(assetUuid, assetUuids); | 112 | m_log.ErrorFormat( |
113 | "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", | ||
114 | assetUuid, assetType); | ||
115 | throw; | ||
106 | } | 116 | } |
107 | } | 117 | } |
108 | 118 | ||
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 0c99d8c..8b7871b 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -42,7 +42,8 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
42 | NewRez = 1, | 42 | NewRez = 1, |
43 | PrimCrossing = 2, | 43 | PrimCrossing = 2, |
44 | ScriptedRez = 3, | 44 | ScriptedRez = 3, |
45 | AttachedRez = 4 | 45 | AttachedRez = 4, |
46 | Teleporting = 5 | ||
46 | } | 47 | } |
47 | 48 | ||
48 | public interface IScriptWorkItem | 49 | public interface IScriptWorkItem |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 5288cd3..9548253 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -391,19 +391,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
391 | } | 391 | } |
392 | else if (m_stateSource == StateSource.RegionStart) | 392 | else if (m_stateSource == StateSource.RegionStart) |
393 | { | 393 | { |
394 | // m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); | 394 | //m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); |
395 | PostEvent(new EventParams("changed", | 395 | PostEvent(new EventParams("changed", |
396 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, | 396 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, new DetectParams[0])); |
397 | new DetectParams[0])); | ||
398 | } | 397 | } |
399 | else if (m_stateSource == StateSource.PrimCrossing) | 398 | else if (m_stateSource == StateSource.PrimCrossing || m_stateSource == StateSource.Teleporting) |
400 | { | 399 | { |
401 | // CHANGED_REGION | 400 | // CHANGED_REGION |
402 | PostEvent(new EventParams("changed", | 401 | PostEvent(new EventParams("changed", |
403 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, | 402 | new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, new DetectParams[0])); |
404 | new DetectParams[0])); | 403 | |
404 | // CHANGED_TELEPORT | ||
405 | if (m_stateSource == StateSource.Teleporting) | ||
406 | PostEvent(new EventParams("changed", | ||
407 | new Object[] { new LSL_Types.LSLInteger((int)Changed.TELEPORT) }, new DetectParams[0])); | ||
405 | } | 408 | } |
406 | } | 409 | } |
407 | else | 410 | else |
408 | { | 411 | { |
409 | Start(); | 412 | Start(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index dfc9aa3..1d55b95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
47 | { | 47 | { |
48 | 48 | ||
49 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; | 49 | private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; |
50 | private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; | ||
50 | private LSL_Api m_lslApi; | 51 | private LSL_Api m_lslApi; |
51 | 52 | ||
52 | [SetUp] | 53 | [SetUp] |
@@ -164,5 +165,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
164 | Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); | 165 | Assert.Greater(eulerCalc.z, eulerCheck.z - ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z lower bounds check fail"); |
165 | Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); | 166 | Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); |
166 | } | 167 | } |
168 | |||
169 | [Test] | ||
170 | // llVecNorm test. | ||
171 | public void TestllVecNorm() | ||
172 | { | ||
173 | // Check special case for normalizing zero vector. | ||
174 | CheckllVecNorm(new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); | ||
175 | // Check various vectors. | ||
176 | CheckllVecNorm(new LSL_Types.Vector3(10.0d, 25.0d, 0.0d), new LSL_Types.Vector3(0.371391d, 0.928477d, 0.0d)); | ||
177 | CheckllVecNorm(new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), new LSL_Types.Vector3(1.0d, 0.0d, 0.0d)); | ||
178 | CheckllVecNorm(new LSL_Types.Vector3(-90.0d, 55.0d, 2.0d), new LSL_Types.Vector3(-0.853128d, 0.521356d, 0.018958d)); | ||
179 | CheckllVecNorm(new LSL_Types.Vector3(255.0d, 255.0d, 255.0d), new LSL_Types.Vector3(0.577350d, 0.577350d, 0.577350d)); | ||
180 | } | ||
181 | |||
182 | public void CheckllVecNorm(LSL_Types.Vector3 vec, LSL_Types.Vector3 vecNormCheck) | ||
183 | { | ||
184 | // Call LSL function to normalize the vector. | ||
185 | LSL_Types.Vector3 vecNorm = m_lslApi.llVecNorm(vec); | ||
186 | // Check each vector component against expected result. | ||
187 | Assert.AreEqual(vecNorm.x, vecNormCheck.x, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on x component"); | ||
188 | Assert.AreEqual(vecNorm.y, vecNormCheck.y, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on y component"); | ||
189 | Assert.AreEqual(vecNorm.z, vecNormCheck.z, VECTOR_COMPONENT_ACCURACY, "TestllVecNorm vector check fail on z component"); | ||
190 | } | ||
167 | } | 191 | } |
168 | } | 192 | } |