diff options
author | Melanie | 2010-11-27 13:07:23 +0100 |
---|---|---|
committer | Melanie | 2010-11-27 13:07:23 +0100 |
commit | 2412b3cb4a7e8e33cc9e1475aa66ce14cab032b7 (patch) | |
tree | a37a3574ce60fec440c4ed8576725d3a06e22057 /OpenSim/Region | |
parent | Instrument TI Dictionary to finally find that pesky script-caused deadlock (diff) | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC-2412b3cb4a7e8e33cc9e1475aa66ce14cab032b7.zip opensim-SC-2412b3cb4a7e8e33cc9e1475aa66ce14cab032b7.tar.gz opensim-SC-2412b3cb4a7e8e33cc9e1475aa66ce14cab032b7.tar.bz2 opensim-SC-2412b3cb4a7e8e33cc9e1475aa66ce14cab032b7.tar.xz |
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
6 files changed, 94 insertions, 39 deletions
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/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 98a3b29..24c809b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -464,16 +464,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
464 | // if (actor != null) | 464 | // if (actor != null) |
465 | if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting! | 465 | if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting! |
466 | m_pos = actor.Position; | 466 | m_pos = actor.Position; |
467 | 467 | else | |
468 | // If we're sitting, we need to update our position | ||
469 | if (m_parentID != 0) | ||
470 | { | 468 | { |
471 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 469 | // Obtain the correct position of a seated avatar. |
472 | if (part != null) | 470 | // In addition to providing the correct position while |
473 | m_parentPosition = part.AbsolutePosition; | 471 | // the avatar is seated, this value will also |
472 | // be used as the location to unsit to. | ||
473 | // | ||
474 | // If m_parentID is not 0, assume we are a seated avatar | ||
475 | // and we should return the position based on the sittarget | ||
476 | // offset and rotation of the prim we are seated on. | ||
477 | // | ||
478 | // Generally, m_pos will contain the position of the avatar | ||
479 | // in the sim unless the avatar is on a sit target. While | ||
480 | // on a sit target, m_pos will contain the desired offset | ||
481 | // without the parent rotation applied. | ||
482 | if (m_parentID != 0) | ||
483 | { | ||
484 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | ||
485 | if (part != null) | ||
486 | { | ||
487 | return m_parentPosition + (m_pos * part.GetWorldRotation()); | ||
488 | } | ||
489 | else | ||
490 | { | ||
491 | return m_parentPosition + m_pos; | ||
492 | } | ||
493 | } | ||
474 | } | 494 | } |
475 | 495 | ||
476 | return m_parentPosition + m_pos; | 496 | return m_pos; |
477 | } | 497 | } |
478 | set | 498 | set |
479 | { | 499 | { |
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 | } |