From 1a2518d19bb447f4d3821cb71e32e712cc99d9c0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 5 Aug 2011 19:57:47 +0100 Subject: [PATCH 01/90] Instead of moving the file to its final place when FlotsamCache writes to disk, copy it instead. This is to eliminate IOException where two threads compete to cache the same file. --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index da39202318..0c700e3855 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -600,7 +600,13 @@ namespace Flotsam.RegionModules.AssetCache stream.Close(); // Now that it's written, rename it so that it can be found. - File.Move(tempname, filename); + // We're doing this as a file copy operation so that if two threads are competing to cache this asset, + // then both suceed instead of one failing when it tries to move the file to a final filename that + // already exists. + // This assumes that the file copy operation is atomic. Assuming this holds, then copying also works + // if another simulator is using the same cache directory. + File.Copy(tempname, filename, true); + File.Delete(tempname); if (m_LogLevel >= 2) m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); @@ -635,7 +641,6 @@ namespace Flotsam.RegionModules.AssetCache } #endif } - } } From 7d35bf819374a323fa737f8342a4239e0759ce8f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 5 Aug 2011 22:45:42 +0100 Subject: [PATCH 02/90] refactor: remove a sliver of unnecessary code --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 0c700e3855..7ef759ccb2 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -635,10 +635,7 @@ namespace Flotsam.RegionModules.AssetCache waitEvent.Set(); } #else - if (m_CurrentlyWriting.Contains(filename)) - { - m_CurrentlyWriting.Remove(filename); - } + m_CurrentlyWriting.Remove(filename); #endif } } From f18780d0e3a6e5130b1c1d86c71630801dc70c57 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 5 Aug 2011 22:56:53 +0100 Subject: [PATCH 03/90] Get "show region" command in GridService to show grid co-ordinates rather than meters co-ord. This makes it consistent with "show regions" Addresses http://opensimulator.org/mantis/view.php?id=5619 --- OpenSim/Services/GridService/GridService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index f663dd6f55..0a4372ab72 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -510,8 +510,9 @@ namespace OpenSim.Services.GridService OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]); MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} {5}\n\n", r.RegionName, r.RegionID, - String.Format("{0},{1}", r.posX, r.posY), r.Data["serverURI"], - r.Data["owner_uuid"].ToString(), flags.ToString())); + String.Format("{0},{1}", r.posX / Constants.RegionSize, r.posY / Constants.RegionSize), + r.Data["serverURI"], + r.Data["owner_uuid"], flags)); } return; } From ba89fc3aa1833c0fd6b5518d85ca966768597c6c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 5 Aug 2011 23:42:05 +0100 Subject: [PATCH 04/90] Add regression test for setting phantom status on a scene object. This is not yet complete. --- .../Framework/Scenes/SceneObjectGroup.cs | 22 ++++--- .../Framework/Scenes/SceneObjectPart.cs | 7 +-- .../Scenes/Tests/SceneObjectStatusTests.cs | 62 +++++++++++++++++++ 3 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 57baa997fd..3b6a4587e0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2253,7 +2253,7 @@ namespace OpenSim.Region.Framework.Scenes /// public virtual void DetachFromBackup() { - if (m_isBackedUp) + if (m_isBackedUp && Scene != null) m_scene.EventManager.OnBackup -= ProcessBackup; m_isBackedUp = false; @@ -2520,7 +2520,7 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart selectionPart = GetChildPart(localID); - if (SetTemporary) + if (SetTemporary && Scene != null) { DetachFromBackup(); // Remove from database and parcel prim count @@ -2532,15 +2532,19 @@ namespace OpenSim.Region.Framework.Scenes if (selectionPart != null) { SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) + + if (Scene != null) { - SceneObjectPart part = parts[i]; - if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || - part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || - part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) + for (int i = 0; i < parts.Length; i++) { - UsePhysics = false; // Reset physics - break; + SceneObjectPart part = parts[i]; + if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Y > m_scene.RegionInfo.PhysPrimMax || + part.Scale.Z > m_scene.RegionInfo.PhysPrimMax) + { + UsePhysics = false; // Reset physics + break; + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 90ad34e29d..e8a10709c3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -261,12 +261,9 @@ namespace OpenSim.Region.Framework.Scenes } protected SceneObjectPartInventory m_inventory; - public bool Undoing; - public bool IgnoreUndoUpdate = false; - private PrimFlags LocalFlags; @@ -4645,6 +4642,8 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); + +// m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); } public void UpdateRotation(Quaternion rot) @@ -4864,7 +4863,7 @@ namespace OpenSim.Region.Framework.Scenes // m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; //} - LocalFlags=(PrimFlags)objectflagupdate; + LocalFlags = (PrimFlags)objectflagupdate; if (m_parentGroup != null && m_parentGroup.RootPart == this) { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs new file mode 100644 index 0000000000..a26fe3363f --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Basic scene object status tests + /// + [TestFixture] + public class SceneObjectStatusTests + { + [Test] + public void TestSetPhantom() + { + TestHelper.InMethod(); + +// Scene scene = SceneSetupHelpers.SetupScene(); + SceneObjectGroup so = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); + SceneObjectPart rootPart = so.RootPart; + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + + so.RootPart.ScriptSetPhantomStatus(true); + + Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); + } + } +} \ No newline at end of file From c6c91e6599de6d4402ec0258da03cc975147da90 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 00:13:08 +0100 Subject: [PATCH 05/90] refactor: Fold most SOP.ScriptSet* methods back into script code. Simplify. --- .../Framework/Scenes/SceneObjectPart.cs | 25 ----------------- .../Scenes/Tests/SceneObjectStatusTests.cs | 4 +-- .../Shared/Api/Implementation/LSL_Api.cs | 27 +++++-------------- 3 files changed, 9 insertions(+), 47 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e8a10709c3..afc386ef1c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2967,22 +2967,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void ScriptSetPhantomStatus(bool Phantom) - { - if (m_parentGroup != null) - { - m_parentGroup.ScriptSetPhantomStatus(Phantom); - } - } - - public void ScriptSetTemporaryStatus(bool Temporary) - { - if (m_parentGroup != null) - { - m_parentGroup.ScriptSetTemporaryStatus(Temporary); - } - } - public void ScriptSetPhysicsStatus(bool UsePhysics) { if (m_parentGroup == null) @@ -2991,15 +2975,6 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); } - public void ScriptSetVolumeDetect(bool SetVD) - { - - if (m_parentGroup != null) - { - m_parentGroup.ScriptSetVolumeDetect(SetVD); - } - } - /// /// Set sculpt and mesh data, and tell the physics engine to process the change. /// diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index a26fe3363f..641c34eae2 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -53,9 +53,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectPart rootPart = so.RootPart; Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); - so.RootPart.ScriptSetPhantomStatus(true); + so.ScriptSetPhantomStatus(true); - Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); +// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 26969a550b..7c21ba9eb5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1204,10 +1204,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((status & ScriptBaseClass.STATUS_PHANTOM) == ScriptBaseClass.STATUS_PHANTOM) { - if (value != 0) - m_host.ScriptSetPhantomStatus(true); - else - m_host.ScriptSetPhantomStatus(false); + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetPhantomStatus(value != 0); } if ((status & ScriptBaseClass.STATUS_CAST_SHADOWS) == ScriptBaseClass.STATUS_CAST_SHADOWS) @@ -6446,9 +6444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.ParentGroup != null) { if (!m_host.ParentGroup.IsDeleted) - { - m_host.ParentGroup.RootPart.ScriptSetVolumeDetect(detect!=0); - } + m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); } } @@ -6456,7 +6452,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// This is a depecated function so this just replicates the result of /// invoking it in SL /// - public void llRemoteLoadScript(string target, string name, int running, int start_param) { m_host.AddScriptLPS(1); @@ -7254,14 +7249,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; string ph = rules.Data[idx++].ToString(); - bool phantom; - if (ph.Equals("1")) - phantom = true; - else - phantom = false; + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetPhantomStatus(ph.Equals("1")); - part.ScriptSetPhantomStatus(phantom); break; case (int)ScriptBaseClass.PRIM_PHYSICS: @@ -7282,14 +7273,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (remain < 1) return; string temp = rules.Data[idx++].ToString(); - bool tempOnRez; - if (temp.Equals("1")) - tempOnRez = true; - else - tempOnRez = false; + if (m_host.ParentGroup != null) + m_host.ParentGroup.ScriptSetTemporaryStatus(temp.Equals("1")); - part.ScriptSetTemporaryStatus(tempOnRez); break; case (int)ScriptBaseClass.PRIM_TEXGEN: From cba40de109a0ab54a58324f105cbba799da70e39 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 00:22:14 +0100 Subject: [PATCH 06/90] extend phantom flag regression test to toggle back off --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++ .../Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index afc386ef1c..7778ebcd8c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4514,6 +4514,9 @@ namespace OpenSim.Region.Framework.Scenes { RemFlag(PrimFlags.Phantom); + if (ParentGroup.Scene == null) + return; + PhysicsActor pa = PhysActor; if (pa == null) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 641c34eae2..c0fca5d4a4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -57,6 +57,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); + + so.ScriptSetPhantomStatus(false); + + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); } } } \ No newline at end of file From bda1a4be4567181df6c18ce6e059ca8982bc5fa1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 00:26:37 +0100 Subject: [PATCH 07/90] rename test SceneSetupHelpers -> SceneHelpers for consistency --- .../Asset/Tests/FlotsamAssetCacheTests.cs | 4 +-- .../Tests/AvatarFactoryModuleTests.cs | 6 ++-- .../Tests/InventoryArchiveTestCase.cs | 10 +++--- .../Archiver/Tests/InventoryArchiverTests.cs | 8 ++--- .../Inventory/Archiver/Tests/PathTests.cs | 22 ++++++------- .../Tests/InventoryAccessModuleTests.cs | 10 +++--- .../World/Archiver/Tests/ArchiverTests.cs | 8 ++--- .../World/Land/Tests/PrimCountModuleTests.cs | 32 +++++++++---------- .../World/Media/Moap/Tests/MoapTests.cs | 8 ++--- .../World/Serialiser/Tests/SerialiserTests.cs | 4 +-- .../Framework/Scenes/Tests/AttachmentTests.cs | 14 ++++---- .../Scenes/Tests/EntityManagerTests.cs | 2 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 2 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 14 ++++---- .../Scenes/Tests/SceneObjectDeRezTests.cs | 12 +++---- .../Scenes/Tests/SceneObjectLinkingTests.cs | 20 ++++++------ .../Scenes/Tests/SceneObjectResizeTests.cs | 8 ++--- .../Scenes/Tests/SceneObjectStatusTests.cs | 2 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 6 ++-- .../Scenes/Tests/ScenePresenceTests.cs | 20 ++++++------ .../Framework/Scenes/Tests/SceneTests.cs | 2 +- .../Scenes/Tests/StandaloneTeleportTests.cs | 10 +++--- .../Scenes/Tests/TaskInventoryTests.cs | 12 +++---- .../Scenes/Tests/UserInventoryTests.cs | 4 +-- .../Scenes/Tests/UuidGathererTests.cs | 2 +- .../XmlRpcGroups/Tests/GroupsModuleTests.cs | 4 +-- .../World/NPC/Tests/NPCModuleTests.cs | 12 +++---- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 4 +-- .../{SceneSetupHelpers.cs => SceneHelpers.cs} | 2 +- .../Common/Helpers/TaskInventoryHelpers.cs | 2 +- 30 files changed, 133 insertions(+), 133 deletions(-) rename OpenSim/Tests/Common/Helpers/{SceneSetupHelpers.cs => SceneHelpers.cs} (99%) diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 63b0c311f1..1662f193ea 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -65,8 +65,8 @@ namespace OpenSim.Region.CoreModules.Asset.Tests config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); m_cache = new FlotsamAssetCache(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, config, m_cache); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, config, m_cache); } [Test] diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 07de908498..c05f5ab0d7 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -50,9 +50,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory UUID userId = TestHelper.ParseTail(0x1); AvatarFactoryModule afm = new AvatarFactoryModule(); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, afm); - TestClient tc = SceneSetupHelpers.AddClient(scene, userId); + TestScene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, afm); + TestClient tc = SceneHelpers.AddClient(scene, userId); byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; for (byte i = 0; i < visualParams.Length; i++) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index aadeedb337..19ef571e7e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -100,8 +100,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // log4net.Config.XmlConfigurator.Configure(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); @@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Create scene object asset UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "Ray Gun Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); @@ -127,10 +127,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests scene.AddInventoryItem(item1); // Create coalesced objects asset - SceneObjectGroup cobj1 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); + SceneObjectGroup cobj1 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object1", 0x120); cobj1.AbsolutePosition = new Vector3(15, 30, 45); - SceneObjectGroup cobj2 = SceneSetupHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); + SceneObjectGroup cobj2 = SceneHelpers.CreateSceneObject(1, m_uaLL1.PrincipalID, "Object2", 0x140); cobj2.AbsolutePosition = new Vector3(25, 50, 75); CoalescedSceneObjects coa = new CoalescedSceneObjects(m_uaLL1.PrincipalID, cobj1, cobj2); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index ae3ab21b18..3616ae274f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -61,8 +61,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); m_archiverModule = new InventoryArchiverModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); } [Test] @@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Create asset UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); @@ -236,7 +236,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // Create asset UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, ownerId, "My Little Dog Object", 0x50); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 127d5f81f1..1d3e5d0abc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs @@ -62,8 +62,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule); // Create user string userFirstName = "Jock"; @@ -179,9 +179,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); + SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); @@ -222,8 +222,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); @@ -247,8 +247,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule); // Create user string userFirstName = "Jock"; @@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); Dictionary foldersCreated = new Dictionary(); @@ -393,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); string folder1ExistingName = "a"; @@ -444,7 +444,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); string folder1ExistingName = "a"; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 733ad25843..90b6481792 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -65,8 +65,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, config, m_iam); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, config, m_iam); // Create user string userFirstName = "Jock"; @@ -86,10 +86,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests // log4net.Config.XmlConfigurator.Configure(); // Create asset - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20); object1.AbsolutePosition = new Vector3(15, 30, 45); - SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); + SceneObjectGroup object2 = SceneHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40); object2.AbsolutePosition = new Vector3(25, 50, 75); CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2); @@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests // log4net.Config.XmlConfigurator.Configure(); // Create asset - SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); + SceneObjectGroup object1 = SceneHelpers.CreateSceneObject(1, m_userId, "My Little Dog Object", 0x40); UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 6ba3459747..645113fcea 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -68,8 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); } private void LoadCompleted(Guid requestId, string errorMessage) @@ -524,8 +524,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index a3aa38de94..fecbf67759 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -64,8 +64,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests { m_pcm = new PrimCountModule(); LandManagementModule lmm = new LandManagementModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm); int xParcelDivider = (int)Constants.RegionSize - 1; @@ -111,7 +111,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); Assert.That(pc.Owner, Is.EqualTo(3)); @@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pc.Simulator, Is.EqualTo(3)); // Add a second object and retest - SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); + SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sog2, false); Assert.That(pc.Owner, Is.EqualTo(5)); @@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); @@ -172,9 +172,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); - SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); + SceneObjectGroup sog2 = SceneHelpers.CreateSceneObject(2, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sog2, false); // Move the first scene object to the eastern strip parcel @@ -235,8 +235,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); + m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); + SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); sog.GroupID = m_groupId; m_scene.AddNewSceneObject(sog, false); @@ -291,11 +291,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1); + SceneObjectGroup sogToKeep = SceneHelpers.CreateSceneObject(1, m_userId, "a", 0x1); sogToKeep.GroupID = m_groupId; m_scene.AddNewSceneObject(sogToKeep, false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); + SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_userId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); Assert.That(pc.Owner, Is.EqualTo(0)); @@ -339,8 +339,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests IPrimCounts pc = m_lo.PrimCounts; - m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); + m_scene.AddNewSceneObject(SceneHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); + SceneObjectGroup sogToDelete = SceneHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); @@ -363,7 +363,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); IPrimCounts pc = m_lo.PrimCounts; - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); + SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); m_scene.AddNewSceneObject(sog, false); m_pcm.TaintPrimCount(); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index d5b708229a..fe09739757 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -53,8 +53,8 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests public void SetUp() { m_module = new MoapModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, m_module); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, m_module); } [Test] @@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); MediaEntry me = new MediaEntry(); m_module.SetMediaEntry(part, 1, me); @@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests string homeUrl = "opensimulator.org"; - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); MediaEntry me = new MediaEntry() { HomeURL = homeUrl }; m_module.SetMediaEntry(part, 1, me); diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 4f752ab82b..93e38f8eb8 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -236,8 +236,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests public void Init() { m_serialiserModule = new SerialiserModule(); - m_scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule); } [Test] diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index 5586c65192..85197db2b8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -64,14 +64,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); - SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); random = new Random(); @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; - SceneSetupHelpers.AddClient(scene, agent1); + SceneHelpers.AddClient(scene, agent1); } [Test] @@ -126,8 +126,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests presence2.AddAttachment(sog2); ISharedRegionModule serialiser = new SerialiserModule(); - SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); - SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index f69a4b430c..ebf595adc3 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { static public Random random; SceneObjectGroup found; - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); [Test] public void T010_AddObjects() diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 895f2bb4ec..b7ff1b18ec 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestDuplicateObject() { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); string part1Name = "part1"; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 260d1c0190..8b4771bcdd 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); string objName = "obj1"; UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); string obj1Name = "Alfred"; string obj2Name = "Betty"; @@ -112,8 +112,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + TestScene scene = SceneHelpers.SetupScene(); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene); scene.DeleteSceneObject(part.ParentGroup, false); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); @@ -131,15 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; sogd.Enabled = false; - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene); - IClientAPI client = SceneSetupHelpers.AddClient(scene, agentId); + IClientAPI client = SceneHelpers.AddClient(scene, agentId); scene.DeRezObjects(client, new System.Collections.Generic.List() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 1b8c100410..d201510e75 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -61,12 +61,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); - SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneSetupHelpers.AddClient(scene, userId); + SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneHelpers.AddClient(scene, userId); // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; @@ -100,12 +100,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); - SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneSetupHelpers.AddClient(scene, userId); + SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneHelpers.AddClient(scene, userId); // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index cb1d531ab9..b09144d005 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -54,10 +54,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); + Scene scene = SceneHelpers.SetupScene(); + SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp1 = part1.ParentGroup; - SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp2 = part2.ParentGroup; grp1.AbsolutePosition = new Vector3(10, 10, 10); @@ -136,14 +136,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); + Scene scene = SceneHelpers.SetupScene(); + SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp1 = part1.ParentGroup; - SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp2 = part2.ParentGroup; - SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp3 = part3.ParentGroup; - SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene); + SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp4 = part4.ParentGroup; grp1.AbsolutePosition = new Vector3(10, 10, 10); @@ -269,7 +269,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -308,7 +308,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index c4047ee0cf..8630476b36 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -52,8 +52,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectGroup g1 = SceneSetupHelpers.AddSceneObject(scene).ParentGroup; + Scene scene = SceneHelpers.SetupScene(); + SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; g1.GroupResize(new Vector3(2, 3, 4)); @@ -75,9 +75,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); - SceneObjectGroup g1 = SceneSetupHelpers.CreateSceneObject(2, UUID.Zero); + SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); g1.RootPart.Scale = new Vector3(2, 3, 4); g1.Parts[1].Scale = new Vector3(5, 6, 7); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index c0fca5d4a4..c2adb2a531 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); // Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectGroup so = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); SceneObjectPart rootPart = so.RootPart; Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index 8425d37109..e0ab1c8a42 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig startupConfig = configSource.AddConfig("Startup"); @@ -69,13 +69,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests groupsConfig.Set("Module", "GroupsModule"); groupsConfig.Set("DebugEnabled", true); - SceneSetupHelpers.SetupSceneModules( + SceneHelpers.SetupSceneModules( scene, configSource, new object[] { new PermissionsModule(), new GroupsModule(), new MockGroupsServicesConnector() }); - TestClient client = SceneSetupHelpers.AddClient(scene, userId); + TestClient client = SceneHelpers.AddClient(scene, userId); IGroupsModule groupsModule = scene.RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index a37b3386e1..8af1b38cef 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -66,16 +66,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); - scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); - SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); - SceneSetupHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); + SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); agent2 = UUID.Random(); @@ -203,16 +203,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); - TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); + TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); IConfigSource configSource = new IniConfigSource(); configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); EntityTransferModule etm = new EntityTransferModule(); - SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); + SceneHelpers.SetupSceneModules(myScene1, configSource, etm); - SceneSetupHelpers.AddClient(myScene1, agent1Id); + SceneHelpers.AddClient(myScene1, agent1Id); ScenePresence childPresence = myScene2.GetScenePresence(agent1); // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 13d93f943f..8ffb22e7c5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelper.InMethod(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); scene.Update(); Assert.That(scene.Frame, Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index 4074f5d098..a3848a727a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -116,16 +116,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); - SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); + Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); + SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); sceneB.RegisterRegionWithGrid(); - Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); - SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); + Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); + SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); sceneA.RegisterRegionWithGrid(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); - TestClient client = SceneSetupHelpers.AddClient(sceneA, agentId); + TestClient client = SceneHelpers.AddClient(sceneA, agentId); ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index f4e14d4424..a61832a6ba 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -58,9 +58,9 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); + SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; // Create an object embedded inside the first @@ -101,9 +101,9 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); + SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); @@ -128,9 +128,9 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); - SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID); + SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index abca792b8d..f6e28275e0 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); InventoryFolderBase folder1 diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 4da8df135f..b0ea4971c6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void Init() { // FIXME: We don't need a full scene here - it would be enough to set up the asset service. - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneHelpers.SetupScene(); m_assetService = scene.AssetService; m_uuidGatherer = new UuidGatherer(m_assetService); } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index ee52a39170..1e56a08db0 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -50,13 +50,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneSetupHelpers.SetupScene(); + TestScene scene = SceneHelpers.SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Groups"); config.Set("Enabled", true); config.Set("Module", "GroupsModule"); config.Set("DebugEnabled", true); - SceneSetupHelpers.SetupSceneModules( + SceneHelpers.SetupSceneModules( scene, configSource, new object[] { new MockGroupsServicesConnector() }); } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index c9dddbace8..c0053c9efe 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -57,9 +57,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.Configs["NPC"].Set("Enabled", "true"); AvatarFactoryModule afm = new AvatarFactoryModule(); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestScene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -94,9 +94,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.AddConfig("NPC"); config.Configs["NPC"].Set("Enabled", "true"); - TestScene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, config, new NPCModule()); - TestClient originalClient = SceneSetupHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestScene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 80b60a4976..3f37ec7fa3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -57,8 +57,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); + Scene scene = SceneHelpers.SetupScene(); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene); XEngine.XEngine engine = new XEngine.XEngine(); engine.Initialise(initConfigSource); diff --git a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs similarity index 99% rename from OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs rename to OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 70621d5b47..55b638b3bf 100644 --- a/OpenSim/Tests/Common/Helpers/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -54,7 +54,7 @@ namespace OpenSim.Tests.Common /// /// Helpers for setting up scenes. /// - public class SceneSetupHelpers + public class SceneHelpers { /// /// Set up a test scene diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index 5215c3404d..a8f0d59849 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs @@ -74,7 +74,7 @@ namespace OpenSim.Tests.Common /// public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id) { - SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero); + SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); scene.AssetService.Store(taskSceneObjectAsset); TaskInventoryItem taskSceneObjectItem From dad1d6df181151ae45fb998447b58d5589459627 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 00:31:03 +0100 Subject: [PATCH 08/90] rename TestHelper => TestHelpers for consistency --- OpenSim/Data/Tests/AssetTests.cs | 6 +-- OpenSim/Data/Tests/EstateTests.cs | 16 ++++---- OpenSim/Data/Tests/InventoryTests.cs | 26 ++++++------ OpenSim/Data/Tests/RegionTests.cs | 40 +++++++++---------- OpenSim/Framework/Tests/UtilTest.cs | 8 ++-- .../Asset/Tests/FlotsamAssetCacheTests.cs | 12 +++--- .../Tests/AvatarFactoryModuleTests.cs | 6 +-- .../Archiver/Tests/InventoryArchiverTests.cs | 14 +++---- .../Inventory/Archiver/Tests/PathTests.cs | 14 +++---- .../Tests/InventoryAccessModuleTests.cs | 4 +- .../World/Archiver/Tests/ArchiverTests.cs | 10 ++--- .../World/Land/Tests/PrimCountModuleTests.cs | 18 ++++----- .../World/Media/Moap/Tests/MoapTests.cs | 4 +- .../World/Serialiser/Tests/SerialiserTests.cs | 8 ++-- .../Framework/Scenes/Tests/AttachmentTests.cs | 8 ++-- .../Framework/Scenes/Tests/BorderTests.cs | 8 ++-- .../Scenes/Tests/EntityManagerTests.cs | 4 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 2 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 8 ++-- .../Scenes/Tests/SceneObjectDeRezTests.cs | 4 +- .../Scenes/Tests/SceneObjectLinkingTests.cs | 8 ++-- .../Scenes/Tests/SceneObjectResizeTests.cs | 4 +- .../Scenes/Tests/SceneObjectStatusTests.cs | 2 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 2 +- .../Scenes/Tests/ScenePresenceTests.cs | 14 +++---- .../Framework/Scenes/Tests/SceneTests.cs | 2 +- .../Scenes/Tests/StandaloneTeleportTests.cs | 2 +- .../Scenes/Tests/TaskInventoryTests.cs | 6 +-- .../Scenes/Tests/UserInventoryTests.cs | 4 +- .../Scenes/Tests/UuidGathererTests.cs | 4 +- .../XmlRpcGroups/Tests/GroupsModuleTests.cs | 2 +- .../World/NPC/Tests/NPCModuleTests.cs | 10 ++--- .../Common/{TestHelper.cs => TestHelpers.cs} | 2 +- 33 files changed, 141 insertions(+), 141 deletions(-) rename OpenSim/Tests/Common/{TestHelper.cs => TestHelpers.cs} (98%) diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs index b5ae2444eb..1174e2f302 100644 --- a/OpenSim/Data/Tests/AssetTests.cs +++ b/OpenSim/Data/Tests/AssetTests.cs @@ -106,7 +106,7 @@ namespace OpenSim.Data.Tests [Test] public void T001_LoadEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(m_db.ExistsAsset(uuid1), Is.False); Assert.That(m_db.ExistsAsset(uuid2), Is.False); @@ -116,7 +116,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_StoreReadVerifyAssets() { - TestHelper.InMethod(); + TestHelpers.InMethod(); AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); @@ -183,7 +183,7 @@ namespace OpenSim.Data.Tests [Test] public void T020_CheckForWeirdCreatorID() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // It is expected that eventually the CreatorID might be an arbitrary string (an URI) // rather than a valid UUID (?). This test is to make sure that the database layer does not diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs index 8d332daa2f..3e47bcf36f 100644 --- a/OpenSim/Data/Tests/EstateTests.cs +++ b/OpenSim/Data/Tests/EstateTests.cs @@ -107,7 +107,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() { - TestHelper.InMethod(); + TestHelpers.InMethod(); EstateSettingsSimpleStorage( REGION_ID, @@ -140,7 +140,7 @@ namespace OpenSim.Data.Tests [Test] public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() { - TestHelper.InMethod(); + TestHelpers.InMethod(); EstateSettingsSimpleStorage( REGION_ID, @@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() { - TestHelper.InMethod(); + TestHelpers.InMethod(); EstateSettingsSimpleStorage( REGION_ID, @@ -206,7 +206,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_EstateSettingsRandomStorage() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -227,7 +227,7 @@ namespace OpenSim.Data.Tests [Test] public void T020_EstateSettingsManagerList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests [Test] public void T021_EstateSettingsUserList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -269,7 +269,7 @@ namespace OpenSim.Data.Tests [Test] public void T022_EstateSettingsGroupList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); @@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests [Test] public void T022_EstateSettingsBanList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Letting estate store generate rows to database for us EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index cf3bac1cf9..5b6b61b2d2 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs @@ -114,7 +114,7 @@ namespace OpenSim.Data.Tests [Test] public void T001_LoadEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.getInventoryFolder(zero), Is.Null); Assert.That(db.getInventoryFolder(folder1), Is.Null); @@ -134,7 +134,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_FolderNonParent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); // the folder will go in @@ -146,7 +146,7 @@ namespace OpenSim.Data.Tests [Test] public void T011_FolderCreate() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); // TODO: this is probably wrong behavior, but is what we have @@ -171,7 +171,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_FolderList() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); db.addInventoryFolder(f2); @@ -187,7 +187,7 @@ namespace OpenSim.Data.Tests [Test] public void T013_FolderHierarchy() { - TestHelper.InMethod(); + TestHelpers.InMethod(); int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); @@ -202,7 +202,7 @@ namespace OpenSim.Data.Tests [Test] public void T014_MoveFolder() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryFolderBase f2 = db.getInventoryFolder(folder2); f2.ParentID = folder3; @@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests [Test] public void T015_FolderHierarchy() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); @@ -231,7 +231,7 @@ namespace OpenSim.Data.Tests [Test] public void T100_NoItems() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); @@ -245,7 +245,7 @@ namespace OpenSim.Data.Tests [Test] public void T101_CreatItems() { - TestHelper.InMethod(); + TestHelpers.InMethod(); db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); @@ -256,7 +256,7 @@ namespace OpenSim.Data.Tests [Test] public void T102_CompareItems() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryItemBase i1 = db.getInventoryItem(item1); InventoryItemBase i2 = db.getInventoryItem(item2); @@ -275,7 +275,7 @@ namespace OpenSim.Data.Tests [Test] public void T103_UpdateItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // TODO: probably shouldn't have the ability to have an // owner of an item in a folder not owned by the user @@ -295,7 +295,7 @@ namespace OpenSim.Data.Tests [Test] public void T104_RandomUpdateItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); PropertyScrambler folderScrambler = new PropertyScrambler() @@ -354,7 +354,7 @@ namespace OpenSim.Data.Tests [Test] public void T999_StillNull() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // After all tests are run, these should still return no results Assert.That(db.getInventoryFolder(zero), Is.Null); diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 44cf1ab3ef..2b8fa5941e 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -151,7 +151,7 @@ namespace OpenSim.Data.Tests [Test] public void T001_LoadEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List objs = db.LoadObjects(region1); List objs3 = db.LoadObjects(region3); @@ -169,7 +169,7 @@ namespace OpenSim.Data.Tests [Test] public void T010_StoreSimpleObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); SceneObjectGroup sog = NewSOG("object1", prim1, region1); SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); @@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests [Test] public void T011_ObjectNames() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List objs = db.LoadObjects(region1); foreach (SceneObjectGroup sog in objs) @@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests [Test] public void T012_SceneParts() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID tmp0 = UUID.Random(); UUID tmp1 = UUID.Random(); @@ -253,7 +253,7 @@ namespace OpenSim.Data.Tests [Test] public void T013_DatabasePersistency() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored @@ -430,7 +430,7 @@ namespace OpenSim.Data.Tests [Test] public void T014_UpdateObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string text1 = "object1 text"; SceneObjectGroup sog = FindSOG("object1", region1); @@ -540,7 +540,7 @@ namespace OpenSim.Data.Tests [Test] public void T015_LargeSceneObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID id = UUID.Random(); Dictionary mydic = new Dictionary(); @@ -587,7 +587,7 @@ namespace OpenSim.Data.Tests //[Test] public void T016_RandomSogWithSceneParts() { - TestHelper.InMethod(); + TestHelpers.InMethod(); PropertyScrambler scrambler = new PropertyScrambler() @@ -663,7 +663,7 @@ namespace OpenSim.Data.Tests [Test] public void T020_PrimInventoryEmpty() { - TestHelper.InMethod(); + TestHelpers.InMethod(); SceneObjectGroup sog = GetMySOG("object1"); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); @@ -687,7 +687,7 @@ namespace OpenSim.Data.Tests [Test] public void T021_PrimInventoryBasic() { - TestHelper.InMethod(); + TestHelpers.InMethod(); SceneObjectGroup sog = GetMySOG("object1"); InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); @@ -727,7 +727,7 @@ namespace OpenSim.Data.Tests [Test] public void T025_PrimInventoryPersistency() { - TestHelper.InMethod(); + TestHelpers.InMethod(); InventoryItemBase i = new InventoryItemBase(); UUID id = UUID.Random(); @@ -800,7 +800,7 @@ namespace OpenSim.Data.Tests [ExpectedException(typeof(ArgumentException))] public void T026_PrimInventoryMany() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID i1,i2,i3,i4; i1 = UUID.Random(); @@ -832,7 +832,7 @@ namespace OpenSim.Data.Tests [Test] public void T052_RemoveObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); db.RemoveObject(prim1, region1); SceneObjectGroup sog = FindSOG("object1", region1); @@ -842,7 +842,7 @@ namespace OpenSim.Data.Tests [Test] public void T100_DefaultRegionInfo() { - TestHelper.InMethod(); + TestHelpers.InMethod(); RegionSettings r1 = db.LoadRegionSettings(region1); Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); @@ -854,7 +854,7 @@ namespace OpenSim.Data.Tests [Test] public void T101_UpdateRegionInfo() { - TestHelper.InMethod(); + TestHelpers.InMethod(); int agentlimit = random.Next(); double objectbonus = random.Next(); @@ -960,7 +960,7 @@ namespace OpenSim.Data.Tests [Test] public void T300_NoTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.LoadTerrain(zero), Is.Null); Assert.That(db.LoadTerrain(region1), Is.Null); @@ -971,7 +971,7 @@ namespace OpenSim.Data.Tests [Test] public void T301_CreateTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); double[,] t1 = GenTerrain(height1); db.StoreTerrain(t1, region1); @@ -985,7 +985,7 @@ namespace OpenSim.Data.Tests [Test] public void T302_FetchTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); @@ -997,7 +997,7 @@ namespace OpenSim.Data.Tests [Test] public void T303_UpdateTerrain() { - TestHelper.InMethod(); + TestHelpers.InMethod(); double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); @@ -1011,7 +1011,7 @@ namespace OpenSim.Data.Tests [Test] public void T400_EmptyLand() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs index 5eac411944..c5a20e7b0e 100644 --- a/OpenSim/Framework/Tests/UtilTest.cs +++ b/OpenSim/Framework/Tests/UtilTest.cs @@ -61,7 +61,7 @@ namespace OpenSim.Framework.Tests "Magnitude of vector was incorrect."); TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; - bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); @@ -94,12 +94,12 @@ namespace OpenSim.Framework.Tests "Magnitude of vector was incorrect."); TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; - bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); d = delegate() { Util.GetNormalizedVector(v2); }; - causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); } @@ -122,7 +122,7 @@ namespace OpenSim.Framework.Tests "Magnitude of vector was incorrect."); TestDelegate d = delegate() { Util.GetNormalizedVector(v1); }; - bool causesArgumentException = TestHelper.AssertThisDelegateCausesArgumentException(d); + bool causesArgumentException = TestHelpers.AssertThisDelegateCausesArgumentException(d); Assert.That(causesArgumentException, Is.True, "Getting magnitude of null vector did not cause argument exception."); diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 1662f193ea..2ff1920c2a 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -72,11 +72,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests [Test] public void TestCacheAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); AssetBase asset = AssetHelpers.CreateAsset(); - asset.ID = TestHelper.ParseTail(0x1).ToString(); + asset.ID = TestHelpers.ParseTail(0x1).ToString(); // Check we don't get anything before the asset is put in the cache AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); @@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests [Test] public void TestExpireAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); AssetBase asset = AssetHelpers.CreateAsset(); - asset.ID = TestHelper.ParseTail(0x2).ToString(); + asset.ID = TestHelpers.ParseTail(0x2).ToString(); m_cache.Store(asset); @@ -110,11 +110,11 @@ namespace OpenSim.Region.CoreModules.Asset.Tests [Test] public void TestClearCache() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); AssetBase asset = AssetHelpers.CreateAsset(); - asset.ID = TestHelper.ParseTail(0x2).ToString(); + asset.ID = TestHelpers.ParseTail(0x2).ToString(); m_cache.Store(asset); diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index c05f5ab0d7..4e83fa7799 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -44,10 +44,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory [Test] public void TestSetAppearance() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - UUID userId = TestHelper.ParseTail(0x1); + UUID userId = TestHelpers.ParseTail(0x1); AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); @@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory for (byte i = 0; i < visualParams.Length; i++) visualParams[i] = i; - afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelper.ParseTail(0x10)), visualParams); + afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); ScenePresence sp = scene.GetScenePresence(userId); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 3616ae274f..e409c8e051 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadCoalesecedItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestOrder() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes); @@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestSaveItemToIar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create user @@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestSaveItemToIarNoAssets() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create user @@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarCreatorAccountPresent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); @@ -357,7 +357,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1SameNameCreator() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarV0_1AbsentCreator() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 1d3e5d0abc..417c20c097 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestSavePathToIarV0_1() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); @@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarToInventoryPaths() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); @@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarPathStartsWithSlash() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SerialiserModule serialiserModule = new SerialiserModule(); @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestLoadIarPathWithEscapedChars() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); string itemName = "You & you are a mean/man/"; @@ -323,7 +323,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestNewIarPath() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestPartExistingIarPath() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -441,7 +441,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests [Test] public void TestMergeIarPath() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index 90b6481792..e74310c849 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests [Test] public void TestRezCoalescedObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create asset @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests [Test] public void TestRezObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); // Create asset diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 645113fcea..b185d9b7e6 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestSaveOar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectPart part1 = CreateSceneObjectPart1(); @@ -217,7 +217,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestSaveOarNoAssets() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectPart part1 = CreateSceneObjectPart1(); @@ -300,7 +300,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestLoadOar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); @@ -409,7 +409,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests [Test] public void TestLoadOarRegionSettings() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); @@ -505,7 +505,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests //[Test] public void TestMergeOar() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index fecbf67759..e553ffa571 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -106,7 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestAddOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestCopyOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -169,7 +169,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestMoveOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); @@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestRemoveOwnerObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestAddGroupObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); m_lo.DeedToGroup(m_groupId); @@ -284,7 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestRemoveGroupObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); m_lo.DeedToGroup(m_groupId); @@ -313,7 +313,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestAddOthersObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestRemoveOthersObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IPrimCounts pc = m_lo.PrimCounts; @@ -360,7 +360,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [Test] public void TestTaint() { - TestHelper.InMethod(); + TestHelpers.InMethod(); IPrimCounts pc = m_lo.PrimCounts; SceneObjectGroup sog = SceneHelpers.CreateSceneObject(3, m_userId, "a", 0x01); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index fe09739757..4326606d5a 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests [Test] public void TestClearMediaUrl() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); @@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests [Test] public void TestSetMediaUrl() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string homeUrl = "opensimulator.org"; diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index 93e38f8eb8..d5b585a716 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestDeserializeXml() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(xml); @@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestSerializeXml() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string rpName = "My Little Donkey"; @@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestDeserializeXml2() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); SceneObjectGroup so = m_serialiserModule.DeserializeGroupFromXml2(xml2); @@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests [Test] public void TestSerializeXml2() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); string rpName = "My Little Pony"; diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index 85197db2b8..fb28397f1e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [TestFixtureSetUp] public void Init() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); @@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T030_TestAddAttachments() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); @@ -104,7 +104,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T031_RemoveAttachments() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); presence.RemoveAttachment(sog1); @@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests //[Test] public void T032_CrossAttachments() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); ScenePresence presence2 = scene2.GetScenePresence(agent1); diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs index 3a0dd00ad5..ab6311b520 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCross() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); @@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCrossSquare512() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); @@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCrossRectangle512x256() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); @@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCrossOdd512x512w256hole() { - TestHelper.InMethod(); + TestHelpers.InMethod(); List testborders = new List(); // 512____ diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index ebf595adc3..a5d2b2304a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T010_AddObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); random = new Random(); SceneObjectGroup found; @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T011_ThreadAddRemoveTest() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // This test adds and removes with mutiple threads, attempting to break the // uuid and localid dictionary coherence. diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index b7ff1b18ec..9a60e50eb9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDuplicateObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 8b4771bcdd..ff55680c6c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestAddSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); @@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// public void TestAddExistingSceneObjectUuid() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); @@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeleteSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); TestScene scene = SceneHelpers.SetupScene(); SceneObjectPart part = SceneHelpers.AddSceneObject(scene); @@ -126,7 +126,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeleteSceneObjectAsync() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index d201510e75..c8a9ca3b15 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeRezSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); @@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDeRezSceneObjectNotOwner() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index b09144d005..2912a46d7d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestLinkDelink2SceneObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); bool debugtest = false; @@ -132,7 +132,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestLinkDelink2groups4SceneObjects() { - TestHelper.InMethod(); + TestHelpers.InMethod(); bool debugtest = false; @@ -266,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestNewSceneObjectLinkPersistence() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); TestScene scene = SceneHelpers.SetupScene(); @@ -305,7 +305,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestDelinkPersistence() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); TestScene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 8630476b36..b49c6e7a98 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestResizeSceneObject() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -72,7 +72,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestResizeSceneObjectPart() { - TestHelper.InMethod(); + TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index c2adb2a531..2a342d50c8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestSetPhantom() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // Scene scene = SceneSetupHelpers.SetupScene(); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index e0ab1c8a42..e604885546 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestShareWithGroup() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 8af1b38cef..9b5f52f360 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [TestFixtureSetUp] public void Init() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); @@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T010_TestAddRootAgent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string firstName = "testfirstname"; @@ -135,7 +135,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T011_TestRemoveRootAgent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene.RemoveClient(agent1); @@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T012_TestAddNeighbourRegion() { - TestHelper.InMethod(); + TestHelpers.InMethod(); string reason; @@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void T013_TestRemoveNeighbourRegion() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); presence.RemoveNeighbourRegion(region3); @@ -198,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestChildAgentEstablished() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); @@ -230,7 +230,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests //[Test] public void T021_TestCrossToNewRegion() { - TestHelper.InMethod(); + TestHelpers.InMethod(); scene.RegisterRegionWithGrid(); scene2.RegisterRegionWithGrid(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 8ffb22e7c5..8b8aea58e4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestUpdateScene() { - TestHelper.InMethod(); + TestHelpers.InMethod(); Scene scene = SceneHelpers.SetupScene(); scene.Update(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index a3848a727a..fb5a19fb01 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests //[Test, LongRunning] public void TestSimpleNotNeighboursTeleport() { - TestHelper.InMethod(); + TestHelpers.InMethod(); ThreadRunResults results = new ThreadRunResults(); results.Result = false; results.Message = "Test did not run"; diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index a61832a6ba..1abef8d846 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestRezObjectFromInventoryItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -98,7 +98,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestMoveTaskInventoryItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestMoveTaskInventoryItemNoParent() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index f6e28275e0..50b1a480db 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestGiveInventoryItem() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); @@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Tests [Test] public void TestGiveInventoryFolder() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index b0ea4971c6..24de56e08a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCorruptAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); AssetBase corruptAsset @@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestMissingAsset() { - TestHelper.InMethod(); + TestHelpers.InMethod(); UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); IDictionary foundAssetUuids = new Dictionary(); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index 1e56a08db0..d2f63272bd 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests [Test] public void TestBasic() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); TestScene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index c0053c9efe..28fa8a20e4 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests [Test] public void TestCreate() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IConfigSource config = new IniConfigSource(); @@ -59,11 +59,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance - UUID originalFace8TextureId = TestHelper.ParseTail(0x10); + UUID originalFace8TextureId = TestHelpers.ParseTail(0x10); Primitive.TextureEntry originalTe = new Primitive.TextureEntry(UUID.Zero); Primitive.TextureEntryFace originalTef = originalTe.CreateFace(8); originalTef.TextureID = originalFace8TextureId; @@ -86,7 +86,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests [Test] public void TestMove() { - TestHelper.InMethod(); + TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); IConfigSource config = new IniConfigSource(); @@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelper.ParseTail(0x1)); + TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); diff --git a/OpenSim/Tests/Common/TestHelper.cs b/OpenSim/Tests/Common/TestHelpers.cs similarity index 98% rename from OpenSim/Tests/Common/TestHelper.cs rename to OpenSim/Tests/Common/TestHelpers.cs index 86bd10766b..ced06de1ad 100644 --- a/OpenSim/Tests/Common/TestHelper.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs @@ -32,7 +32,7 @@ using OpenMetaverse; namespace OpenSim.Tests.Common { - public class TestHelper + public class TestHelpers { public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) { From 76f46b25454c0c9376130a59cc1b766c0d105dd0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 01:15:49 +0100 Subject: [PATCH 09/90] Do proper locking of m_localScenes list in SceneManager --- .../Region/Framework/Scenes/SceneManager.cs | 233 +++++++++++------- .../HGInstantMessageService.cs | 7 +- 2 files changed, 143 insertions(+), 97 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 86ba2aa536..069367db8f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -47,12 +47,12 @@ namespace OpenSim.Region.Framework.Scenes public event RestartSim OnRestartSim; - private readonly List m_localScenes; + private readonly List m_localScenes = new List(); private Scene m_currentScene = null; public List Scenes { - get { return m_localScenes; } + get { return new List(m_localScenes); } } public Scene CurrentScene @@ -66,13 +66,12 @@ namespace OpenSim.Region.Framework.Scenes { if (m_currentScene == null) { - if (m_localScenes.Count > 0) + lock (m_localScenes) { - return m_localScenes[0]; - } - else - { - return null; + if (m_localScenes.Count > 0) + return m_localScenes[0]; + else + return null; } } else @@ -82,26 +81,25 @@ namespace OpenSim.Region.Framework.Scenes } } - public SceneManager() - { - m_localScenes = new List(); - } - public void Close() { // collect known shared modules in sharedModules Dictionary sharedModules = new Dictionary(); - for (int i = 0; i < m_localScenes.Count; i++) + + lock (m_localScenes) { - // extract known shared modules from scene - foreach (string k in m_localScenes[i].Modules.Keys) + for (int i = 0; i < m_localScenes.Count; i++) { - if (m_localScenes[i].Modules[k].IsSharedModule && - !sharedModules.ContainsKey(k)) - sharedModules[k] = m_localScenes[i].Modules[k]; + // extract known shared modules from scene + foreach (string k in m_localScenes[i].Modules.Keys) + { + if (m_localScenes[i].Modules[k].IsSharedModule && + !sharedModules.ContainsKey(k)) + sharedModules[k] = m_localScenes[i].Modules[k]; + } + // close scene/region + m_localScenes[i].Close(); } - // close scene/region - m_localScenes[i].Close(); } // all regions/scenes are now closed, we can now safely @@ -114,13 +112,16 @@ namespace OpenSim.Region.Framework.Scenes public void Close(Scene cscene) { - if (m_localScenes.Contains(cscene)) + lock (m_localScenes) { - for (int i = 0; i < m_localScenes.Count; i++) + if (m_localScenes.Contains(cscene)) { - if (m_localScenes[i].Equals(cscene)) + for (int i = 0; i < m_localScenes.Count; i++) { - m_localScenes[i].Close(); + if (m_localScenes[i].Equals(cscene)) + { + m_localScenes[i].Close(); + } } } } @@ -129,27 +130,33 @@ namespace OpenSim.Region.Framework.Scenes public void Add(Scene scene) { scene.OnRestart += HandleRestart; - m_localScenes.Add(scene); + + lock (m_localScenes) + m_localScenes.Add(scene); } public void HandleRestart(RegionInfo rdata) { m_log.Error("[SCENEMANAGER]: Got Restart message for region:" + rdata.RegionName + " Sending up to main"); int RegionSceneElement = -1; - for (int i = 0; i < m_localScenes.Count; i++) + + lock (m_localScenes) { - if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) + for (int i = 0; i < m_localScenes.Count; i++) { - RegionSceneElement = i; + if (rdata.RegionName == m_localScenes[i].RegionInfo.RegionName) + { + RegionSceneElement = i; + } } - } - // Now we make sure the region is no longer known about by the SceneManager - // Prevents duplicates. + // Now we make sure the region is no longer known about by the SceneManager + // Prevents duplicates. - if (RegionSceneElement >= 0) - { - m_localScenes.RemoveAt(RegionSceneElement); + if (RegionSceneElement >= 0) + { + m_localScenes.RemoveAt(RegionSceneElement); + } } // Send signal to main that we're restarting this sim. @@ -160,28 +167,32 @@ namespace OpenSim.Region.Framework.Scenes { RegionInfo Result = null; - for (int i = 0; i < m_localScenes.Count; i++) - { - if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle) - { - // Inform other regions to tell their avatar about me - Result = m_localScenes[i].RegionInfo; - } - } - if (Result != null) + lock (m_localScenes) { for (int i = 0; i < m_localScenes.Count; i++) { - if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) + if (m_localScenes[i].RegionInfo.RegionHandle == regionHandle) { // Inform other regions to tell their avatar about me - //m_localScenes[i].OtherRegionUp(Result); + Result = m_localScenes[i].RegionInfo; } } - } - else - { - m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); + + if (Result != null) + { + for (int i = 0; i < m_localScenes.Count; i++) + { + if (m_localScenes[i].RegionInfo.RegionHandle != regionHandle) + { + // Inform other regions to tell their avatar about me + //m_localScenes[i].OtherRegionUp(Result); + } + } + } + else + { + m_log.Error("[REGION]: Unable to notify Other regions of this Region coming up"); + } } } @@ -285,7 +296,8 @@ namespace OpenSim.Region.Framework.Scenes { if (m_currentScene == null) { - m_localScenes.ForEach(func); + lock (m_localScenes) + m_localScenes.ForEach(func); } else { @@ -314,12 +326,15 @@ namespace OpenSim.Region.Framework.Scenes } else { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) + foreach (Scene scene in m_localScenes) { - m_currentScene = scene; - return true; + if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) + { + m_currentScene = scene; + return true; + } } } @@ -331,12 +346,15 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Debug("Searching for Region: '" + regionID + "'"); - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.RegionInfo.RegionID == regionID) + foreach (Scene scene in m_localScenes) { - m_currentScene = scene; - return true; + if (scene.RegionInfo.RegionID == regionID) + { + m_currentScene = scene; + return true; + } } } @@ -345,26 +363,33 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScene(string regionName, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if (String.Compare(mscene.RegionInfo.RegionName, regionName, true) == 0) + { + scene = mscene; + return true; + } } } + scene = null; return false; } public bool TryGetScene(UUID regionID, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if (mscene.RegionInfo.RegionID == regionID) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if (mscene.RegionInfo.RegionID == regionID) + { + scene = mscene; + return true; + } } } @@ -374,13 +399,16 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScene(uint locX, uint locY, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if (mscene.RegionInfo.RegionLocX == locX && - mscene.RegionInfo.RegionLocY == locY) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if (mscene.RegionInfo.RegionLocX == locX && + mscene.RegionInfo.RegionLocY == locY) + { + scene = mscene; + return true; + } } } @@ -390,13 +418,16 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScene(IPEndPoint ipEndPoint, out Scene scene) { - foreach (Scene mscene in m_localScenes) + lock (m_localScenes) { - if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && - (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)) + foreach (Scene mscene in m_localScenes) { - scene = mscene; - return true; + if ((mscene.RegionInfo.InternalEndPoint.Equals(ipEndPoint.Address)) && + (mscene.RegionInfo.InternalEndPoint.Port == ipEndPoint.Port)) + { + scene = mscene; + return true; + } } } @@ -465,11 +496,14 @@ namespace OpenSim.Region.Framework.Scenes public RegionInfo GetRegionInfo(UUID regionID) { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.RegionInfo.RegionID == regionID) + foreach (Scene scene in m_localScenes) { - return scene.RegionInfo; + if (scene.RegionInfo.RegionID == regionID) + { + return scene.RegionInfo; + } } } @@ -488,11 +522,14 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.TryGetScenePresence(avatarId, out avatar)) + foreach (Scene scene in m_localScenes) { - return true; + if (scene.TryGetScenePresence(avatarId, out avatar)) + { + return true; + } } } @@ -503,12 +540,16 @@ namespace OpenSim.Region.Framework.Scenes public bool TryGetAvatarsScene(UUID avatarId, out Scene scene) { ScenePresence avatar = null; - foreach (Scene mScene in m_localScenes) + + lock (m_localScenes) { - if (mScene.TryGetScenePresence(avatarId, out avatar)) + foreach (Scene mScene in m_localScenes) { - scene = mScene; - return true; + if (mScene.TryGetScenePresence(avatarId, out avatar)) + { + scene = mScene; + return true; + } } } @@ -518,17 +559,22 @@ namespace OpenSim.Region.Framework.Scenes public void CloseScene(Scene scene) { - m_localScenes.Remove(scene); + lock (m_localScenes) + m_localScenes.Remove(scene); + scene.Close(); } public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) { - foreach (Scene scene in m_localScenes) + lock (m_localScenes) { - if (scene.TryGetAvatarByName(avatarName, out avatar)) + foreach (Scene scene in m_localScenes) { - return true; + if (scene.TryGetAvatarByName(avatarName, out avatar)) + { + return true; + } } } @@ -538,7 +584,8 @@ namespace OpenSim.Region.Framework.Scenes public void ForEachScene(Action action) { - m_localScenes.ForEach(action); + lock (m_localScenes) + m_localScenes.ForEach(action); } } -} +} \ No newline at end of file diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index bb31fc951e..0d59636b72 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -95,7 +95,6 @@ namespace OpenSim.Services.HypergridService m_InGatekeeper = serverConfig.GetBoolean("InGatekeeper", false); m_log.DebugFormat("[HG IM SERVICE]: Starting... InRobust? {0}", m_InGatekeeper); - if (gridService == string.Empty || presenceService == string.Empty) throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function.")); @@ -120,7 +119,7 @@ namespace OpenSim.Services.HypergridService public bool IncomingInstantMessage(GridInstantMessage im) { - m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); +// m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); UUID toAgentID = new UUID(im.toAgentID); bool success = false; @@ -142,7 +141,7 @@ namespace OpenSim.Services.HypergridService public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner) { - m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); +// m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); if (url != string.Empty) return TrySendInstantMessage(im, url, true, foreigner); else @@ -333,7 +332,7 @@ namespace OpenSim.Services.HypergridService if (m_RestURL != string.Empty && (im.offline != 0) && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) { - m_log.DebugFormat("[HG IM SERVICE]: Message saved"); +// m_log.DebugFormat("[HG IM SERVICE]: Message saved"); return SynchronousRestObjectRequester.MakeRequest( "POST", m_RestURL + "/SaveMessage/", im); From 2b26d2f1a54686ed6a03efc26bf75002f80d42ee Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 01:35:01 +0100 Subject: [PATCH 10/90] prevent "create region" console command from being able to create a region with the same id as one that already exists. Addresses http://opensimulator.org/mantis/view.php?id=5617 --- OpenSim/Region/Application/OpenSim.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 259d7536e4..fe1525b28f 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -549,6 +549,7 @@ namespace OpenSim { string regionName = string.Empty; string regionFile = string.Empty; + if (cmd.Length == 3) { regionFile = cmd[2]; @@ -558,14 +559,17 @@ namespace OpenSim regionName = cmd[2]; regionFile = cmd[3]; } + string extension = Path.GetExtension(regionFile).ToLower(); bool isXml = extension.Equals(".xml"); bool isIni = extension.Equals(".ini"); + if (!isXml && !isIni) { MainConsole.Instance.Output("Usage: create region [\"region name\"] "); return; } + if (!Path.IsPathRooted(regionFile)) { string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); @@ -582,8 +586,18 @@ namespace OpenSim regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); } - IScene scene; + Scene existingScene; + if (SceneManager.TryGetScene(regInfo.RegionID, out existingScene)) + { + MainConsole.Instance.OutputFormat( + "ERROR: Cannot create region {0} with ID {1}, this ID is already assigned to region {2}", + regInfo.RegionName, regInfo.RegionID, existingScene.RegionInfo.RegionName); + + return; + } + PopulateRegionEstateInfo(regInfo); + IScene scene; CreateRegion(regInfo, true, out scene); regInfo.EstateSettings.Save(); } From 83ba35a26bbbc844f4fd0f4964f3bc6155561e31 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 02:01:25 +0100 Subject: [PATCH 11/90] rip out sog generation methods in ScenePresenceAgentTests and use SceneHelpers instead Not that it matters, since these tests are pretty bogus anyway. Also, renames some test classes for consistency. --- ...nceTests.cs => ScenePresenceAgentTests.cs} | 44 +++---------------- ...Tests.cs => ScenePresenceTeleportTests.cs} | 2 +- 2 files changed, 8 insertions(+), 38 deletions(-) rename OpenSim/Region/Framework/Scenes/Tests/{ScenePresenceTests.cs => ScenePresenceAgentTests.cs} (90%) rename OpenSim/Region/Framework/Scenes/Tests/{StandaloneTeleportTests.cs => ScenePresenceTeleportTests.cs} (99%) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs similarity index 90% rename from OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs rename to OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 9b5f52f360..04f58174ba 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// Scene presence tests /// [TestFixture] - public class ScenePresenceTests + public class ScenePresenceAgentTests { public Scene scene, scene2, scene3; public UUID agent1, agent2, agent3; @@ -81,11 +81,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests agent2 = UUID.Random(); agent3 = UUID.Random(); random = new Random(); - sog1 = NewSOG(UUID.Random(), scene, agent1); - sog2 = NewSOG(UUID.Random(), scene, agent1); - sog3 = NewSOG(UUID.Random(), scene, agent1); + sog1 = SceneHelpers.CreateSceneObject(1, agent1); + scene.AddSceneObject(sog1); + sog2 = SceneHelpers.CreateSceneObject(1, agent1); + scene.AddSceneObject(sog2); + sog3 = SceneHelpers.CreateSceneObject(1, agent1); + scene.AddSceneObject(sog3); - //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; region3 = scene3.RegionInfo.RegionHandle; @@ -349,37 +351,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests capsPath = capsPath.Remove(capsPath.Length - 4, 4); return capsPath; } - - private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) - { - SceneObjectPart sop = new SceneObjectPart(); - sop.Name = RandomName(); - sop.Description = RandomName(); - sop.Text = RandomName(); - sop.SitName = RandomName(); - sop.TouchName = RandomName(); - sop.UUID = uuid; - sop.Shape = PrimitiveBaseShape.Default; - sop.Shape.State = 1; - sop.OwnerID = agent; - - SceneObjectGroup sog = new SceneObjectGroup(sop); - sog.SetScene(scene); - - return sog; - } - - private static string RandomName() - { - StringBuilder name = new StringBuilder(); - int size = random.Next(5,12); - char ch ; - for (int i=0; i [TestFixture] - public class StandaloneTeleportTests + public class ScenePresenceTeleportTests { /// /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. From 85e07c78fbed9e85c142c0f565c27015ad95769d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 02:17:41 +0100 Subject: [PATCH 12/90] refactor: Change SceneHelpers.AddClient() to AddScenePresence(). This seems to make more sense as we can get SP.ControllingClient --- .../Tests/AvatarFactoryModuleTests.cs | 2 +- .../Framework/Scenes/Tests/AttachmentTests.cs | 2 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 2 +- .../Scenes/Tests/SceneObjectDeRezTests.cs | 4 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 2 +- .../Scenes/Tests/ScenePresenceAgentTests.cs | 72 +++++++++++-------- .../Tests/ScenePresenceTeleportTests.cs | 2 +- .../World/NPC/Tests/NPCModuleTests.cs | 4 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 8 +-- 9 files changed, 54 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 4e83fa7799..1bd3b6e5e9 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, afm); - TestClient tc = SceneHelpers.AddClient(scene, userId); + IClientAPI tc = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; byte[] visualParams = new byte[AvatarAppearance.VISUALPARAM_COUNT]; for (byte i = 0; i < visualParams.Length; i++) diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs index fb28397f1e..07b30f40c0 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests region1 = scene.RegionInfo.RegionHandle; region2 = scene2.RegionInfo.RegionHandle; - SceneHelpers.AddClient(scene, agent1); + SceneHelpers.AddScenePresence(scene, agent1); } [Test] diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index ff55680c6c..1ea2329b36 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectPart part = SceneHelpers.AddSceneObject(scene); - IClientAPI client = SceneHelpers.AddClient(scene, agentId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; scene.DeRezObjects(client, new System.Collections.Generic.List() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index c8a9ca3b15..654b1a2cc6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneHelpers.AddClient(scene, userId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; @@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); - TestClient client = SceneHelpers.AddClient(scene, userId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index e604885546..c13d82e16d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests new GroupsModule(), new MockGroupsServicesConnector() }); - TestClient client = SceneHelpers.AddClient(scene, userId); + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; IGroupsModule groupsModule = scene.RequestModuleInterface(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 04f58174ba..73acf2821e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -93,6 +93,47 @@ namespace OpenSim.Region.Framework.Scenes.Tests region3 = scene3.RegionInfo.RegionHandle; } +// [Test] +// public void TestLogout() +// { +// TestHelpers.InMethod(); +//// log4net.Config.XmlConfigurator.Configure(); +// +// TestScene scene = SceneHelpers.SetupScene(); +// SceneHelpers. +// } + + /// + /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region + /// + /// + /// Please note that unlike the other tests here, this doesn't rely on structures + /// + [Test] + public void TestChildAgentEstablished() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); + + TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); +// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + + IConfigSource configSource = new IniConfigSource(); + configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); + EntityTransferModule etm = new EntityTransferModule(); + + SceneHelpers.SetupSceneModules(myScene1, configSource, etm); + + SceneHelpers.AddScenePresence(myScene1, agent1Id); +// ScenePresence childPresence = myScene2.GetScenePresence(agent1); + + // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents +// Assert.That(childPresence, Is.Not.Null); +// Assert.That(childPresence.IsChildAgent, Is.True); + } + /// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. /// @@ -190,37 +231,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests CompleteAvatarMovement */ } - - /// - /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region - /// - /// - /// Please note that unlike the other tests here, this doesn't rely on structures - /// - [Test] - public void TestChildAgentEstablished() - { - TestHelpers.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - - TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); - TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); - - IConfigSource configSource = new IniConfigSource(); - configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); - EntityTransferModule etm = new EntityTransferModule(); - - SceneHelpers.SetupSceneModules(myScene1, configSource, etm); - - SceneHelpers.AddClient(myScene1, agent1Id); - ScenePresence childPresence = myScene2.GetScenePresence(agent1); - - // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents -// Assert.That(childPresence, Is.Not.Null); -// Assert.That(childPresence.IsChildAgent, Is.True); - } // I'm commenting this test because it does not represent // crossings. The Thread.Sleep's in here are not meaningful mocks, diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 4765a861b9..39bb43a628 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests sceneA.RegisterRegionWithGrid(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); - TestClient client = SceneHelpers.AddClient(sceneA, agentId); + TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient; ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 28fa8a20e4..a0260a5bd3 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); + IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -96,7 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); - TestClient originalClient = SceneHelpers.AddClient(scene, TestHelpers.ParseTail(0x1)); + IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 55b638b3bf..070e390b63 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -341,9 +341,9 @@ namespace OpenSim.Tests.Common /// /// /// - public static TestClient AddClient(Scene scene, UUID agentId) + public static ScenePresence AddScenePresence(Scene scene, UUID agentId) { - return AddClient(scene, GenerateAgentData(agentId)); + return AddScenePresence(scene, GenerateAgentData(agentId)); } /// @@ -364,7 +364,7 @@ namespace OpenSim.Tests.Common /// /// /// - public static TestClient AddClient(Scene scene, AgentCircuitData agentData) + public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) { string reason; @@ -386,7 +386,7 @@ namespace OpenSim.Tests.Common scp.CompleteMovement(client); //scp.MakeRootAgent(new Vector3(90, 90, 90), true); - return client; + return scp; } /// From e37f8cf90270ba6e1605bdb528ca205a35cfe049 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 02:27:25 +0100 Subject: [PATCH 13/90] Add a test to check that ScenePresence and circuit go away when a root agent is closed down --- .../Scenes/Tests/ScenePresenceAgentTests.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 73acf2821e..6cf905a8bb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -93,15 +93,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests region3 = scene3.RegionInfo.RegionHandle; } -// [Test] -// public void TestLogout() -// { -// TestHelpers.InMethod(); -//// log4net.Config.XmlConfigurator.Configure(); -// -// TestScene scene = SceneHelpers.SetupScene(); -// SceneHelpers. -// } + [Test] + public void TestCloseAgent() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + TestScene scene = SceneHelpers.SetupScene(); + ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); + + Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); + + scene.IncomingCloseAgent(sp.UUID); + + Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); + Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); + } /// /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region @@ -118,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); -// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); +// TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); IConfigSource configSource = new IniConfigSource(); configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); From eec54adac5b6745c147ac7f7db947dba16e39d06 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 02:38:38 +0100 Subject: [PATCH 14/90] remove some obsolete tests that are now done elsewhere --- .../Scenes/Tests/ScenePresenceAgentTests.cs | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 6cf905a8bb..dd2c7170fa 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -135,64 +135,64 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneHelpers.AddScenePresence(myScene1, agent1Id); // ScenePresence childPresence = myScene2.GetScenePresence(agent1); - + // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents // Assert.That(childPresence, Is.Not.Null); // Assert.That(childPresence.IsChildAgent, Is.True); } - /// - /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. - /// - [Test] - public void T010_TestAddRootAgent() - { - TestHelpers.InMethod(); - - string firstName = "testfirstname"; - - AgentCircuitData agent = new AgentCircuitData(); - agent.AgentID = agent1; - agent.firstname = firstName; - agent.lastname = "testlastname"; - agent.SessionID = UUID.Random(); - agent.SecureSessionID = UUID.Random(); - agent.circuitcode = 123; - agent.BaseFolder = UUID.Zero; - agent.InventoryFolder = UUID.Zero; - agent.startpos = Vector3.Zero; - agent.CapsPath = GetRandomCapsObjectPath(); - agent.ChildrenCapSeeds = new Dictionary(); - agent.child = true; - - scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); - - string reason; - scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); - testclient = new TestClient(agent, scene); - scene.AddNewClient(testclient); - - ScenePresence presence = scene.GetScenePresence(agent1); - - Assert.That(presence, Is.Not.Null, "presence is null"); - Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); - acd1 = agent; - } - - /// - /// Test removing an uncrossed root agent from a scene. - /// - [Test] - public void T011_TestRemoveRootAgent() - { - TestHelpers.InMethod(); - - scene.RemoveClient(agent1); - - ScenePresence presence = scene.GetScenePresence(agent1); - - Assert.That(presence, Is.Null, "presence is not null"); - } +// /// +// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. +// /// +// [Test] +// public void T010_TestAddRootAgent() +// { +// TestHelpers.InMethod(); +// +// string firstName = "testfirstname"; +// +// AgentCircuitData agent = new AgentCircuitData(); +// agent.AgentID = agent1; +// agent.firstname = firstName; +// agent.lastname = "testlastname"; +// agent.SessionID = UUID.Random(); +// agent.SecureSessionID = UUID.Random(); +// agent.circuitcode = 123; +// agent.BaseFolder = UUID.Zero; +// agent.InventoryFolder = UUID.Zero; +// agent.startpos = Vector3.Zero; +// agent.CapsPath = GetRandomCapsObjectPath(); +// agent.ChildrenCapSeeds = new Dictionary(); +// agent.child = true; +// +// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); +// +// string reason; +// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); +// testclient = new TestClient(agent, scene); +// scene.AddNewClient(testclient); +// +// ScenePresence presence = scene.GetScenePresence(agent1); +// +// Assert.That(presence, Is.Not.Null, "presence is null"); +// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same"); +// acd1 = agent; +// } +// +// /// +// /// Test removing an uncrossed root agent from a scene. +// /// +// [Test] +// public void T011_TestRemoveRootAgent() +// { +// TestHelpers.InMethod(); +// +// scene.RemoveClient(agent1); +// +// ScenePresence presence = scene.GetScenePresence(agent1); +// +// Assert.That(presence, Is.Null, "presence is not null"); +// } [Test] public void T012_TestAddNeighbourRegion() From 6878049952ba25f853720d8f7fe0644569454c00 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 6 Aug 2011 03:06:05 +0100 Subject: [PATCH 15/90] get rid of bogus log message --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d354c0a39f..cd5228d341 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2298,13 +2298,6 @@ namespace OpenSim.Region.Framework.Scenes /// The direction in which this avatar should now face. public void AddNewMovement(Vector3 vec, Quaternion rotation) { - if (m_isChildAgent) - { - // WHAT??? - m_log.Debug("[SCENEPRESENCE]: AddNewMovement() called on child agent, making root agent!"); - return; - } - m_perfMonMS = Util.EnvironmentTickCount(); Rotation = rotation; From 78d8ce3816cde8702cfd4f5d198e2c69aff0a7be Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 8 Aug 2011 23:22:47 +0100 Subject: [PATCH 16/90] refactor: split out generic parts of osMakeNotecard() into a separate. Add method doc. Other minor tidies. --- .../Shared/Api/Implementation/OSSL_Api.cs | 157 +++++++++++------- 1 file changed, 99 insertions(+), 58 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8093502ccc..32ad21f66f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -348,20 +348,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api System.Threading.Thread.Sleep(delay); } - // - // OpenSim functions - // public LSL_Integer osSetTerrainHeight(int x, int y, double val) { CheckThreatLevel(ThreatLevel.High, "osSetTerrainHeight"); return SetTerrainHeight(x, y, val); } + public LSL_Integer osTerrainSetHeight(int x, int y, double val) { CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); OSSLDeprecated("osTerrainSetHeight", "osSetTerrainHeight"); return SetTerrainHeight(x, y, val); } + private LSL_Integer SetTerrainHeight(int x, int y, double val) { m_host.AddScriptLPS(1); @@ -384,12 +383,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetTerrainHeight"); return GetTerrainHeight(x, y); } + public LSL_Float osTerrainGetHeight(int x, int y) { CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); OSSLDeprecated("osTerrainGetHeight", "osGetTerrainHeight"); return GetTerrainHeight(x, y); } + private LSL_Float GetTerrainHeight(int x, int y) { m_host.AddScriptLPS(1); @@ -1021,6 +1022,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api drawList += "PenColor " + color + "; "; return drawList; } + // Deprecated public string osSetPenColour(string drawList, string colour) { @@ -1182,11 +1184,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSSLDeprecated("osSunGetParam", "osGetSunParam"); return GetSunParam(param); } + public double osGetSunParam(string param) { CheckThreatLevel(ThreatLevel.None, "osGetSunParam"); return GetSunParam(param); } + private double GetSunParam(string param) { m_host.AddScriptLPS(1); @@ -1208,11 +1212,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSSLDeprecated("osSunSetParam", "osSetSunParam"); SetSunParam(param, value); } + public void osSetSunParam(string param, double value) { CheckThreatLevel(ThreatLevel.None, "osSetSunParam"); SetSunParam(param, value); } + private void SetSunParam(string param, double value) { m_host.AddScriptLPS(1); @@ -1222,10 +1228,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { module.SetSunParameter(param, value); } - } - public string osWindActiveModelPluginName() { CheckThreatLevel(ThreatLevel.None, "osWindActiveModelPluginName"); @@ -1304,12 +1308,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSSLDeprecated(functionName, "osSetParcelDetails"); SetParcelDetails(pos, rules, functionName); } + public void osSetParcelDetails(LSL_Vector pos, LSL_List rules) { const string functionName = "osSetParcelDetails"; CheckThreatLevel(ThreatLevel.High, functionName); SetParcelDetails(pos, rules, functionName); } + private void SetParcelDetails(LSL_Vector pos, LSL_List rules, string functionName) { m_host.AddScriptLPS(1); @@ -1429,8 +1435,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api voiceModule.setLandSIPAddress(SIPAddress,land.LandData.GlobalID); else OSSLError("osSetParcelSIPAddress: No voice module enabled for this land"); - - } public string osGetScriptEngineName() @@ -1683,8 +1687,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return jsondata; } - // send a message to to object identified by the given UUID, a script in the object must implement the dataserver function - // the dataserver function is passed the ID of the calling function and a string message + /// + /// Send a message to to object identified by the given UUID + /// + /// + /// A script in the object must implement the dataserver function + /// the dataserver function is passed the ID of the calling function and a string message + /// + /// + /// public void osMessageObject(LSL_Key objectUUID, string message) { CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); @@ -1699,24 +1710,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api "dataserver", resobj, new DetectParams[0])); } - - // This needs ThreatLevel high. It is an excellent griefer tool, - // In a loop, it can cause asset bloat and DOS levels of asset - // writes. - // + /// + /// Write a notecard directly to the prim's inventory. + /// + /// + /// This needs ThreatLevel high. It is an excellent griefer tool, + /// In a loop, it can cause asset bloat and DOS levels of asset + /// writes. + /// + /// The name of the notecard to write. + /// The contents of the notecard. public void osMakeNotecard(string notecardName, LSL_Types.list contents) { CheckThreatLevel(ThreatLevel.High, "osMakeNotecard"); m_host.AddScriptLPS(1); + StringBuilder notecardData = new StringBuilder(); + + for (int i = 0; i < contents.Length; i++) + notecardData.Append((string)(contents.GetLSLStringItem(i) + "\n")); + + SaveNotecard(notecardName, notecardData.ToString()); + } + + protected void SaveNotecard(string notecardName, string notecardData) + { // Create new asset AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); asset.Description = "Script Generated Notecard"; - string notecardData = String.Empty; - - for (int i = 0; i < contents.Length; i++) { - notecardData += contents.GetLSLStringItem(i) + "\n"; - } int textLength = notecardData.Length; notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " @@ -1726,7 +1747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.AssetService.Store(asset); // Create Task Entry - TaskInventoryItem taskItem=new TaskInventoryItem(); + TaskInventoryItem taskItem = new TaskInventoryItem(); taskItem.ResetIDs(m_host.UUID); taskItem.ParentID = m_host.UUID; @@ -1751,13 +1772,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.Inventory.AddInventoryItem(taskItem, false); } - - /*Instead of using the LSL Dataserver event to pull notecard data, - this will simply read the requested line and return its data as a string. - - Warning - due to the synchronous method this function uses to fetch assets, its use - may be dangerous and unreliable while running in grid mode. - */ + /// + /// Directly get an entire notecard at once. + /// + /// + /// Instead of using the LSL Dataserver event to pull notecard data + /// this will simply read the entire notecard and return its data as a string. + /// + /// Warning - due to the synchronous method this function uses to fetch assets, its use + /// may be dangerous and unreliable while running in grid mode. + /// + /// Name of the notecard or its asset id + /// The line number to read. The first line is line 0 + /// Notecard line public string osGetNotecardLine(string name, int line) { CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine"); @@ -1799,17 +1826,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api }; return NotecardCache.GetLine(assetID, line, 255); - - } - /*Instead of using the LSL Dataserver event to pull notecard data line by line, - this will simply read the entire notecard and return its data as a string. - - Warning - due to the synchronous method this function uses to fetch assets, its use - may be dangerous and unreliable while running in grid mode. - */ - + /// + /// Get an entire notecard at once. + /// + /// + /// Instead of using the LSL Dataserver event to pull notecard data line by line, + /// this will simply read the entire notecard and return its data as a string. + /// + /// Warning - due to the synchronous method this function uses to fetch assets, its use + /// may be dangerous and unreliable while running in grid mode. + /// + /// Name of the notecard or its asset id + /// Notecard text public string osGetNotecard(string name) { CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); @@ -1857,17 +1887,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } return NotecardData; - - } - /*Instead of using the LSL Dataserver event to pull notecard data, - this will simply read the number of note card lines and return this data as an integer. - - Warning - due to the synchronous method this function uses to fetch assets, its use - may be dangerous and unreliable while running in grid mode. - */ - + /// + /// Get the number of lines in the given notecard. + /// + /// + /// Instead of using the LSL Dataserver event to pull notecard data, + /// this will simply read the number of note card lines and return this data as an integer. + /// + /// Warning - due to the synchronous method this function uses to fetch assets, its use + /// may be dangerous and unreliable while running in grid mode. + /// + /// Name of the notecard or its asset id + /// public int osGetNumberOfNotecardLines(string name) { CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); @@ -1947,15 +1980,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return ""; } - } + /// + /// Get the nickname of this grid, as set in the [GridInfo] config section. + /// + /// /// Threat level is Moderate because intentional abuse, for instance /// scripts that are written to be malicious only on one grid, /// for instance in a HG scenario, are a distinct possibility. - /// - /// Use value from the config file and return it. - /// + /// + /// public string osGetGridNick() { CheckThreatLevel(ThreatLevel.Moderate, "osGetGridNick"); @@ -2063,12 +2098,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return World.RegionInfo.RegionSettings.LoadedCreationID; } - // Threat level is 'Low' because certain users could possibly be tricked into - // dropping an unverified script into one of their own objects, which could - // then gather the physical construction details of the object and transmit it - // to an unscrupulous third party, thus permitting unauthorized duplication of - // the object's form. - // + /// + /// Get the primitive parameters of a linked prim. + /// + /// + /// Threat level is 'Low' because certain users could possibly be tricked into + /// dropping an unverified script into one of their own objects, which could + /// then gather the physical construction details of the object and transmit it + /// to an unscrupulous third party, thus permitting unauthorized duplication of + /// the object's form. + /// + /// + /// + /// public LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules) { CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); @@ -2344,10 +2386,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api obj.Shape.ProjectionFocus = (float)focus; obj.Shape.ProjectionAmbiance = (float)amb; - obj.ParentGroup.HasGroupChanged = true; obj.ScheduleFullUpdate(); - } /// @@ -2372,6 +2412,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } }); + return result; } @@ -2391,4 +2432,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } } -} +} \ No newline at end of file From 16775875328d9601a33e0fa9d229ce7864ec7c5b Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Tue, 9 Aug 2011 01:11:39 +0200 Subject: [PATCH 17/90] Let's see if I am really a core developer, now. ;) --- CONTRIBUTORS.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 5c1bdf119f..b73a87d85b 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -14,6 +14,7 @@ people that make the day to day of OpenSim happen. * Marck * Mic Bowman (Intel) * BlueWall (James Hughes) +* Snoopy Pfeffer = Core Developers Following the White Rabbit = Core developers who have temporarily (we hope) gone chasing the white rabbit. @@ -128,7 +129,6 @@ what it is today. * Salahzar Stenvaag * sempuki * SignpostMarv -* Snoopy * Strawberry Fride * tglion * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) From 3e16a0fbdd9477f24a93e0e70311bfca7995e339 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Aug 2011 00:12:41 +0100 Subject: [PATCH 18/90] factor out common notecard caching code from 3 methods. --- .../Shared/Api/Implementation/OSSL_Api.cs | 167 ++++++++---------- 1 file changed, 74 insertions(+), 93 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 32ad21f66f..154179c491 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1733,7 +1733,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SaveNotecard(notecardName, notecardData.ToString()); } - protected void SaveNotecard(string notecardName, string notecardData) + /// + /// Save a notecard to prim inventory. + /// + /// + /// + /// Prim inventory item created. + protected TaskInventoryItem SaveNotecard(string notecardName, string notecardData) { // Create new asset AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); @@ -1770,6 +1776,66 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.AssetID = asset.FullID; m_host.Inventory.AddInventoryItem(taskItem, false); + + return taskItem; + } + + /// + /// Load the notecard data found at the given prim inventory item name or asset uuid. + /// + /// + /// The text loaded. Null if no notecard was found. + protected string LoadNotecard(string notecardNameOrUuid) + { + UUID assetID = CacheNotecard(notecardNameOrUuid); + StringBuilder notecardData = new StringBuilder(); + + for (int count = 0; count < NotecardCache.GetLines(assetID); count++) + notecardData.Append(NotecardCache.GetLine(assetID, count, 255) + "\n"); + + return notecardData.ToString(); + } + + /// + /// Cache a notecard's contents. + /// + /// + /// + /// The asset id of the notecard, which is used for retrieving the cached data. + /// UUID.Zero if no asset could be found. + /// + protected UUID CacheNotecard(string notecardNameOrUuid) + { + UUID assetID = UUID.Zero; + StringBuilder notecardData = new StringBuilder(); + + if (!UUID.TryParse(notecardNameOrUuid, out assetID)) + { + foreach (TaskInventoryItem item in m_host.TaskInventory.Values) + { + if (item.Type == 7 && item.Name == notecardNameOrUuid) + { + assetID = item.AssetID; + } + } + } + + if (assetID == UUID.Zero) + return UUID.Zero; + + if (!NotecardCache.IsCached(assetID)) + { + AssetBase a = World.AssetService.Get(assetID.ToString()); + + if (a == null) + return UUID.Zero; + + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); + string data = enc.GetString(a.Data); + NotecardCache.Cache(assetID, data); + }; + + return assetID; } /// @@ -1790,18 +1856,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecardLine"); m_host.AddScriptLPS(1); - UUID assetID = UUID.Zero; - - if (!UUID.TryParse(name, out assetID)) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - } - } - } + UUID assetID = CacheNotecard(name); if (assetID == UUID.Zero) { @@ -1809,22 +1864,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return "ERROR!"; } - if (!NotecardCache.IsCached(assetID)) - { - AssetBase a = World.AssetService.Get(assetID.ToString()); - if (a != null) - { - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); - NotecardCache.Cache(assetID, data); - } - else - { - OSSLShoutError("Notecard '" + name + "' could not be found."); - return "ERROR!"; - } - }; - return NotecardCache.GetLine(assetID, line, 255); } @@ -1845,48 +1884,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNotecard"); m_host.AddScriptLPS(1); - UUID assetID = UUID.Zero; - string NotecardData = ""; + string text = LoadNotecard(name); - if (!UUID.TryParse(name, out assetID)) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - } - } - } - - if (assetID == UUID.Zero) + if (text == null) { OSSLShoutError("Notecard '" + name + "' could not be found."); return "ERROR!"; } - - if (!NotecardCache.IsCached(assetID)) + else { - AssetBase a = World.AssetService.Get(assetID.ToString()); - if (a != null) - { - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); - NotecardCache.Cache(assetID, data); - } - else - { - OSSLShoutError("Notecard '" + name + "' could not be found."); - return "ERROR!"; - } - }; - - for (int count = 0; count < NotecardCache.GetLines(assetID); count++) - { - NotecardData += NotecardCache.GetLine(assetID, count, 255) + "\n"; + return text; } - - return NotecardData; } /// @@ -1906,18 +1914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osGetNumberOfNotecardLines"); m_host.AddScriptLPS(1); - UUID assetID = UUID.Zero; - - if (!UUID.TryParse(name, out assetID)) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - } - } - } + UUID assetID = CacheNotecard(name); if (assetID == UUID.Zero) { @@ -1925,22 +1922,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return -1; } - if (!NotecardCache.IsCached(assetID)) - { - AssetBase a = World.AssetService.Get(assetID.ToString()); - if (a != null) - { - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - string data = enc.GetString(a.Data); - NotecardCache.Cache(assetID, data); - } - else - { - OSSLShoutError("Notecard '" + name + "' could not be found."); - return -1; - } - }; - return NotecardCache.GetLines(assetID); } @@ -2412,7 +2393,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } }); - + return result; } From e869eeb0bfc48c769f680970f99e4c67dd5a1a70 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Aug 2011 03:51:34 +0100 Subject: [PATCH 19/90] Implement first draft functions for saving and loading NPC appearance from storage. This works by serializing and deserializing NPC AvatarAppearance to a notecard in the prim inventory and making the required baked textures permanent. By using notecards, we avoid lots of awkward, technical and user-unfriendly issues concerning retaining asset references and creating a new asset type. Notecards also allow different appearances to be swapped and manipulated easily. This also allows stored NPC appearances to work transparently with OARs/IARs since the UUID scan will pick up and store the necessary references from the notecard text. This works in my basic test but is not at all ready for user use or bug reporting yet. --- OpenSim/Framework/AvatarAppearance.cs | 2 +- .../AvatarFactory/AvatarFactoryModule.cs | 87 +++++++++++---- .../Tests/AvatarFactoryModuleTests.cs | 2 +- .../Framework/Interfaces/IAvatarFactory.cs | 8 ++ .../Region/Framework/Interfaces/INPCModule.cs | 19 +++- .../OptionalModules/World/NPC/NPCModule.cs | 29 +++++ .../World/NPC/Tests/NPCModuleTests.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 33 +++++- .../Shared/Api/Implementation/OSSL_Api.cs | 104 +++++++++++++++--- .../Shared/Api/Interface/IOSSL_Api.cs | 2 + .../Shared/Api/Runtime/OSSL_Stub.cs | 10 ++ prebuild.xml | 1 + 12 files changed, 253 insertions(+), 46 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 73b068d026..02af5d9d7c 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -539,7 +539,7 @@ namespace OpenSim.Framework /// public void Unpack(OSDMap data) { - if ((data != null) && (data["serial"] != null)) + if ((data != null) && (data["serial"] != null)) m_serial = data["serial"].AsInteger(); if ((data != null) && (data["height"] != null)) m_avatarHeight = (float)data["height"].AsReal(); diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e3e34523a8..75d8143edc 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public void NewClient(IClientAPI client) { client.OnRequestWearables += SendWearables; - client.OnSetAppearance += SetAppearance; + client.OnSetAppearance += SetAppearanceFromClient; client.OnAvatarNowWearing += AvatarIsWearing; } @@ -189,7 +189,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory /// /// /// - public void SetAppearance(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) + public void SetAppearanceFromClient(IClientAPI client, Primitive.TextureEntry textureEntry, byte[] visualParams) { ScenePresence sp = m_scene.GetScenePresence(client.AgentId); if (sp == null) @@ -257,6 +257,47 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return true; } + public bool SaveBakedTextures(UUID agentId) + { + ScenePresence sp = m_scene.GetScenePresence(agentId); + + if (sp == null || sp.IsChildAgent) + return false; + + AvatarAppearance appearance = sp.Appearance; + Primitive.TextureEntryFace[] faceTextures = appearance.Texture.FaceTextures; + + m_log.DebugFormat( + "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", + sp.Name, m_scene.RegionInfo.RegionName); + + for (int i = 0; i < faceTextures.Length; i++) + { +// m_log.DebugFormat( +// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", +// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); + + if (faceTextures[i] == null) + continue; + + AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString()); + + if (asset != null) + { + asset.Temporary = false; + m_scene.AssetService.Store(asset); + } + else + { + m_log.WarnFormat( + "[AV FACTORY]: Baked texture {0} for {1} in {2} unexpectedly not found when trying to save permanently", + faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName); + } + } + + return true; + } + #region UpdateAppearanceTimer /// @@ -289,25 +330,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } - private void HandleAppearanceSend(UUID agentid) - { - ScenePresence sp = m_scene.GetScenePresence(agentid); - if (sp == null) - { - m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentid); - return; - } - - // m_log.WarnFormat("[AVFACTORY]: Handle appearance send for {0}", agentid); - - // Send the appearance to everyone in the scene - sp.SendAppearanceToAllOtherAgents(); - - // Send animations back to the avatar as well - sp.Animator.SendAnimPack(); - } - - private void HandleAppearanceSave(UUID agentid) + private void SaveAppearance(UUID agentid) { // We must set appearance parameters in the en_US culture in order to avoid issues where values are saved // in a culture where decimal points are commas and then reloaded in a culture which just treats them as @@ -337,7 +360,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { if (kvp.Value < now) { - Util.FireAndForget(delegate(object o) { HandleAppearanceSend(kvp.Key); }); + Util.FireAndForget(delegate(object o) { SendAppearance(kvp.Key); }); m_sendqueue.Remove(kvp.Key); } } @@ -350,7 +373,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { if (kvp.Value < now) { - Util.FireAndForget(delegate(object o) { HandleAppearanceSave(kvp.Key); }); + Util.FireAndForget(delegate(object o) { SaveAppearance(kvp.Key); }); m_savequeue.Remove(kvp.Key); } } @@ -427,6 +450,24 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } + public bool SendAppearance(UUID agentId) + { + ScenePresence sp = m_scene.GetScenePresence(agentId); + if (sp == null) + { + m_log.WarnFormat("[AVFACTORY]: Agent {0} no longer in the scene", agentId); + return false; + } + + // Send the appearance to everyone in the scene + sp.SendAppearanceToAllOtherAgents(); + + // Send animations back to the avatar as well + sp.Animator.SendAnimPack(); + + return true; + } + private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) { IInventoryService invService = m_scene.InventoryService; diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 1bd3b6e5e9..b831b31776 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory for (byte i = 0; i < visualParams.Length; i++) visualParams[i] = i; - afm.SetAppearance(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); + afm.SetAppearanceFromClient(tc, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams); ScenePresence sp = scene.GetScenePresence(userId); diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs index d0e56098c7..6817725864 100644 --- a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs +++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs @@ -32,6 +32,14 @@ namespace OpenSim.Region.Framework.Interfaces { public interface IAvatarFactory { + /// + /// Send the appearance of an avatar to others in the scene. + /// + /// + /// + bool SendAppearance(UUID agentId); + + bool SaveBakedTextures(UUID agentId); bool ValidateBakedTextureCache(IClientAPI client); void QueueAppearanceSend(UUID agentid); void QueueAppearanceSave(UUID agentid); diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index fa8d6b69b4..54575ca40a 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -26,6 +26,7 @@ */ using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.Framework.Interfaces @@ -43,6 +44,23 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the ScenePresence created. UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); + /// + /// Check if the agent is an NPC. + /// + /// + /// + /// True if the agent is an NPC in the given scene. False otherwise. + bool IsNPC(UUID agentID, Scene scene); + + /// + /// Set the appearance for an NPC. + /// + /// + /// + /// + /// + bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); + /// /// Move an NPC to a target over time. /// @@ -59,7 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces /// void Say(UUID agentID, Scene scene, string text); - /// /// Delete an NPC. /// diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 4f21d9d4ec..d966345092 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -137,6 +137,35 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } + public bool IsNPC(UUID agentId, Scene scene) + { + ScenePresence sp = scene.GetScenePresence(agentId); + if (sp == null || sp.IsChildAgent) + return false; + + lock (m_avatars) + return m_avatars.ContainsKey(agentId); + } + + public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) + { + ScenePresence sp = scene.GetScenePresence(agentId); + if (sp == null || sp.IsChildAgent) + return false; + + lock (m_avatars) + if (!m_avatars.ContainsKey(agentId)) + return false; + + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); + sp.Appearance = npcAppearance; + + IAvatarFactory module = scene.RequestModuleInterface(); + module.SendAppearance(sp.UUID); + + return true; + } + public UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom) { NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index a0260a5bd3..2ec354fb84 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -72,7 +72,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // ScenePresence.SendInitialData() to reset our entire appearance. scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId)); - afm.SetAppearance(originalClient, originalTe, null); + afm.SetAppearanceFromClient(originalClient, originalTe, null); INPCModule npcModule = scene.RequestModuleInterface(); UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7c21ba9eb5..86ee28aeb4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10565,9 +10565,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public static string GetLine(UUID assetID, int line, int maxLength) + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// + public static string GetLine(UUID assetID, int lineNumber) { - if (line < 0) + if (lineNumber < 0) return ""; string data; @@ -10579,17 +10585,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_Notecards[assetID].lastRef = DateTime.Now; - if (line >= m_Notecards[assetID].text.Length) + if (lineNumber >= m_Notecards[assetID].text.Length) return "\n\n\n"; - data = m_Notecards[assetID].text[line]; - if (data.Length > maxLength) - data = data.Substring(0, maxLength); + data = m_Notecards[assetID].text[lineNumber]; return data; } } + /// + /// Get a notecard line. + /// + /// + /// Lines start at index 0 + /// Maximum length of the returned line. Longer lines will be truncated + /// + public static string GetLine(UUID assetID, int lineNumber, int maxLength) + { + string line = GetLine(assetID, lineNumber); + + if (line.Length > maxLength) + line = line.Substring(0, maxLength); + + return line; + } + public static void CacheCheck() { foreach (UUID key in new List(m_Notecards.Keys)) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 154179c491..07b36def01 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -28,11 +28,16 @@ using System; using System.Collections; using System.Collections.Generic; +using System.IO; +using System.Reflection; using System.Runtime.Remoting.Lifetime; using System.Text; using System.Net; using System.Threading; +using System.Xml; +using log4net; using OpenMetaverse; +using OpenMetaverse.StructuredData; using Nini.Config; using OpenSim; using OpenSim.Framework; @@ -119,6 +124,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api [Serializable] public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + internal IScriptEngine m_ScriptEngine; internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal SceneObjectPart m_host; @@ -1730,26 +1737,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api for (int i = 0; i < contents.Length; i++) notecardData.Append((string)(contents.GetLSLStringItem(i) + "\n")); - SaveNotecard(notecardName, notecardData.ToString()); + SaveNotecard(notecardName, "Script generated notecard", notecardData.ToString(), false); } /// /// Save a notecard to prim inventory. /// - /// + /// + /// Description of notecard /// + /// + /// If true, then if an item exists with the same name, it is replaced. + /// If false, then a new item is created witha slightly different name (e.g. name 1) + /// /// Prim inventory item created. - protected TaskInventoryItem SaveNotecard(string notecardName, string notecardData) + protected TaskInventoryItem SaveNotecard(string name, string description, string data, bool forceSameName) { // Create new asset - AssetBase asset = new AssetBase(UUID.Random(), notecardName, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); - asset.Description = "Script Generated Notecard"; + AssetBase asset = new AssetBase(UUID.Random(), name, (sbyte)AssetType.Notecard, m_host.OwnerID.ToString()); + asset.Description = description; - int textLength = notecardData.Length; - notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " - + textLength.ToString() + "\n" + notecardData + "}\n"; + int textLength = data.Length; + data + = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " + + textLength.ToString() + "\n" + data + "}\n"; - asset.Data = Util.UTF8.GetBytes(notecardData); + asset.Data = Util.UTF8.GetBytes(data); World.AssetService.Store(asset); // Create Task Entry @@ -1775,7 +1788,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api taskItem.PermsMask = 0; taskItem.AssetID = asset.FullID; - m_host.Inventory.AddInventoryItem(taskItem, false); + if (forceSameName) + m_host.Inventory.AddInventoryItemExclusive(taskItem, false); + else + m_host.Inventory.AddInventoryItem(taskItem, false); return taskItem; } @@ -1791,7 +1807,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api StringBuilder notecardData = new StringBuilder(); for (int count = 0; count < NotecardCache.GetLines(assetID); count++) - notecardData.Append(NotecardCache.GetLine(assetID, count, 255) + "\n"); + { + string line = NotecardCache.GetLine(assetID, count) + "\n"; + +// m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); + + notecardData.Append(line); + } return notecardData.ToString(); } @@ -1807,7 +1829,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected UUID CacheNotecard(string notecardNameOrUuid) { UUID assetID = UUID.Zero; - StringBuilder notecardData = new StringBuilder(); if (!UUID.TryParse(notecardNameOrUuid, out assetID)) { @@ -1864,7 +1885,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return "ERROR!"; } - return NotecardCache.GetLine(assetID, line, 255); + return NotecardCache.GetLine(assetID, line); } /// @@ -2122,9 +2143,66 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(x.ToString()); } + return new LSL_Key(UUID.Zero.ToString()); } + public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) + { + CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); + + INPCModule npcModule = World.RequestModuleInterface(); + IAvatarFactory appearanceModule = World.RequestModuleInterface(); + + if (npcModule != null && appearanceModule != null) + { + UUID avatarId = UUID.Zero; + if (!UUID.TryParse(avatar, out avatarId)) + return new LSL_Key(UUID.Zero.ToString()); + + if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + return new LSL_Key(UUID.Zero.ToString()); + + appearanceModule.SaveBakedTextures(avatarId); + ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(avatarId); + OSDMap appearancePacked = sp.Appearance.Pack(); + + TaskInventoryItem item + = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); + + return new LSL_Key(item.AssetID.ToString()); + } + + return new LSL_Key(UUID.Zero.ToString()); + } + + public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + { + CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); + + INPCModule npcModule = World.RequestModuleInterface(); + + if (npcModule != null) + { + UUID avatarId = UUID.Zero; + if (!UUID.TryParse(avatar, out avatarId)) + return; + + if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + return; + + string appearanceSerialized = LoadNotecard(notecardNameOrUuid); + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); +// OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); +// Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); +// Console.WriteLine("a.Type {0}, a.ToString() {1}", a.Type, a); + AvatarAppearance appearance = new AvatarAppearance(); + appearance.Unpack(appearanceOsd); + + npcModule.SetNPCAppearance(avatarId, appearance, m_host.ParentGroup.Scene); + } + } + public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 19352f0166..868af2794b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -170,6 +170,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osNpcCreate(string user, string name, vector position, key cloneFrom); + LSL_Key osNpcSaveAppearance(string avatar, string notecardName); + void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 7c59098a11..959b5d5e16 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -483,6 +483,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); } + public key osNpcSaveAppearance(string avatar, string notecardName) + { + return m_OSSL_Functions.osNpcSaveAppearance(avatar, notecardName); + } + + public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + { + m_OSSL_Functions.osNpcLoadAppearance(avatar, notecardNameOrUuid); + } + public void osNpcMoveTo(key npc, vector position) { m_OSSL_Functions.osNpcMoveTo(npc, position); diff --git a/prebuild.xml b/prebuild.xml index 92368ef8e4..9d1be3a2b0 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2308,6 +2308,7 @@ + From 795c8e6c22d4174d942ad56e70a0acbe507e2ec7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Aug 2011 22:05:47 +0100 Subject: [PATCH 20/90] Add osOwnerSaveAppearance() to help with setting up NPC appearances. Not yet ready for user use. Adds regression test. --- .../Shared/Api/Implementation/OSSL_Api.cs | 51 +++++++-- .../Shared/Api/Interface/IOSSL_Api.cs | 2 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 + .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 105 ++++++++++++++++++ prebuild.xml | 4 + 5 files changed, 157 insertions(+), 10 deletions(-) create mode 100644 OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 07b36def01..a05c623d41 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2147,14 +2147,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(UUID.Zero.ToString()); } + /// + /// Save the current appearance of the NPC permanently to the named notecard. + /// + /// + /// The name of the notecard to which to save the appearance. + /// The asset ID of the notecard saved. public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) { CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); INPCModule npcModule = World.RequestModuleInterface(); - IAvatarFactory appearanceModule = World.RequestModuleInterface(); - if (npcModule != null && appearanceModule != null) + if (npcModule != null) { UUID avatarId = UUID.Zero; if (!UUID.TryParse(avatar, out avatarId)) @@ -2163,14 +2168,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); - appearanceModule.SaveBakedTextures(avatarId); - ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(avatarId); - OSDMap appearancePacked = sp.Appearance.Pack(); - - TaskInventoryItem item - = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); - - return new LSL_Key(item.AssetID.ToString()); + return SaveAppearanceToNotecard(avatarId, notecardName); } return new LSL_Key(UUID.Zero.ToString()); @@ -2236,6 +2234,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api module.DeleteNPC(new UUID(npc.m_string), World); } } + + /// + /// Save the current appearance of the script owner permanently to the named notecard. + /// + /// The name of the notecard to which to save the appearance. + /// The asset ID of the notecard saved. + public LSL_Key osOwnerSaveAppearance(string notecardName) + { + CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); + + return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); + } + + protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + { + IAvatarFactory appearanceModule = World.RequestModuleInterface(); + + if (appearanceModule != null) + { + appearanceModule.SaveBakedTextures(m_host.OwnerID); + ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); + OSDMap appearancePacked = sp.Appearance.Pack(); + + TaskInventoryItem item + = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); + + return new LSL_Key(item.AssetID.ToString()); + } + else + { + return new LSL_Key(UUID.Zero.ToString()); + } + } /// /// Get current region's map texture UUID diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 868af2794b..92473ae25d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -176,6 +176,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcSay(key npc, string message); void osNpcRemove(key npc); + LSL_Key osOwnerSaveAppearance(string notecardName); + key osGetMapTexture(); key osGetRegionMapTexture(string regionName); LSL_List osGetRegionStats(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 959b5d5e16..4b21c88092 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -508,6 +508,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcRemove(npc); } + public LSL_Key osOwnerSaveAppearance(string notecardName) + { + return m_OSSL_Functions.osOwnerSaveAppearance(notecardName); + } + public OSSLPrim Prim; [Serializable] diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs new file mode 100644 index 0000000000..fc8b551f49 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -0,0 +1,105 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.Avatar.AvatarFactory; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.ScriptEngine.Shared; +using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Services.Interfaces; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.ScriptEngine.Shared.Tests +{ + /// + /// Tests for OSSL_Api + /// + [TestFixture] + public class OSSL_ApiAppearanceTest + { + [Test] + public void TestOsOwnerSaveAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + IConfigSource initConfigSource = new IniConfigSource(); + IConfig config = initConfigSource.AddConfig("XEngine"); + config.Set("Enabled", "true"); + config.Set("AllowOSFunctions", "true"); + config.Set("OSFunctionThreatLevel", "Severe"); + + UUID userId = TestHelpers.ParseTail(0x1); + float newHeight = 1.9f; + + Scene scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, new AvatarFactoryModule()); + ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); + SceneObjectPart part = so.RootPart; + scene.AddSceneObject(so); + + XEngine.XEngine engine = new XEngine.XEngine(); + engine.Initialise(initConfigSource); + engine.AddRegion(scene); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + + osslApi.osOwnerSaveAppearance(notecardName); + + IList items = part.Inventory.GetInventoryItems(notecardName); + Assert.That(items.Count, Is.EqualTo(1)); + + TaskInventoryItem ncItem = items[0]; + Assert.That(ncItem.Name, Is.EqualTo(notecardName)); + + AssetBase ncAsset = scene.AssetService.Get(ncItem.AssetID.ToString()); + Assert.That(ncAsset, Is.Not.Null); + + AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data); + anc.Decode(); + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText); + AvatarAppearance savedAppearance = new AvatarAppearance(); + savedAppearance.Unpack(appearanceOsd); + + Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); + } + } +} \ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index 9d1be3a2b0..0884696c14 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3137,13 +3137,17 @@ + + + + From 92e96d394a1712ed16b0a7835dd2ccfde01f3fee Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Aug 2011 23:11:07 +0100 Subject: [PATCH 21/90] When an NPC is created, stop telling neighbouring regions to expect a child agent --- OpenSim/Framework/IClientAPI.cs | 2 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- .../Framework/EntityTransfer/EntityTransferModule.cs | 6 +++++- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 4 ++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++++---- .../InternetRelayClientView/Server/IRCClientView.cs | 4 ++-- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 8 ++------ .../Region/OptionalModules/World/NPC/NPCModule.cs | 8 +------- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 7 ++++--- prebuild.xml | 3 +++ 11 files changed, 32 insertions(+), 30 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 481e1bb798..15fc70019b 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -786,7 +786,7 @@ namespace OpenSim.Framework event DeRezObject OnDeRezObject; event Action OnRegionHandShakeReply; event GenericCall1 OnRequestWearables; - event GenericCall1 OnCompleteMovementToRegion; + event Action OnCompleteMovementToRegion; event UpdateAgent OnPreAgentUpdate; event UpdateAgent OnAgentUpdate; event AgentRequestSit OnAgentRequestSit; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4a36b5db47..46d7f78963 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -90,7 +90,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ObjectAttach OnObjectAttach; public event ObjectDeselect OnObjectDetach; public event ObjectDrop OnObjectDrop; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -6195,10 +6195,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) { - GenericCall1 handlerCompleteMovementToRegion = OnCompleteMovementToRegion; + Action handlerCompleteMovementToRegion = OnCompleteMovementToRegion; if (handlerCompleteMovementToRegion != null) { - handlerCompleteMovementToRegion(sender); + handlerCompleteMovementToRegion(sender, true); } handlerCompleteMovementToRegion = null; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 457ee33352..f5d49c5985 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1065,10 +1065,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #endregion #region Enable Child Agent + /// /// This informs a single neighbouring region about agent "avatar". /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// + /// + /// public void EnableChildAgent(ScenePresence sp, GridRegion region) { m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighbour {0}", region.RegionName); @@ -1126,6 +1129,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// This informs all neighbouring regions about agent "avatar". /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// + /// public void EnableChildAgents(ScenePresence sp) { List neighbours = new List(); @@ -1312,7 +1316,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Utils.LongToUInts(reg.RegionHandle, out x, out y); x = x / Constants.RegionSize; y = y / Constants.RegionSize; - m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint.ToString() + ")"); + m_log.Debug("[ENTITY TRANSFER MODULE]: Starting to inform client about neighbour " + x + ", " + y + "(" + endPoint + ")"); string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 4f58ab01c5..08023b81cb 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -663,7 +663,7 @@ namespace OpenSim.Region.Examples.SimpleModule if (OnCompleteMovementToRegion != null) { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } } public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index cd5228d341..af28dd9353 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1144,10 +1144,14 @@ namespace OpenSim.Region.Framework.Scenes /// /// Complete Avatar's movement into the region. - /// This is called upon a very important packet sent from the client, - /// so it's client-controlled. Never call this method directly. /// - public void CompleteMovement(IClientAPI client) + /// + /// + /// If true, send notification to neighbour regions to expect + /// a child agent from the client. These neighbours can be some distance away, depending right now on the + /// configuration of DefaultDrawDistance in the [Startup] section of config + /// + public void CompleteMovement(IClientAPI client, bool enableNeighbourChildAgents) { // DateTime startTime = DateTime.Now; @@ -1188,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes SendInitialData(); // Create child agents in neighbouring regions - if (!m_isChildAgent) + if (enableNeighbourChildAgents && !m_isChildAgent) { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index a0c1ab1fee..8ebf9cb9b3 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -677,7 +677,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -913,7 +913,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server if (OnCompleteMovementToRegion != null) { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index dfc624d294..b3e249594c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -190,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -745,12 +745,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC { OnRegionHandShakeReply(this); } - - if (OnCompleteMovementToRegion != null) - { - OnCompleteMovementToRegion(this); - } } + public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index d966345092..88867f28b6 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -201,13 +201,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_log.DebugFormat( "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); - // Shouldn't call this - temporary. - sp.CompleteMovement(npcAvatar); - -// sp.SendAppearanceToAllOtherAgents(); -// -// // Send animations back to the avatar as well -// sp.Animator.SendAnimPack(); + sp.CompleteMovement(npcAvatar, false); } else { diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 070e390b63..8d2108c116 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -383,7 +383,7 @@ namespace OpenSim.Tests.Common // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. ScenePresence scp = scene.GetScenePresence(agentData.AgentID); - scp.CompleteMovement(client); + scp.CompleteMovement(client, true); //scp.MakeRootAgent(new Vector3(90, 90, 90), true); return scp; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 88043f3739..7ec6e10198 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -95,7 +95,7 @@ namespace OpenSim.Tests.Common.Mock public event DeRezObject OnDeRezObject; public event Action OnRegionHandShakeReply; public event GenericCall1 OnRequestWearables; - public event GenericCall1 OnCompleteMovementToRegion; + public event Action OnCompleteMovementToRegion; public event UpdateAgent OnPreAgentUpdate; public event UpdateAgent OnAgentUpdate; public event AgentRequestSit OnAgentRequestSit; @@ -455,7 +455,7 @@ namespace OpenSim.Tests.Common.Mock public void CompleteMovement() { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } public virtual void ActivateGesture(UUID assetId, UUID gestureId) @@ -759,9 +759,10 @@ namespace OpenSim.Tests.Common.Mock if (OnCompleteMovementToRegion != null) { - OnCompleteMovementToRegion(this); + OnCompleteMovementToRegion(this, true); } } + public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) { } diff --git a/prebuild.xml b/prebuild.xml index 0884696c14..220c008db7 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1680,6 +1680,7 @@ ../../../bin/ + @@ -2063,6 +2064,7 @@ + @@ -2717,6 +2719,7 @@ ../../../bin/ + From cba54090c759d1b21701179493f8399eb1b7a60f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Aug 2011 23:25:52 +0100 Subject: [PATCH 22/90] When an NPC appearance is loaded, rez the attachments too --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 88867f28b6..068eec8c25 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -159,6 +159,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); sp.Appearance = npcAppearance; + sp.RezAttachments(); IAvatarFactory module = scene.RequestModuleInterface(); module.SendAppearance(sp.UUID); From 195c1dc9b8b8511980d9a607a242b24a5a91da17 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 10 Aug 2011 00:26:38 +0100 Subject: [PATCH 23/90] implement osNpcStopMoveTo() to cancel any current move target --- .../Avatar/Attachments/AttachmentsModule.cs | 4 +- .../Region/Framework/Interfaces/INPCModule.cs | 19 ++++++++-- .../OptionalModules/World/NPC/NPCModule.cs | 37 +++++++++++++++++-- .../Shared/Api/Implementation/OSSL_Api.cs | 9 +++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ 6 files changed, 66 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1e096109cd..ebb5bd2b13 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -566,8 +566,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", Name, avatar.Name, - attachmentpoint, attachOffset, so.RootPart.AttachedPos); + m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", + so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); so.DetachFromBackup(); diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 54575ca40a..763d2dcdb4 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC bool SetNPCAppearance(UUID agentID, AvatarAppearance appearance, Scene scene); /// @@ -67,7 +67,16 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// - void MoveToTarget(UUID agentID, Scene scene, Vector3 pos); + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos); + + /// + /// Stop the NPC's current movement. + /// + /// The UUID of the NPC + /// + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool StopMoveToTarget(UUID agentID, Scene scene); /// /// Get the NPC to say something. @@ -75,13 +84,15 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// - void Say(UUID agentID, Scene scene, string text); + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool Say(UUID agentID, Scene scene, string text); /// /// Delete an NPC. /// /// The UUID of the NPC /// - void DeleteNPC(UUID agentID, Scene scene); + /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC + bool DeleteNPC(UUID agentID, Scene scene); } } \ No newline at end of file diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 068eec8c25..87cb32203b 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -217,7 +217,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC return npcAvatar.AgentId; } - public void MoveToTarget(UUID agentID, Scene scene, Vector3 pos) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos) { lock (m_avatars) { @@ -230,22 +230,49 @@ namespace OpenSim.Region.OptionalModules.World.NPC "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); sp.MoveToTarget(pos); + + return true; } } + + return false; } - public void Say(UUID agentID, Scene scene, string text) + public bool StopMoveToTarget(UUID agentID, Scene scene) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + + sp.Velocity = Vector3.Zero; + sp.ResetMoveToTarget(); + + return true; + } + } + + return false; + } + + public bool Say(UUID agentID, Scene scene, string text) { lock (m_avatars) { if (m_avatars.ContainsKey(agentID)) { m_avatars[agentID].Say(text); + + return true; } } + + return false; } - public void DeleteNPC(UUID agentID, Scene scene) + public bool DeleteNPC(UUID agentID, Scene scene) { lock (m_avatars) { @@ -253,8 +280,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC { scene.RemoveClient(agentID); m_avatars.Remove(agentID); + + return true; } } + + return false; } public void PostInitialise() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a05c623d41..9c320296ed 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2213,6 +2213,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcStopMoveTo(LSL_Key npc) + { + CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + module.StopMoveToTarget(new UUID(npc.m_string), World); + } + public void osNpcSay(LSL_Key npc, string message) { CheckThreatLevel(ThreatLevel.High, "osNpcSay"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 92473ae25d..ab0097aedd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,6 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Key osNpcSaveAppearance(string avatar, string notecardName); void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); + void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 4b21c88092..a7843dd6a0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -498,6 +498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } + public void osNpcStopMoveTo(LSL_Key npc) + { + m_OSSL_Functions.osNpcStopMoveTo(npc); + } + public void osNpcSay(key npc, string message) { m_OSSL_Functions.osNpcSay(npc, message); From 4cb8d6379ddb39cfb8b30a63475e154a00a78110 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 10 Aug 2011 00:59:31 +0100 Subject: [PATCH 24/90] Stop trying to deregister caps or close child agents when an NPC is removed --- OpenSim/Framework/IScene.cs | 13 ++++++++++++- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++-------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 12 +----------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++--- .../Region/OptionalModules/World/NPC/NPCModule.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 1298f26a62..b5f975b7be 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -70,8 +70,19 @@ namespace OpenSim.Framework event restart OnRestart; + /// + /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing + /// will promote it to a root agent during login. + /// + /// + /// Remove the given client from the scene. + /// + /// + /// Close the neighbour child agents associated with this client. + void RemoveClient(UUID agentID, bool closeChildAgents); void Restart(); //RegionInfo OtherRegionUp(RegionInfo thisRegion); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 46d7f78963..977918ae50 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -512,7 +512,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_udpServer.Flush(m_udpClient); // Remove ourselves from the scene - m_scene.RemoveClient(AgentId); + m_scene.RemoveClient(AgentId, true); // We can't reach into other scenes and close the connection // We need to do this over grid communications diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b3b6cbc3a4..9aa9bf530b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3091,11 +3091,7 @@ namespace OpenSim.Region.Framework.Scenes } } - /// - /// Remove the given client from the scene. - /// - /// - public override void RemoveClient(UUID agentID) + public override void RemoveClient(UUID agentID, bool closeChildAgents) { CheckHeartbeat(); bool childagentYN = false; @@ -3116,15 +3112,17 @@ namespace OpenSim.Region.Framework.Scenes (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); m_sceneGraph.removeUserCount(!childagentYN); - - if (CapsModule != null) + + // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop + // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI + if (closeChildAgents && CapsModule != null) CapsModule.RemoveCaps(agentID); // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever // this method is doing is HORRIBLE!!! avatar.Scene.NeedSceneCacheClear(avatar.UUID); - if (!avatar.IsChildAgent) + if (closeChildAgents && !avatar.IsChildAgent) { //List childknownRegions = new List(); //List ckn = avatar.KnownChildRegionHandles; @@ -3136,6 +3134,7 @@ namespace OpenSim.Region.Framework.Scenes regions.Remove(RegionInfo.RegionHandle); m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); } + m_eventManager.TriggerClientClosed(agentID, this); } catch (NullReferenceException) diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index c4547f2b46..2f1cdc1212 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -175,18 +175,8 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Agent/Avatar - /// - /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing - /// will promote it to a root agent during login. - /// - /// - /// Remove a client from the scene - /// - /// - public abstract void RemoveClient(UUID agentID); + public abstract void RemoveClient(UUID agentID, bool closeChildAgents); public bool TryGetScenePresence(UUID agentID, out object scenePresence) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index af28dd9353..2db83ebe91 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1146,12 +1146,12 @@ namespace OpenSim.Region.Framework.Scenes /// Complete Avatar's movement into the region. /// /// - /// + /// /// If true, send notification to neighbour regions to expect /// a child agent from the client. These neighbours can be some distance away, depending right now on the /// configuration of DefaultDrawDistance in the [Startup] section of config /// - public void CompleteMovement(IClientAPI client, bool enableNeighbourChildAgents) + public void CompleteMovement(IClientAPI client, bool openChildAgents) { // DateTime startTime = DateTime.Now; @@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Framework.Scenes SendInitialData(); // Create child agents in neighbouring regions - if (enableNeighbourChildAgents && !m_isChildAgent) + if (openChildAgents && !m_isChildAgent) { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 87cb32203b..7b9457abab 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC { if (m_avatars.ContainsKey(agentID)) { - scene.RemoveClient(agentID); + scene.RemoveClient(agentID, false); m_avatars.Remove(agentID); return true; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 7ec6e10198..dd5f6fe4aa 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -887,7 +887,7 @@ namespace OpenSim.Tests.Common.Mock public void Close() { - m_scene.RemoveClient(AgentId); + m_scene.RemoveClient(AgentId, true); } public void Start() From 5d6c9644faf6aeac38410af9cff97adfef88d7aa Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 10 Aug 2011 01:47:37 +0100 Subject: [PATCH 25/90] early code to allow scripts to force npcs not to fly when moving to target this is to allow walking on prims. it will be up to the script writer to be sure that there is a continuous path. currently implemented in osNpcMoveToTarget(), but none of this is final. --- .../Rest/Inventory/tests/Remote.cs | 2 +- OpenSim/Framework/IClientAPI.cs | 2 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 6 +++--- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 2 +- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 6 +++++- .../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++++-- .../Server/IRCClientView.cs | 2 +- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- .../Region/OptionalModules/World/NPC/NPCModule.cs | 4 ++-- .../World/NPC/Tests/NPCModuleTests.cs | 4 ++-- .../Shared/Api/Implementation/OSSL_Api.cs | 14 +++++++++++++- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 15 files changed, 45 insertions(+), 18 deletions(-) diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs index de2049f6e6..1023108661 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/tests/Remote.cs @@ -169,7 +169,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory.Tests float y = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Y]); float z = Convert.ToSingle(rdata.Parameters[PARM_MOVE_Z]); Vector3 vector = new Vector3(x, y, z); - presence.MoveToTarget(vector); + presence.MoveToTarget(vector, false); } catch (Exception e) { diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 15fc70019b..a0d10edd3f 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -935,7 +935,7 @@ namespace OpenSim.Framework event ScriptReset OnScriptReset; event GetScriptRunning OnGetScriptRunning; event SetScriptRunning OnSetScriptRunning; - event Action OnAutoPilotGo; + event Action OnAutoPilotGo; event TerrainUnacked OnUnackedTerrain; event ActivateGesture OnActivateGesture; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 977918ae50..1d35973646 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -231,7 +231,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; public event ActivateGesture OnActivateGesture; public event DeactivateGesture OnDeactivateGesture; @@ -11628,9 +11628,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP locy = Convert.ToSingle(args[1]) - (float)regionY; locz = Convert.ToSingle(args[2]); - Action handlerAutoPilotGo = OnAutoPilotGo; + Action handlerAutoPilotGo = OnAutoPilotGo; if (handlerAutoPilotGo != null) - handlerAutoPilotGo(new Vector3(locx, locy, locz)); + handlerAutoPilotGo(new Vector3(locx, locy, locz), false); } /// diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 08023b81cb..c87790f9f8 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -222,7 +222,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 763d2dcdb4..06296c9d04 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -67,8 +67,12 @@ namespace OpenSim.Region.Framework.Interfaces /// The UUID of the NPC /// /// + /// + /// If true, then the avatar will attempt to walk to the location even if it's up in the air. + /// This is to allow walking on prims. + /// /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos); + bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly); /// /// Stop the NPC's current movement. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3b6a4587e0..fe96152e31 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); if (avatar != null) { - avatar.MoveToTarget(target); + avatar.MoveToTarget(target, false); } } else diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2db83ebe91..b8e4e939ae 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1684,7 +1684,12 @@ namespace OpenSim.Region.Framework.Scenes /// Move to the given target over time. /// /// - public void MoveToTarget(Vector3 pos) + /// + /// If true, then don't allow the avatar to fly to the target, even if it's up in the air. + /// This is to allow movement to targets that are known to be on an elevated platform with a continuous path + /// from start to finish. + /// + public void MoveToTarget(Vector3 pos, bool noFly) { // m_log.DebugFormat( // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", @@ -1718,7 +1723,7 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); - if (pos.Z > terrainHeight) + if (!noFly && pos.Z > terrainHeight) PhysicsActor.Flying = true; MovingToTarget = true; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 8ebf9cb9b3..15201da44d 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -806,7 +806,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; public event ActivateGesture OnActivateGesture; public event DeactivateGesture OnDeactivateGesture; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index b3e249594c..cfd692d307 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -328,7 +328,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 7b9457abab..d0b5a94ee1 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -217,7 +217,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC return npcAvatar.AgentId; } - public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly) { lock (m_avatars) { @@ -229,7 +229,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_log.DebugFormat( "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); - sp.MoveToTarget(pos); + sp.MoveToTarget(pos, noFly); return true; } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 2ec354fb84..81497d53f2 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 0, 10); - npcModule.MoveToTarget(npc.UUID, scene, targetPos); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); @@ -135,7 +135,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // Try a second movement startPos = npc.AbsolutePosition; targetPos = startPos + new Vector3(10, 0, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); scene.Update(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9c320296ed..63c882d492 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2209,7 +2209,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos); + module.MoveToTarget(new UUID(npc.m_string), World, pos, false); + } + } + + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int noFly) + { + CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); + module.MoveToTarget(new UUID(npc.m_string), World, pos, noFly != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index ab0097aedd..56be9d9cdf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,6 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Key osNpcSaveAppearance(string avatar, string notecardName); void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); + void osNpcMoveToTarget(key npc, vector position, int noFly); void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index a7843dd6a0..c745e5cd51 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -498,6 +498,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } + public void osNpcMoveToTarget(key npc, vector position, int noFly) + { + m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly); + } + public void osNpcStopMoveTo(LSL_Key npc) { m_OSSL_Functions.osNpcStopMoveTo(npc); diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index dd5f6fe4aa..7b64947221 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -234,7 +234,7 @@ namespace OpenSim.Tests.Common.Mock public event ScriptReset OnScriptReset; public event GetScriptRunning OnGetScriptRunning; public event SetScriptRunning OnSetScriptRunning; - public event Action OnAutoPilotGo; + public event Action OnAutoPilotGo; public event TerrainUnacked OnUnackedTerrain; From fb92678b83dca1c1f64cc91f3ac887170408a455 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 10 Aug 2011 22:34:42 +0100 Subject: [PATCH 26/90] fly and no fly constants for osNpcMoveToTarget() --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- .../Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 63c882d492..9b5d8d9252 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2220,7 +2220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { - Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); + Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); module.MoveToTarget(new UUID(npc.m_string), World, pos, noFly != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 3f90788433..9ed894c50a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -591,6 +591,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int STATS_ACTIVE_SCRIPTS = 19; public const int STATS_SCRIPT_LPS = 20; + // Constants for osNpc* functions + public const int OS_NPC_FLY = 0; + public const int OS_NPC_NO_FLY = 1; + public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; From 7f499ff3f386d57bcd81ebb3f58f110011100604 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 10 Aug 2011 23:56:19 +0100 Subject: [PATCH 27/90] Add a OS_NPC_LAND_AT_TARGET option to osMoveToTarget() Default for this function is now not to automatically land. This allows better control by scripts when an avatar is going to be landing on a prim rather than the ground. Stopping the avatar involves faking a collision, to avoid the pid controller making it overshoot. A better approach would be to gradually slow the avatar as we near the target --- .../Region/Framework/Interfaces/INPCModule.cs | 5 ++- .../OptionalModules/World/NPC/NPCAvatar.cs | 5 +++ .../OptionalModules/World/NPC/NPCModule.cs | 35 ++++++++++++------- .../World/NPC/Tests/NPCModuleTests.cs | 4 +-- .../Region/Physics/OdePlugin/ODECharacter.cs | 2 ++ .../Shared/Api/Implementation/OSSL_Api.cs | 11 ++++-- .../Shared/Api/Runtime/LSL_Constants.cs | 1 + 7 files changed, 45 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 06296c9d04..08b973dc3c 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -71,8 +71,11 @@ namespace OpenSim.Region.Framework.Interfaces /// If true, then the avatar will attempt to walk to the location even if it's up in the air. /// This is to allow walking on prims. /// + /// + /// If true and the avatar is flying when it reaches the target, land. + /// /// True if the operation succeeded, false if there was no such agent or the agent was not an NPC - bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly); + bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget); /// /// Stop the NPC's current movement. diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index cfd692d307..d63c2a6705 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -37,6 +37,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC { public class NPCAvatar : IClientAPI { + /// + /// Signal whether the avatar should land when it reaches a move target + /// + public bool LandAtTarget { get; set; } + private readonly string m_firstname; private readonly string m_lastname; private readonly Vector3 m_startPos; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index d0b5a94ee1..f38af462c3 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -75,20 +75,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC // We are close enough to the target m_log.DebugFormat("[NPC MODULE]: Stopping movement of npc {0}", presence.Name); - if (presence.PhysicsActor.Flying) - { - Vector3 targetPos = presence.MoveToPositionTarget; - float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; - if (targetPos.Z - terrainHeight < 0.2) - { - presence.PhysicsActor.Flying = false; - } - } - presence.Velocity = Vector3.Zero; presence.AbsolutePosition = presence.MoveToPositionTarget; presence.ResetMoveToTarget(); + if (presence.PhysicsActor.Flying) + { + for (int i = 0; i < 5; i++) + presence.PhysicsActor.IsColliding = true; + +// Vector3 targetPos = presence.MoveToPositionTarget; + if (m_avatars[presence.UUID].LandAtTarget) + presence.PhysicsActor.Flying = false; + +// float terrainHeight = (float)presence.Scene.Heightmap[(int)targetPos.X, (int)targetPos.Y]; +// if (targetPos.Z - terrainHeight < 0.2) +// { +// presence.PhysicsActor.Flying = false; +// } + } + // FIXME: This doesn't work if (presence.PhysicsActor.Flying) presence.Animator.TrySetMovementAnimation("HOVER"); @@ -217,7 +223,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC return npcAvatar.AgentId; } - public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly) + public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget) { lock (m_avatars) { @@ -227,8 +233,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC scene.TryGetScenePresence(agentID, out sp); m_log.DebugFormat( - "[NPC MODULE]: Moving {0} to {1} in {2}", sp.Name, pos, scene.RegionInfo.RegionName); + "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", + sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); + m_avatars[agentID].LandAtTarget = landAtTarget; sp.MoveToTarget(pos, noFly); return true; @@ -263,6 +271,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC { if (m_avatars.ContainsKey(agentID)) { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + m_avatars[agentID].Say(text); return true; diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 81497d53f2..d220fab409 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); Vector3 targetPos = startPos + new Vector3(0, 0, 10); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); @@ -135,7 +135,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // Try a second movement startPos = npc.AbsolutePosition; targetPos = startPos + new Vector3(10, 0, 0); - npcModule.MoveToTarget(npc.UUID, scene, targetPos, false); + npcModule.MoveToTarget(npc.UUID, scene, targetPos, false, false); scene.Update(); diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 4f461ad47d..ecf5983539 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -305,10 +305,12 @@ namespace OpenSim.Region.Physics.OdePlugin { m_iscolliding = true; } + if (m_wascolliding != m_iscolliding) { //base.SendCollisionUpdate(new CollisionEventUpdate()); } + m_wascolliding = m_iscolliding; } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 9b5d8d9252..f83304b156 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2209,11 +2209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos, false); + module.MoveToTarget(new UUID(npc.m_string), World, pos, false, true); } } - public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int noFly) + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int moveParams) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); @@ -2221,7 +2221,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (module != null) { Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos, noFly != 0); + module.MoveToTarget( + new UUID(npc.m_string), + World, + pos, + (moveParams & ScriptBaseClass.OS_NPC_NO_FLY) != 0, + (moveParams & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index 9ed894c50a..e82c2815a2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -594,6 +594,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase // Constants for osNpc* functions public const int OS_NPC_FLY = 0; public const int OS_NPC_NO_FLY = 1; + public const int OS_NPC_LAND_AT_TARGET = 2; public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; From 951ffad81e15a35bc9f847ea1448dd247a2e6e6f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 00:23:54 +0100 Subject: [PATCH 28/90] If SP.MoveToTarget has been called with a force walk, begin by landing the avatar. There is a bug here - once an avatar has landed it glides to its new position instead of performing a walk animation --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b8e4e939ae..12a47127ab 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1723,7 +1723,9 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); - if (!noFly && pos.Z > terrainHeight) + if (noFly) + PhysicsActor.Flying = false; + else if (pos.Z > terrainHeight) PhysicsActor.Flying = true; MovingToTarget = true; diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index ecf5983539..0a0d13fcc2 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -258,7 +258,11 @@ namespace OpenSim.Region.Physics.OdePlugin public override bool Flying { get { return flying; } - set { flying = value; } + set + { + flying = value; +// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); + } } /// From 4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 01:56:42 +0100 Subject: [PATCH 29/90] 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. --- .../Scenes/Animation/ScenePresenceAnimator.cs | 10 ++++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++ OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 8 +++----- .../OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 1 + .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 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 4ab818f423..e07d8b4308 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 if (m_scenePresence.IsChildAgent) return; +// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); + if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) SendAnimPack(); } @@ -91,6 +93,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (animID == UUID.Zero) return; +// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} {1} for {2}", animID, name, m_scenePresence.Name); + AddAnimation(animID, objectID); } @@ -127,13 +131,15 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public void TrySetMovementAnimation(string anim) { - //m_log.DebugFormat("Updating movement animation to {0}", anim); - if (!m_scenePresence.IsChildAgent) { if (m_animations.TrySetDefaultAnimation( anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID)) { +// m_log.DebugFormat( +// "[SCENE PRESENCE ANIMATOR]: Updating movement animation to {0} for {1}", +// anim, m_scenePresence.Name); + // 16384 is CHANGED_ANIMATION m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { (int)Changed.ANIMATION}); SendAnimPack(); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 12a47127ab..7a30684a11 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1745,6 +1745,12 @@ namespace OpenSim.Region.Framework.Scenes MovingToTarget = false; MoveToPositionTarget = Vector3.Zero; + + // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct + // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. + // However, the line is here rather than in the NPC module since it also appears necessary to stop a + // viewer that uses "go here" from juddering on all subsequent avatar movements. + AgentControlFlags = (uint)AgentManager.ControlFlags.NONE; } private void CheckAtSitTarget() diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index f38af462c3..0e313df1c9 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 // } } - // FIXME: This doesn't work - if (presence.PhysicsActor.Flying) - presence.Animator.TrySetMovementAnimation("HOVER"); - else - presence.Animator.TrySetMovementAnimation("STAND"); +// m_log.DebugFormat( +// "[NPC MODULE]: AgentControlFlags {0}, MovementFlag {1} for {2}", +// presence.AgentControlFlags, presence.MovementFlag, presence.Name); } else { diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index d220fab409..2742b67f8e 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 double distanceToTarget = Util.GetDistanceTo(npc.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "NPC not within 1 unit of target position on first move"); Assert.That(npc.AbsolutePosition, Is.EqualTo(targetPos)); + Assert.That(npc.AgentControlFlags, Is.EqualTo((uint)AgentManager.ControlFlags.NONE)); // Try a second movement 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 f83304b156..71fc15f43e 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 ScenePresence target = (ScenePresence)World.Entities[avatarID]; if (target != null) { - UUID animID=UUID.Zero; + UUID animID = UUID.Zero; lock (m_host.TaskInventory) { foreach (KeyValuePair inv in m_host.TaskInventory) From cace6eaa8a82018fbb21ab83ce1bf95ea0a1e154 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 02:06:32 +0100 Subject: [PATCH 30/90] comment out some of the currently less useful debug log messages --- .../Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 2 +- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 4 ++-- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 4 ++-- .../ServiceConnectorsOut/GridUser/ActivityDetector.cs | 3 ++- .../ServiceConnectorsOut/Presence/PresenceDetector.cs | 2 +- .../Services/Connectors/SimianGrid/SimianActivityDetector.cs | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 8db4e674bf..ff889eaa0c 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -232,7 +232,7 @@ namespace OpenSim.Region.ClientStack.Linden public string SeedCapRequest(string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); +// m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); if (!m_Scene.CheckClient(m_HostCapsObj.AgentID, httpRequest.RemoteIPEndPoint)) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index e0807eea98..22c05c4eae 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.ClientStack.Linden //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { - m_log.InfoFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETMESH]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), delegate(Hashtable m_dhttpMethod) @@ -130,7 +130,7 @@ namespace OpenSim.Region.ClientStack.Linden } else { - m_log.InfoFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETMESH]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetMesh", m_URL); } } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 35eedb48ab..24ab06a43d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -128,12 +128,12 @@ namespace OpenSim.Region.ClientStack.Linden //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") { - m_log.InfoFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetTexture", new GetTextureHandler("/CAPS/" + capID + "/", m_assetService)); } else { - m_log.InfoFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); +// m_log.DebugFormat("[GETTEXTURE]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); caps.RegisterHandler("GetTexture", m_URL); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs index 65438456b9..d6063ad3fe 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/GridUser/ActivityDetector.cs @@ -93,7 +93,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.GridUser lookat = ((ScenePresence)sp).Lookat; } } - m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); + +// m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs index fa5b8737b3..59a407fffb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/PresenceDetector.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence } } - m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); +// m_log.DebugFormat("[PRESENCE DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); m_PresenceService.LogoutAgent(client.SessionId); } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index b8703c69c9..2267325bdc 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs @@ -97,7 +97,7 @@ namespace OpenSim.Services.Connectors.SimianGrid } } - m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); +// m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected client logout {0} in {1}", client.AgentId, client.Scene.RegionInfo.RegionName); m_GridUserService.LoggedOut(client.AgentId.ToString(), client.SessionId, client.Scene.RegionInfo.RegionID, position, lookat); } } From ee22569c9262277467df9a4b15674a1472fa0b71 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 02:19:13 +0100 Subject: [PATCH 31/90] only accept npc UUIDs to osNpc* functions, not names (except for create) --- .../Shared/Api/Implementation/OSSL_Api.cs | 28 ++++++++----------- .../Shared/Api/Interface/IOSSL_Api.cs | 6 ++-- .../Shared/Api/Runtime/OSSL_Stub.cs | 12 ++++---- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 71fc15f43e..91ac3b7b0a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2153,7 +2153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// The name of the notecard to which to save the appearance. /// The asset ID of the notecard saved. - public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) + public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecardName) { CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); @@ -2161,20 +2161,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID avatarId = UUID.Zero; - if (!UUID.TryParse(avatar, out avatarId)) + UUID npcId = new UUID(npc.m_string); + + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); - if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) - return new LSL_Key(UUID.Zero.ToString()); - - return SaveAppearanceToNotecard(avatarId, notecardName); + return SaveAppearanceToNotecard(npcId, notecardName); } return new LSL_Key(UUID.Zero.ToString()); } - public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + public void osNpcLoadAppearance(LSL_Key npc, string notecardNameOrUuid) { CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); @@ -2182,11 +2180,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID avatarId = UUID.Zero; - if (!UUID.TryParse(avatar, out avatarId)) - return; + UUID npcId = new UUID(npc.m_string); - if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return; string appearanceSerialized = LoadNotecard(notecardNameOrUuid); @@ -2197,7 +2193,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AvatarAppearance appearance = new AvatarAppearance(); appearance.Unpack(appearanceOsd); - npcModule.SetNPCAppearance(avatarId, appearance, m_host.ParentGroup.Scene); + npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene); } } @@ -2213,7 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int moveParams) + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int options) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); @@ -2225,8 +2221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api new UUID(npc.m_string), World, pos, - (moveParams & ScriptBaseClass.OS_NPC_NO_FLY) != 0, - (moveParams & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); + (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, + (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 56be9d9cdf..f4a618b78f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -170,10 +170,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osNpcCreate(string user, string name, vector position, key cloneFrom); - LSL_Key osNpcSaveAppearance(string avatar, string notecardName); - void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); + LSL_Key osNpcSaveAppearance(key npc, string notecardName); + void osNpcLoadAppearance(key npc, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); - void osNpcMoveToTarget(key npc, vector position, int noFly); + void osNpcMoveToTarget(key npc, vector position, int options); void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c745e5cd51..84d61f4895 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -483,14 +483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); } - public key osNpcSaveAppearance(string avatar, string notecardName) + public key osNpcSaveAppearance(key npc, string notecardName) { - return m_OSSL_Functions.osNpcSaveAppearance(avatar, notecardName); + return m_OSSL_Functions.osNpcSaveAppearance(npc, notecardName); } - public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + public void osNpcLoadAppearance(key npc, string notecardNameOrUuid) { - m_OSSL_Functions.osNpcLoadAppearance(avatar, notecardNameOrUuid); + m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); } public void osNpcMoveTo(key npc, vector position) @@ -498,9 +498,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } - public void osNpcMoveToTarget(key npc, vector position, int noFly) + public void osNpcMoveToTarget(key npc, vector position, int options) { - m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly); + m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); } public void osNpcStopMoveTo(LSL_Key npc) From 29093df1a7f3d2816d1b446524b2de18b0b5ac45 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 02:36:02 +0100 Subject: [PATCH 32/90] get rid of intermediate local store of body rotation in ScenePresence, this is not used. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7a30684a11..e28d1fe189 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.Framework.Scenes private float m_speedModifier = 1.0f; - private Quaternion m_bodyRot= Quaternion.Identity; + private Quaternion m_bodyRot = Quaternion.Identity; private Quaternion m_bodyRotPrevious = Quaternion.Identity; @@ -1397,7 +1397,6 @@ namespace OpenSim.Region.Framework.Scenes bool update_rotation = false; bool DCFlagKeyPressed = false; Vector3 agent_control_v3 = Vector3.Zero; - Quaternion q = bodyRotation; bool oldflying = PhysicsActor.Flying; @@ -1411,9 +1410,9 @@ namespace OpenSim.Region.Framework.Scenes if (actor.Flying != oldflying) update_movementflag = true; - if (q != m_bodyRot) + if (bodyRotation != m_bodyRot) { - m_bodyRot = q; + m_bodyRot = bodyRotation; update_rotation = true; } @@ -1535,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); - AddNewMovement(agent_control_v3, q); + AddNewMovement(agent_control_v3, bodyRotation); } if (update_movementflag From 36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 02:54:15 +0100 Subject: [PATCH 33/90] instead of setting avatar rotation twice in SP.HandleAgentUpdate(), eliminate the second setting in AddNewMovement() --- .../Region/Framework/Scenes/ScenePresence.cs | 30 +++++++++---------- .../OptionalModules/World/NPC/NPCModule.cs | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e28d1fe189..a1bd672dfb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1298,7 +1298,6 @@ namespace OpenSim.Region.Framework.Scenes #region Inputs AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; - Quaternion bodyRotation = agentData.BodyRotation; // Camera location in world. We'll need to raytrace // from this location from time to time. @@ -1384,6 +1383,15 @@ namespace OpenSim.Region.Framework.Scenes if (m_allowMovement && !SitGround) { + Quaternion bodyRotation = agentData.BodyRotation; + bool update_rotation = false; + + if (bodyRotation != m_bodyRot) + { + Rotation = bodyRotation; + update_rotation = true; + } + bool update_movementflag = false; if (agentData.UseClientAgentPosition) @@ -1393,8 +1401,6 @@ namespace OpenSim.Region.Framework.Scenes } int i = 0; - - bool update_rotation = false; bool DCFlagKeyPressed = false; Vector3 agent_control_v3 = Vector3.Zero; @@ -1410,12 +1416,6 @@ namespace OpenSim.Region.Framework.Scenes if (actor.Flying != oldflying) update_movementflag = true; - if (bodyRotation != m_bodyRot) - { - m_bodyRot = bodyRotation; - update_rotation = true; - } - if (m_parentID == 0) { bool bAllowUpdateMoveToPosition = false; @@ -1467,8 +1467,8 @@ namespace OpenSim.Region.Framework.Scenes ) // This or is for Nudge forward { m_movementflag -= ((byte)(uint)DCF); - update_movementflag = true; + /* if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) && ((m_movementflag & (byte)nudgehack) == nudgehack)) @@ -1534,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); - AddNewMovement(agent_control_v3, bodyRotation); + AddNewMovement(agent_control_v3); } if (update_movementflag @@ -1732,7 +1732,7 @@ namespace OpenSim.Region.Framework.Scenes Vector3 agent_control_v3 = new Vector3(); HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); - AddNewMovement(agent_control_v3, Rotation); + AddNewMovement(agent_control_v3); } /// @@ -2311,13 +2311,11 @@ namespace OpenSim.Region.Framework.Scenes /// Rotate the avatar to the given rotation and apply a movement in the given relative vector /// /// The vector in which to move. This is relative to the rotation argument - /// The direction in which this avatar should now face. - public void AddNewMovement(Vector3 vec, Quaternion rotation) + public void AddNewMovement(Vector3 vec) { m_perfMonMS = Util.EnvironmentTickCount(); - Rotation = rotation; - Vector3 direc = vec * rotation; + Vector3 direc = vec * Rotation; direc.Normalize(); direc *= 0.03f * 128f * m_speedModifier; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 0e313df1c9..9b86abb5b3 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC Vector3 agent_control_v3 = new Vector3(); presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); - presence.AddNewMovement(agent_control_v3, presence.Rotation); + presence.AddNewMovement(agent_control_v3); } // //// presence.DoMoveToPositionUpdate((0, presence.MoveToPositionTarget, null); From 1aa171189397f34d7d18fb358f7bd767d241675a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 03:05:51 +0100 Subject: [PATCH 34/90] eliminate the rotation parameter from SP.HandleMoveToTargetUpdate(). This can just use the currently set Rotation looks like I spoke to soon about eliminating jerkiness on "go here"/autopilot. It's still there. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++----- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 7 ++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a1bd672dfb..afa896ce98 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1496,7 +1496,7 @@ namespace OpenSim.Region.Framework.Scenes } else if (bAllowUpdateMoveToPosition) { - if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation)) + if (HandleMoveToTargetUpdate(ref agent_control_v3)) update_movementflag = true; } } @@ -1556,9 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3. /// /// Cumulative agent movement that this method will update. - /// New body rotation of the avatar. /// True if movement has been updated in some way. False otherwise. - public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation) + public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) { // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); @@ -1594,7 +1593,7 @@ namespace OpenSim.Region.Framework.Scenes // to such forces, but the following simple approach seems to works fine. Vector3 LocalVectorToTarget3D = (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords - * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords + * Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords // Ignore z component of vector // Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); LocalVectorToTarget3D.Normalize(); @@ -1731,7 +1730,7 @@ namespace OpenSim.Region.Framework.Scenes MoveToPositionTarget = pos; Vector3 agent_control_v3 = new Vector3(); - HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); + HandleMoveToTargetUpdate(ref agent_control_v3); AddNewMovement(agent_control_v3); } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 9b86abb5b3..580d7efaf5 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -81,6 +81,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (presence.PhysicsActor.Flying) { + // A horrible hack to stop the NPC dead in its tracks rather than having them overshoot + // the target if flying. + // We really need to be more subtle (slow the avatar as it approaches the target) or at + // least be able to set collision status once, rather than 5 times to give it enough + // weighting so that that PhysicsActor thinks it really is colliding. for (int i = 0; i < 5; i++) presence.PhysicsActor.IsColliding = true; @@ -106,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); - presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); + presence.HandleMoveToTargetUpdate(ref agent_control_v3); presence.AddNewMovement(agent_control_v3); } // From 3d4cc93a8e46847d4852eb3fd038ec48c284c18e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 03:07:41 +0100 Subject: [PATCH 35/90] minor: a little bit of log message correction/commenting out --- OpenSim/Data/Null/NullRegionData.cs | 2 +- .../CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 53e5207a6e..11013c1565 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs @@ -97,7 +97,7 @@ namespace OpenSim.Data.Null foreach (RegionData r in m_regionData.Values) { - m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); +// m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower()); if (queryMatch(r.RegionName.ToLower())) ret.Add(r); } diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index aa14054cf5..1d2141e5e1 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap private Bitmap fetchTexture(UUID id) { AssetBase asset = m_scene.AssetService.Get(id.ToString()); - m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null); + m_log.DebugFormat("[TexturedMapTileRenderer]: Fetched texture {0}, found: {1}", id, asset != null); if (asset == null) return null; ManagedImage managedImage; From b3a4b1053157d65d0068bf5b3362dc28da4be85a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 03:16:46 +0100 Subject: [PATCH 36/90] eliminate redundant ground sitting checks since these are already done in enclosing control structures --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index afa896ce98..18632d7671 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1537,10 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes AddNewMovement(agent_control_v3); } - if (update_movementflag - && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) - && (m_parentID == 0) - && !SitGround) + if (update_movementflag && m_parentID == 0) Animator.UpdateMovementAnimations(); } From 5d694a224f770ca734574e5ada0793745b43ca2c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 20:05:11 +0100 Subject: [PATCH 37/90] Add missing System.Xml reference which is required to build on Windows but not mono --- prebuild.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuild.xml b/prebuild.xml index 220c008db7..dff54a3e9e 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3138,6 +3138,7 @@ ../../../bin/ + From 83ca5a101d5578282ba0fd7177fcb618f70d3cc9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 20:56:18 +0100 Subject: [PATCH 38/90] Split out to-be-common setup stuff from TestOsOwnerSaveAppearance() --- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 48 +++++++++++++------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index fc8b551f49..2218a1f718 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -50,35 +50,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests [TestFixture] public class OSSL_ApiAppearanceTest { - [Test] - public void TestOsOwnerSaveAppearance() - { - TestHelpers.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); + protected Scene m_scene; + protected XEngine.XEngine m_engine; + [SetUp] + public void SetUp() + { IConfigSource initConfigSource = new IniConfigSource(); IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); config.Set("AllowOSFunctions", "true"); config.Set("OSFunctionThreatLevel", "Severe"); + m_scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(m_scene, new AvatarFactoryModule()); + + m_engine = new XEngine.XEngine(); + m_engine.Initialise(initConfigSource); + m_engine.AddRegion(m_scene); + } + + /// + /// Test creation of an NPC where the appearance data comes from a notecard + /// +// [Test] +// public void TestOsNpcCreateFromNotecard() +// { +// TestHelpers.InMethod(); +//// log4net.Config.XmlConfigurator.Configure(); +// } + + [Test] + public void TestOsOwnerSaveAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + UUID userId = TestHelpers.ParseTail(0x1); float newHeight = 1.9f; - Scene scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, new AvatarFactoryModule()); - ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); sp.Appearance.AvatarHeight = newHeight; SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); SceneObjectPart part = so.RootPart; - scene.AddSceneObject(so); - - XEngine.XEngine engine = new XEngine.XEngine(); - engine.Initialise(initConfigSource); - engine.AddRegion(scene); + m_scene.AddSceneObject(so); OSSL_Api osslApi = new OSSL_Api(); - osslApi.Initialize(engine, part, part.LocalId, part.UUID); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); string notecardName = "appearanceNc"; @@ -90,7 +108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests TaskInventoryItem ncItem = items[0]; Assert.That(ncItem.Name, Is.EqualTo(notecardName)); - AssetBase ncAsset = scene.AssetService.Get(ncItem.AssetID.ToString()); + AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString()); Assert.That(ncAsset, Is.Not.Null); AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data); From 50945dd56029a1280c581ea9b29213ab0e162a0a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 21:43:26 +0100 Subject: [PATCH 39/90] add regression test for osNpcCreate when cloning an in-region avatar --- .../Region/Framework/Interfaces/INPCModule.cs | 4 +- .../OptionalModules/World/NPC/NPCModule.cs | 29 +------ .../World/NPC/Tests/NPCModuleTests.cs | 10 +-- .../Shared/Api/Implementation/OSSL_Api.cs | 6 +- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 79 +++++++++++++++++-- prebuild.xml | 2 + 6 files changed, 89 insertions(+), 41 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 08b973dc3c..5e5c4a1e14 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -40,9 +40,9 @@ namespace OpenSim.Region.Framework.Interfaces /// /// /// - /// The UUID of the avatar from which to clone the NPC's appearance from. + /// The avatar appearance to use for the new NPC. /// The UUID of the ScenePresence created. - UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom); + UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance); /// /// Check if the agent is an NPC. diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 580d7efaf5..c764c20f12 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -45,7 +45,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Dictionary m_avatars = new Dictionary(); - private Dictionary m_appearanceCache = new Dictionary(); public void Initialise(Scene scene, IConfigSource source) { @@ -124,28 +123,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } - private AvatarAppearance GetAppearance(UUID target, Scene scene) - { - if (m_appearanceCache.ContainsKey(target)) - return m_appearanceCache[target]; - - ScenePresence originalPresence = scene.GetScenePresence(target); - - if (originalPresence != null) - { - AvatarAppearance originalAppearance = originalPresence.Appearance; - m_appearanceCache.Add(target, originalAppearance); - return originalAppearance; - } - else - { - m_log.DebugFormat( - "[NPC MODULE]: Avatar {0} is not in the scene for us to grab baked textures from them. Using defaults.", target); - - return new AvatarAppearance(); - } - } - public bool IsNPC(UUID agentId, Scene scene) { ScenePresence sp = scene.GetScenePresence(agentId); @@ -176,7 +153,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC return true; } - public UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom) + public UUID CreateNPC( + string firstname, string lastname, Vector3 position, Scene scene, AvatarAppearance appearance) { NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, scene); npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); @@ -191,8 +169,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC acd.lastname = lastname; acd.ServiceURLs = new Dictionary(); - AvatarAppearance originalAppearance = GetAppearance(cloneAppearanceFrom, scene); - AvatarAppearance npcAppearance = new AvatarAppearance(originalAppearance, true); + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); acd.Appearance = npcAppearance; // for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++) diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 2742b67f8e..f8afc5a0fe 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests AvatarFactoryModule afm = new AvatarFactoryModule(); TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); - IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; + ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); // 8 is the index of the first baked texture in AvatarAppearance @@ -72,10 +72,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests // ScenePresence.SendInitialData() to reset our entire appearance. scene.AssetService.Store(AssetHelpers.CreateAsset(originalFace8TextureId)); - afm.SetAppearanceFromClient(originalClient, originalTe, null); + afm.SetAppearanceFromClient(sp.ControllingClient, originalTe, null); INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, originalClient.AgentId); + UUID npcId = npcModule.CreateNPC("John", "Smith", new Vector3(128, 128, 30), scene, sp.Appearance); ScenePresence npc = scene.GetScenePresence(npcId); @@ -96,12 +96,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests TestScene scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(scene, config, new NPCModule()); - IClientAPI originalClient = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)).ControllingClient; + ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); Vector3 startPos = new Vector3(128, 128, 30); INPCModule npcModule = scene.RequestModuleInterface(); - UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, originalClient.AgentId); + UUID npcId = npcModule.CreateNPC("John", "Smith", startPos, scene, sp.Appearance); ScenePresence npc = scene.GetScenePresence(npcId); Assert.That(npc.AbsolutePosition, Is.EqualTo(startPos)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 91ac3b7b0a..b18aa3b839 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2135,11 +2135,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { + ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); + if (clonePresence == null) + return new LSL_Key(UUID.Zero.ToString()); + UUID x = module.CreateNPC(firstname, lastname, new Vector3((float) position.x, (float) position.y, (float) position.z), World, - new UUID(cloneFrom)); + clonePresence.Appearance); return new LSL_Key(x.ToString()); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 2218a1f718..7f778d7478 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -27,7 +27,9 @@ using System; using System.Collections.Generic; +using System.Reflection; using System.Text; +using log4net; using Nini.Config; using NUnit.Framework; using OpenMetaverse; @@ -35,6 +37,7 @@ using OpenMetaverse.Assets; using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; +using OpenSim.Region.OptionalModules.World.NPC; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api; @@ -61,9 +64,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests config.Set("Enabled", "true"); config.Set("AllowOSFunctions", "true"); config.Set("OSFunctionThreatLevel", "Severe"); + config = initConfigSource.AddConfig("NPC"); + config.Set("Enabled", "true"); m_scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(m_scene, new AvatarFactoryModule()); + SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); m_engine = new XEngine.XEngine(); m_engine.Initialise(initConfigSource); @@ -73,12 +78,72 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests /// /// Test creation of an NPC where the appearance data comes from a notecard /// -// [Test] -// public void TestOsNpcCreateFromNotecard() -// { -// TestHelpers.InMethod(); -//// log4net.Config.XmlConfigurator.Configure(); -// } + //[Test] + public void TestOsNpcCreateFromNotecard() + { + TestHelpers.InMethod(); + log4net.Config.XmlConfigurator.Configure(); + + // Store an avatar with a different height from default in a notecard. + UUID userId = TestHelpers.ParseTail(0x1); + float newHeight = 1.9f; + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); + SceneObjectPart part = so.RootPart; + m_scene.AddSceneObject(so); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + osslApi.osOwnerSaveAppearance(notecardName); + + // Try creating a bot using the appearance in the notecard. + string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), notecardName); + Assert.That(npcRaw, Is.Not.Null); + + UUID npcId = new UUID(npcRaw); + ScenePresence npc = m_scene.GetScenePresence(npcId); + Assert.That(npc, Is.Not.Null); + Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); + } + + /// + /// Test creation of an NPC where the appearance data comes from an avatar already in the region. + /// + [Test] + public void TestOsNpcCreateFromAvatar() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + // Store an avatar with a different height from default in a notecard. + UUID userId = TestHelpers.ParseTail(0x1); + float newHeight = 1.9f; + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); + SceneObjectPart part = so.RootPart; + m_scene.AddSceneObject(so); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + osslApi.osOwnerSaveAppearance(notecardName); + + // Try creating a bot using the existing avatar's appearance + string npcRaw = osslApi.osNpcCreate("Jane", "Doe", new LSL_Types.Vector3(128, 128, 128), sp.UUID.ToString()); + Assert.That(npcRaw, Is.Not.Null); + + UUID npcId = new UUID(npcRaw); + ScenePresence npc = m_scene.GetScenePresence(npcId); + Assert.That(npc, Is.Not.Null); + Assert.That(npc.Appearance.AvatarHeight, Is.EqualTo(newHeight)); + } [Test] public void TestOsOwnerSaveAppearance() diff --git a/prebuild.xml b/prebuild.xml index dff54a3e9e..411ceb051d 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3143,11 +3143,13 @@ + + From b1ae930c6b8e7d985e2c148a4e18a59ac880dcbd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 22:26:47 +0100 Subject: [PATCH 40/90] Implement osAgentSaveAppearance() to save the appearance of an avatar in the region to a notecard This is separate from osOwnerSaveAppearance() so that owner saves can be allowed without allowing arbitrary avatar saves --- .../Shared/Api/Implementation/OSSL_Api.cs | 35 ++++++++++++++-- .../Shared/Api/Interface/IOSSL_Api.cs | 2 +- .../Shared/Api/Runtime/OSSL_Stub.cs | 5 +++ .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 41 +++++++++++++++++++ 4 files changed, 78 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b18aa3b839..939602a178 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2165,7 +2165,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID npcId = new UUID(npc.m_string); + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return new LSL_Key(UUID.Zero.ToString()); if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); @@ -2273,14 +2275,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); } - protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecardName) + { + CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); + + return SaveAppearanceToNotecard(avatarId, notecardName); + } + + protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecardName) { IAvatarFactory appearanceModule = World.RequestModuleInterface(); if (appearanceModule != null) { - appearanceModule.SaveBakedTextures(m_host.OwnerID); - ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); + appearanceModule.SaveBakedTextures(sp.UUID); OSDMap appearancePacked = sp.Appearance.Pack(); TaskInventoryItem item @@ -2293,6 +2301,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Key(UUID.Zero.ToString()); } } + + protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + { + ScenePresence sp = World.GetScenePresence(avatarId); + + if (sp == null || sp.IsChildAgent) + return new LSL_Key(UUID.Zero.ToString()); + + return SaveAppearanceToNotecard(sp, notecardName); + } + + protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecardName) + { + UUID avatarId; + if (!UUID.TryParse(rawAvatarId, out avatarId)) + return new LSL_Key(UUID.Zero.ToString()); + + return SaveAppearanceToNotecard(avatarId, notecardName); + } /// /// Get current region's map texture UUID diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index f4a618b78f..88e1f15ce4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -168,7 +168,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); - key osNpcCreate(string user, string name, vector position, key cloneFrom); LSL_Key osNpcSaveAppearance(key npc, string notecardName); void osNpcLoadAppearance(key npc, string notecardNameOrUuid); @@ -179,6 +178,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcRemove(key npc); LSL_Key osOwnerSaveAppearance(string notecardName); + LSL_Key osAgentSaveAppearance(key agentId, string notecardName); key osGetMapTexture(); key osGetRegionMapTexture(string regionName); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 84d61f4895..4701736ca5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -523,6 +523,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osOwnerSaveAppearance(notecardName); } + public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecardName) + { + return m_OSSL_Functions.osAgentSaveAppearance(agentId, notecardName); + } + public OSSLPrim Prim; [Serializable] diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 7f778d7478..85cf507292 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -184,5 +184,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); } + + [Test] + public void TestOsAgentSaveAppearance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID ownerId = TestHelpers.ParseTail(0x1); + UUID nonOwnerId = TestHelpers.ParseTail(0x2); + float newHeight = 1.9f; + + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, nonOwnerId); + sp.Appearance.AvatarHeight = newHeight; + SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); + SceneObjectPart part = so.RootPart; + m_scene.AddSceneObject(so); + + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, part, part.LocalId, part.UUID); + + string notecardName = "appearanceNc"; + + osslApi.osAgentSaveAppearance(new LSL_Types.LSLString(nonOwnerId.ToString()), notecardName); + + IList items = part.Inventory.GetInventoryItems(notecardName); + Assert.That(items.Count, Is.EqualTo(1)); + + TaskInventoryItem ncItem = items[0]; + Assert.That(ncItem.Name, Is.EqualTo(notecardName)); + + AssetBase ncAsset = m_scene.AssetService.Get(ncItem.AssetID.ToString()); + Assert.That(ncAsset, Is.Not.Null); + + AssetNotecard anc = new AssetNotecard(UUID.Zero, ncAsset.Data); + anc.Decode(); + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(anc.BodyText); + AvatarAppearance savedAppearance = new AvatarAppearance(); + savedAppearance.Unpack(appearanceOsd); + + Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight)); + } } } \ No newline at end of file From a21e98ae1a3e2f570cc119e020d4d4ea111e0ad2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 23:28:14 +0100 Subject: [PATCH 41/90] implement osNpcGetRot() and osNpcSetRot() Rotation works if done around the z axis. Anything else leads to random results. --- .../Shared/Api/Implementation/LSL_Api.cs | 3 +- .../Shared/Api/Implementation/OSSL_Api.cs | 57 +++++++++++++++++-- .../Shared/Api/Interface/IOSSL_Api.cs | 2 + .../Shared/Api/Runtime/OSSL_Stub.cs | 10 ++++ 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 86ee28aeb4..8a281d4a28 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -369,7 +369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // convert a LSL_Rotation to a Quaternion - protected Quaternion Rot2Quaternion(LSL_Rotation r) + public static Quaternion Rot2Quaternion(LSL_Rotation r) { Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); q.Normalize(); @@ -2061,6 +2061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return llGetRootRotation(); } + m_host.AddScriptLPS(1); Quaternion q = m_host.GetWorldRotation(); return new LSL_Rotation(q.X, q.Y, q.Z, q.W); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 939602a178..1874826ee2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2186,9 +2186,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID npcId = new UUID(npc.m_string); - - if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) return; string appearanceSerialized = LoadNotecard(notecardNameOrUuid); @@ -2210,8 +2209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return; + Vector3 pos = new Vector3((float) position.x, (float) position.y, (float) position.z); - module.MoveToTarget(new UUID(npc.m_string), World, pos, false, true); + module.MoveToTarget(npcId, World, pos, false, true); } } @@ -2222,6 +2225,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api INPCModule module = World.RequestModuleInterface(); if (module != null) { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return; + Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); module.MoveToTarget( new UUID(npc.m_string), @@ -2232,6 +2239,48 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_Rotation osNpcGetRot(LSL_Key npc) + { + CheckThreatLevel(ThreatLevel.High, "osNpcGetRot"); + + INPCModule npcModule = World.RequestModuleInterface(); + if (npcModule != null) + { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); + + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); + + ScenePresence sp = World.GetScenePresence(npcId); + Quaternion rot = sp.Rotation; + + return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); + } + + return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); + } + + public void osNpcSetRot(LSL_Key npc, LSL_Rotation rotation) + { + CheckThreatLevel(ThreatLevel.High, "osNpcSetRot"); + + INPCModule npcModule = World.RequestModuleInterface(); + if (npcModule != null) + { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return; + + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + return; + + ScenePresence sp = World.GetScenePresence(npcId); + sp.Rotation = LSL_Api.Rot2Quaternion(rotation); + } + } + public void osNpcStopMoveTo(LSL_Key npc) { CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 88e1f15ce4..7c08e84ad8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,6 +173,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcLoadAppearance(key npc, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); void osNpcMoveToTarget(key npc, vector position, int options); + rotation osNpcGetRot(key npc); + void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 4701736ca5..e8e5f52e74 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -503,6 +503,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); } + public rotation osNpcGetRot(key npc) + { + return m_OSSL_Functions.osNpcGetRot(npc); + } + + public void osNpcSetRot(key npc, rotation rot) + { + m_OSSL_Functions.osNpcSetRot(npc, rot); + } + public void osNpcStopMoveTo(LSL_Key npc) { m_OSSL_Functions.osNpcStopMoveTo(npc); From d23d37d2aa7c5a3d9c6ec1726aef7941d5e52519 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Aug 2011 23:36:22 +0100 Subject: [PATCH 42/90] implement osNpcGetPos() --- .../Shared/Api/Implementation/OSSL_Api.cs | 21 +++++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 1874826ee2..b1066b55e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2202,6 +2202,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public LSL_Vector osNpcGetPos(LSL_Key npc) + { + CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); + + INPCModule npcModule = World.RequestModuleInterface(); + if (npcModule != null) + { + UUID npcId; + if (!UUID.TryParse(npc.m_string, out npcId)) + return new LSL_Vector(0, 0, 0); + + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) + return new LSL_Vector(0, 0, 0); + + Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; + return new LSL_Vector(pos.X, pos.Y, pos.Z); + } + + return new LSL_Vector(0, 0, 0); + } + public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 7c08e84ad8..9f0d07c8d3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -171,6 +171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osNpcCreate(string user, string name, vector position, key cloneFrom); LSL_Key osNpcSaveAppearance(key npc, string notecardName); void osNpcLoadAppearance(key npc, string notecardNameOrUuid); + vector osNpcGetPos(key npc); void osNpcMoveTo(key npc, vector position); void osNpcMoveToTarget(key npc, vector position, int options); rotation osNpcGetRot(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e8e5f52e74..3ccb3f17c2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -493,6 +493,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); } + public vector osNpcGetPos(LSL_Key npc) + { + return m_OSSL_Functions.osNpcGetPos(npc); + } + public void osNpcMoveTo(key npc, vector position) { m_OSSL_Functions.osNpcMoveTo(npc, position); From 0a1bbc27d26a430c53e84e22b7aad0df2f1f4a09 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 00:14:06 +0100 Subject: [PATCH 43/90] Allow the osNpcCreate() function to accept a notecard name or asset for initial appearance --- .../Shared/Api/Implementation/OSSL_Api.cs | 28 ++++++++++++++++--- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 4 +-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b1066b55e9..90c4636322 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2130,20 +2130,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) { CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); - //QueueUserWorkItem INPCModule module = World.RequestModuleInterface(); if (module != null) { - ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); - if (clonePresence == null) + AvatarAppearance appearance = null; + + UUID cloneId; + if (UUID.TryParse(cloneFrom, out cloneId)) + { + ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); + if (clonePresence != null) + appearance = clonePresence.Appearance; + } + + if (appearance == null) + { + string appearanceSerialized = LoadNotecard(cloneFrom.m_string); + + if (appearanceSerialized != null) + { + OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); + appearance = new AvatarAppearance(); + appearance.Unpack(appearanceOsd); + } + } + + if (appearance == null) return new LSL_Key(UUID.Zero.ToString()); UUID x = module.CreateNPC(firstname, lastname, new Vector3((float) position.x, (float) position.y, (float) position.z), World, - clonePresence.Appearance); + appearance); return new LSL_Key(x.ToString()); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 85cf507292..7573dfff5f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -78,11 +78,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests /// /// Test creation of an NPC where the appearance data comes from a notecard /// - //[Test] + [Test] public void TestOsNpcCreateFromNotecard() { TestHelpers.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); // Store an avatar with a different height from default in a notecard. UUID userId = TestHelpers.ParseTail(0x1); From 65c4b8d37b304c4b6c09c0c4b07184c4a7ffda7d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 00:51:05 +0100 Subject: [PATCH 44/90] Fix kicking of NPCs via "kick user" console command. Needed to hook up the Close() function in the NPCAvatar IClientAPI implementation, which [unfortunately] is still needed --- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index d63c2a6705..44415790ec 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -842,6 +842,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void Close() { + // Remove ourselves from the scene + m_scene.RemoveClient(AgentId, false); } public void Start() From 2169cf04f92a6465fe9cd58a2bac0d1380a561bd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 01:24:15 +0100 Subject: [PATCH 45/90] When saving appearance, only save the baked textures, not the other face textures (which are already stored permanently) --- .../AvatarFactory/AvatarFactoryModule.cs | 50 ++++++++++++++++--- .../OptionalModules/World/NPC/NPCAvatar.cs | 2 +- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 75d8143edc..4627701fb8 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -271,16 +271,30 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory "[AV FACTORY]: Permanently saving baked textures for {0} in {1}", sp.Name, m_scene.RegionInfo.RegionName); - for (int i = 0; i < faceTextures.Length; i++) + foreach (int i in Enum.GetValues(typeof(BakeType))) { + BakeType bakeType = (BakeType)i; + + if (bakeType == BakeType.Unknown) + continue; + // m_log.DebugFormat( // "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); - if (faceTextures[i] == null) - continue; + int ftIndex = (int)AppearanceManager.BakeTypeToAgentTextureIndex(bakeType); + Primitive.TextureEntryFace bakedTextureFace = faceTextures[ftIndex]; - AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString()); + if (bakedTextureFace == null) + { + m_log.WarnFormat( + "[AV FACTORY]: No texture ID set for {0} for {1} in {2} not found when trying to save permanently", + bakeType, sp.Name, m_scene.RegionInfo.RegionName); + + continue; + } + + AssetBase asset = m_scene.AssetService.Get(bakedTextureFace.TextureID.ToString()); if (asset != null) { @@ -290,11 +304,35 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory else { m_log.WarnFormat( - "[AV FACTORY]: Baked texture {0} for {1} in {2} unexpectedly not found when trying to save permanently", - faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName); + "[AV FACTORY]: Baked texture id {0} not found for bake {1} for avatar {2} in {3} when trying to save permanently", + bakedTextureFace.TextureID, bakeType, sp.Name, m_scene.RegionInfo.RegionName); } } +// for (int i = 0; i < faceTextures.Length; i++) +// { +//// m_log.DebugFormat( +//// "[AVFACTORY]: NPC avatar {0} has texture id {1} : {2}", +//// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); +// +// if (faceTextures[i] == null) +// continue; +// +// AssetBase asset = m_scene.AssetService.Get(faceTextures[i].TextureID.ToString()); +// +// if (asset != null) +// { +// asset.Temporary = false; +// m_scene.AssetService.Store(asset); +// } +// else +// { +// m_log.WarnFormat( +// "[AV FACTORY]: Baked texture {0} for {1} in {2} not found when trying to save permanently", +// faceTextures[i].TextureID, sp.Name, m_scene.RegionInfo.RegionName); +// } +// } + return true; } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 44415790ec..31e79fa449 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -843,7 +843,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void Close() { // Remove ourselves from the scene - m_scene.RemoveClient(AgentId, false); + m_scene.RemoveClient(AgentId, false); } public void Start() From aebd46a4348cf55d25eaa56325940a0f33d8b8fe Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 01:32:49 +0100 Subject: [PATCH 46/90] rename osNpcStopMoveTo() to osNpcStopMoveToTarget() --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 90c4636322..07473e57fa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2322,7 +2322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osNpcStopMoveTo(LSL_Key npc) + public void osNpcStopMoveToTarget(LSL_Key npc) { CheckThreatLevel(ThreatLevel.VeryLow, "osNpcStopMoveTo"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 9f0d07c8d3..2ba68ff449 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -176,7 +176,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcMoveToTarget(key npc, vector position, int options); rotation osNpcGetRot(key npc); void osNpcSetRot(LSL_Key npc, rotation rot); - void osNpcStopMoveTo(LSL_Key npc); + void osNpcStopMoveToTarget(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 3ccb3f17c2..140501c36b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -518,9 +518,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcSetRot(npc, rot); } - public void osNpcStopMoveTo(LSL_Key npc) + public void osNpcStopMoveToTarget(LSL_Key npc) { - m_OSSL_Functions.osNpcStopMoveTo(npc); + m_OSSL_Functions.osNpcStopMoveToTarget(npc); } public void osNpcSay(key npc, string message) From 16ac5413ddb57ac347addebc82d425364a083637 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 01:52:12 +0100 Subject: [PATCH 47/90] rename position parameter in osNpcMoveToTarget to target --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 07473e57fa..2e28907877 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2259,7 +2259,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int options) + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector target, int options) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); @@ -2270,7 +2270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(npc.m_string, out npcId)) return; - Vector3 pos = new Vector3((float)position.x, (float)position.y, (float)position.z); + Vector3 pos = new Vector3((float)target.x, (float)target.y, (float)target.z); module.MoveToTarget( new UUID(npc.m_string), World, diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 2ba68ff449..1f3454feb0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcLoadAppearance(key npc, string notecardNameOrUuid); vector osNpcGetPos(key npc); void osNpcMoveTo(key npc, vector position); - void osNpcMoveToTarget(key npc, vector position, int options); + void osNpcMoveToTarget(key npc, vector target, int options); rotation osNpcGetRot(key npc); void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcStopMoveToTarget(LSL_Key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 140501c36b..13cf7fae1e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -503,9 +503,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } - public void osNpcMoveToTarget(key npc, vector position, int options) + public void osNpcMoveToTarget(key npc, vector target, int options) { - m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); + m_OSSL_Functions.osNpcMoveToTarget(npc, target, options); } public rotation osNpcGetRot(key npc) From 76e0afe83f012e451a66a145c50e79c1bd047f37 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 02:46:44 +0100 Subject: [PATCH 48/90] tidy up some OSSL NPC parameter names --- .../Shared/Api/Implementation/OSSL_Api.cs | 42 +++++++++---------- .../Shared/Api/Interface/IOSSL_Api.cs | 10 ++--- .../Shared/Api/Runtime/OSSL_Stub.cs | 16 +++---- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 2e28907877..d791885ea3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2127,7 +2127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return retVal; } - public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, LSL_Key cloneFrom) + public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) { CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); @@ -2136,17 +2136,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { AvatarAppearance appearance = null; - UUID cloneId; - if (UUID.TryParse(cloneFrom, out cloneId)) + UUID id; + if (UUID.TryParse(notecard, out id)) { - ScenePresence clonePresence = World.GetScenePresence(new UUID(cloneFrom.m_string)); + ScenePresence clonePresence = World.GetScenePresence(id); if (clonePresence != null) appearance = clonePresence.Appearance; } if (appearance == null) { - string appearanceSerialized = LoadNotecard(cloneFrom.m_string); + string appearanceSerialized = LoadNotecard(notecard); if (appearanceSerialized != null) { @@ -2175,9 +2175,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// Save the current appearance of the NPC permanently to the named notecard. /// /// - /// The name of the notecard to which to save the appearance. + /// The name of the notecard to which to save the appearance. /// The asset ID of the notecard saved. - public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecardName) + public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecard) { CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); @@ -2192,13 +2192,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(npcId, notecardName); + return SaveAppearanceToNotecard(npcId, notecard); } return new LSL_Key(UUID.Zero.ToString()); } - public void osNpcLoadAppearance(LSL_Key npc, string notecardNameOrUuid) + public void osNpcLoadAppearance(LSL_Key npc, string notecard) { CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); @@ -2210,7 +2210,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(npc.m_string, out npcId)) return; - string appearanceSerialized = LoadNotecard(notecardNameOrUuid); + string appearanceSerialized = LoadNotecard(notecard); OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); // Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); @@ -2356,23 +2356,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// Save the current appearance of the script owner permanently to the named notecard. /// - /// The name of the notecard to which to save the appearance. + /// The name of the notecard to which to save the appearance. /// The asset ID of the notecard saved. - public LSL_Key osOwnerSaveAppearance(string notecardName) + public LSL_Key osOwnerSaveAppearance(string notecard) { CheckThreatLevel(ThreatLevel.High, "osOwnerSaveAppearance"); - return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); + return SaveAppearanceToNotecard(m_host.OwnerID, notecard); } - public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecardName) + public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecard) { CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); - return SaveAppearanceToNotecard(avatarId, notecardName); + return SaveAppearanceToNotecard(avatarId, notecard); } - protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecardName) + protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecard) { IAvatarFactory appearanceModule = World.RequestModuleInterface(); @@ -2382,7 +2382,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api OSDMap appearancePacked = sp.Appearance.Pack(); TaskInventoryItem item - = SaveNotecard(notecardName, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); + = SaveNotecard(notecard, "Avatar Appearance", Util.GetFormattedXml(appearancePacked as OSD), true); return new LSL_Key(item.AssetID.ToString()); } @@ -2392,23 +2392,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) + protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecard) { ScenePresence sp = World.GetScenePresence(avatarId); if (sp == null || sp.IsChildAgent) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(sp, notecardName); + return SaveAppearanceToNotecard(sp, notecard); } - protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecardName) + protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecard) { UUID avatarId; if (!UUID.TryParse(rawAvatarId, out avatarId)) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(avatarId, notecardName); + return SaveAppearanceToNotecard(avatarId, notecard); } /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 1f3454feb0..87cfe1a473 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -168,9 +168,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); - key osNpcCreate(string user, string name, vector position, key cloneFrom); - LSL_Key osNpcSaveAppearance(key npc, string notecardName); - void osNpcLoadAppearance(key npc, string notecardNameOrUuid); + key osNpcCreate(string user, string name, vector position, string notecard); + LSL_Key osNpcSaveAppearance(key npc, string notecard); + void osNpcLoadAppearance(key npc, string notecard); vector osNpcGetPos(key npc); void osNpcMoveTo(key npc, vector position); void osNpcMoveToTarget(key npc, vector target, int options); @@ -180,8 +180,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcSay(key npc, string message); void osNpcRemove(key npc); - LSL_Key osOwnerSaveAppearance(string notecardName); - LSL_Key osAgentSaveAppearance(key agentId, string notecardName); + LSL_Key osOwnerSaveAppearance(string notecard); + LSL_Key osAgentSaveAppearance(key agentId, string notecard); key osGetMapTexture(); key osGetRegionMapTexture(string regionName); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 13cf7fae1e..bbc8cc6029 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -483,14 +483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); } - public key osNpcSaveAppearance(key npc, string notecardName) + public key osNpcSaveAppearance(key npc, string notecard) { - return m_OSSL_Functions.osNpcSaveAppearance(npc, notecardName); + return m_OSSL_Functions.osNpcSaveAppearance(npc, notecard); } - public void osNpcLoadAppearance(key npc, string notecardNameOrUuid) + public void osNpcLoadAppearance(key npc, string notecard) { - m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); + m_OSSL_Functions.osNpcLoadAppearance(npc, notecard); } public vector osNpcGetPos(LSL_Key npc) @@ -533,14 +533,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcRemove(npc); } - public LSL_Key osOwnerSaveAppearance(string notecardName) + public LSL_Key osOwnerSaveAppearance(string notecard) { - return m_OSSL_Functions.osOwnerSaveAppearance(notecardName); + return m_OSSL_Functions.osOwnerSaveAppearance(notecard); } - public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecardName) + public LSL_Key osAgentSaveAppearance(LSL_Key agentId, string notecard) { - return m_OSSL_Functions.osAgentSaveAppearance(agentId, notecardName); + return m_OSSL_Functions.osAgentSaveAppearance(agentId, notecard); } public OSSLPrim Prim; From 4b88f04c0afd36f9e88680bbafb7ccc4680fd504 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 22:46:42 +0100 Subject: [PATCH 49/90] minor: On "login disable/enable" always tell the user the final login status, rather than remaining silent if it was already on/off --- OpenSim/Region/CoreModules/World/Access/AccessModule.cs | 6 ++---- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index c355b13d1f..b5e1fd9909 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -129,13 +129,11 @@ namespace OpenSim.Region.CoreModules.World switch (cmd[1]) { case "enable": - if (scene.LoginsDisabled) - MainConsole.Instance.Output(String.Format("Enabling logins for region {0}", scene.RegionInfo.RegionName)); + MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = false; break; case "disable": - if (!scene.LoginsDisabled) - MainConsole.Instance.Output(String.Format("Disabling logins for region {0}", scene.RegionInfo.RegionName)); + MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = true; break; case "status": diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index c764c20f12..11fda6df1e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -105,9 +105,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC } else { - m_log.DebugFormat( - "[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}", - presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); +// m_log.DebugFormat( +// "[NPC MODULE]: Updating npc {0} at {1} for next movement to {2}", +// presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); presence.HandleMoveToTargetUpdate(ref agent_control_v3); From ed142ead25834f6ce77585262a69f873db03a393 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 22:50:58 +0100 Subject: [PATCH 50/90] minor: change login enable/disable messages in last commit so that they occur after the setting has been made --- OpenSim/Region/CoreModules/World/Access/AccessModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs index b5e1fd9909..2399134349 100644 --- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs +++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs @@ -129,12 +129,12 @@ namespace OpenSim.Region.CoreModules.World switch (cmd[1]) { case "enable": - MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = false; + MainConsole.Instance.Output(String.Format("Logins are enabled for region {0}", scene.RegionInfo.RegionName)); break; case "disable": - MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); scene.LoginsDisabled = true; + MainConsole.Instance.Output(String.Format("Logins are disabled for region {0}", scene.RegionInfo.RegionName)); break; case "status": if (scene.LoginsDisabled) From 78ff82bfe9728b83a56e315522ee33961abe9a9d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Aug 2011 23:40:22 +0100 Subject: [PATCH 51/90] If a map request to a server fails, always close the outbound connection. This probably doesn't help with the current memory leak. --- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index fac2dabd1e..7b00597171 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -682,7 +682,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap mapitemsrequest.ContentLength = buffer.Length; //Count bytes to send os = mapitemsrequest.GetRequestStream(); os.Write(buffer, 0, buffer.Length); //Send it - os.Close(); //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver); } catch (WebException ex) @@ -705,6 +704,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap responseMap["connect"] = OSD.FromBoolean(false); return responseMap; } + finally + { + if (os != null) + os.Close(); + } string response_mapItems_reply = null; { // get the response From 90c6fa89bea62f97376222f8251d576fa9af1298 Mon Sep 17 00:00:00 2001 From: Aaron Duffy Date: Sat, 6 Aug 2011 22:34:41 -0600 Subject: [PATCH 52/90] Fix a bug preventing region modules from creating trees at anything but the default scale. --- .../Region/CoreModules/World/Vegetation/VegetationModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs index c2ad7b8c38..ab8e1bf0b7 100644 --- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs +++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs @@ -100,15 +100,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation { case Tree.Cypress1: case Tree.Cypress2: - tree.Scale = new Vector3(4, 4, 10); + tree.Scale *= new Vector3(8, 8, 20); break; // case... other tree types - // tree.Scale = new Vector3(?, ?, ?); + // tree.Scale *= new Vector3(?, ?, ?); // break; default: - tree.Scale = new Vector3(4, 4, 4); + tree.Scale *= new Vector3(8, 8, 8); break; } } From d0bcaf1f16134d8d6f267744d8bcd1bace5d897f Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Mon, 8 Aug 2011 20:31:37 -0500 Subject: [PATCH 53/90] llGetPrimitveParams fix prim hollow/hole shape return value --- prebuild.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuild.xml b/prebuild.xml index 411ceb051d..b56c5b506e 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3146,6 +3146,7 @@ + From 77625dae36f7a843cb347d7e9f47d6bd00f85379 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 13 Aug 2011 01:13:17 +0100 Subject: [PATCH 54/90] Revert "llGetPrimitveParams fix prim hollow/hole shape return value" This reverts commit d0bcaf1f16134d8d6f267744d8bcd1bace5d897f. Accidentally applied only the prebuild.xml conflict fix. But the full application seems to generate a regression test error anyway. --- prebuild.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/prebuild.xml b/prebuild.xml index b56c5b506e..411ceb051d 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3146,7 +3146,6 @@ - From dcb4b2de09032380fb428f73d9e3fd10aa662377 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 13 Aug 2011 15:16:43 +0100 Subject: [PATCH 55/90] Fix a problem in the Flotsam asset cache where assets were being put into the memory cache even when it wasn't enabled. This hopefully addresses http://opensimulator.org/mantis/view.php?id=5634 This is the most probable cause of the memory problems that people have been seeing in the past month. This bug has been around since commit 5dc785b (4th July 2011). Doh! This is why regressions tests are such a good idea... :) Many thanks to Nebadon for using git bisect to track down this bug, which made it a 5 minute fix. --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 7ef759ccb2..abfc771498 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -357,8 +357,6 @@ namespace Flotsam.RegionModules.AssetCache asset = (AssetBase)bformatter.Deserialize(stream); - UpdateMemoryCache(id, asset); - m_DiskHits++; } catch (System.Runtime.Serialization.SerializationException e) @@ -419,9 +417,15 @@ namespace Flotsam.RegionModules.AssetCache if (m_MemoryCacheEnabled) asset = GetFromMemoryCache(id); + if (asset == null && m_FileCacheEnabled) + { asset = GetFromFileCache(id); + if (m_MemoryCacheEnabled && asset != null) + UpdateMemoryCache(id, asset); + } + if (((m_LogLevel >= 1)) && (m_HitRateDisplay != 0) && (m_Requests % m_HitRateDisplay == 0)) { m_HitRateFile = (double)m_DiskHits / m_Requests * 100.0; From b80dfb6572438cb583e95884c0f607342f0c88d4 Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Fri, 12 Aug 2011 21:09:01 -0500 Subject: [PATCH 56/90] llGetPrimitiveParams fix prim hollow/hole shape value --- .../Shared/Api/Implementation/LSL_Api.cs | 6 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 175 ++++++++++++++++++ prebuild.xml | 1 + 3 files changed, 179 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8a281d4a28..c84afeeebd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7650,7 +7650,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_TYPE_BOX: case ScriptBaseClass.PRIM_TYPE_CYLINDER: case ScriptBaseClass.PRIM_TYPE_PRISM: - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); @@ -7659,7 +7659,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; case ScriptBaseClass.PRIM_TYPE_SPHERE: - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); @@ -7675,7 +7675,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_TYPE_TUBE: case ScriptBaseClass.PRIM_TYPE_TORUS: // holeshape - res.Add(new LSL_Integer(Shape.ProfileCurve)); + res.Add(new LSL_Integer(Shape.ProfileCurve) & 0xf0); // Isolate hole shape nibble. // cut res.Add(new LSL_Vector(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 3f37ec7fa3..623c82dd35 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -27,11 +27,13 @@ using System.Collections.Generic; using NUnit.Framework; +using OpenSim.Framework; using OpenSim.Tests.Common; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.Framework.Scenes; using Nini.Config; using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenMetaverse; using System; using OpenSim.Tests.Common.Mock; @@ -47,6 +49,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests private const double ANGLE_ACCURACY_IN_RADIANS = 1E-6; private const double VECTOR_COMPONENT_ACCURACY = 0.0000005d; + private const double FLOAT_ACCURACY = 0.00005d; private LSL_Api m_lslApi; [SetUp] @@ -165,6 +168,178 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests Assert.Less(eulerCalc.z, eulerCheck.z + ANGLE_ACCURACY_IN_RADIANS, "TestllRot2Euler Z upper bounds check fail"); } + [Test] + // llSetPrimitiveParams and llGetPrimitiveParams test. + public void TestllSetPrimitiveParams() + { + // Create Prim1. + Scene scene = SceneHelpers.SetupScene(); + string obj1Name = "Prim1"; + UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); + SceneObjectPart part1 = + new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, + Vector3.Zero, Quaternion.Identity, + Vector3.Zero) { Name = obj1Name, UUID = objUuid }; + Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True); + + // Test a sphere. + CheckllSetPrimitiveParams( + "test 1", // Prim test identification string + new LSL_Types.Vector3(6.0d, 9.9d, 9.9d), // Prim size + ScriptBaseClass.PRIM_TYPE_SPHERE, // Prim type + ScriptBaseClass.PRIM_HOLE_DEFAULT, // Prim hole type + new LSL_Types.Vector3(0.0d, 0.075d, 0.0d), // Prim cut + 0.80d, // Prim hollow + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(0.32d, 0.76d, 0.0d)); // Prim dimple + + // Test a prism. + CheckllSetPrimitiveParams( + "test 2", // Prim test identification string + new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size + ScriptBaseClass.PRIM_TYPE_PRISM, // Prim type + ScriptBaseClass.PRIM_HOLE_CIRCLE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.90d, // Prim hollow + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(2.0d, 1.0d, 0.0d), // Prim taper + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + + // Test a box. + CheckllSetPrimitiveParams( + "test 3", // Prim test identification string + new LSL_Types.Vector3(3.5d, 3.5d, 3.5d), // Prim size + ScriptBaseClass.PRIM_TYPE_BOX, // Prim type + ScriptBaseClass.PRIM_HOLE_TRIANGLE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.90d, // Prim hollow + new LSL_Types.Vector3(1.0d, 0.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(1.0d, 1.0d, 0.0d), // Prim taper + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d)); // Prim shear + + // Test a tube. + CheckllSetPrimitiveParams( + "test 4", // Prim test identification string + new LSL_Types.Vector3(4.2d, 4.2d, 4.2d), // Prim size + ScriptBaseClass.PRIM_TYPE_TUBE, // Prim type + ScriptBaseClass.PRIM_HOLE_SQUARE, // Prim hole type + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim cut + 0.00d, // Prim hollow + new LSL_Types.Vector3(1.0d, -1.0d, 0.0d), // Prim twist + new LSL_Types.Vector3(1.0d, 0.5d, 0.0d), // Prim hole size + new LSL_Types.Vector3(0.0d, 0.0d, 0.0d), // Prim shear + new LSL_Types.Vector3(0.0d, 1.0d, 0.0d), // Prim profile cut + new LSL_Types.Vector3(-1.0d, 1.0d, 0.0d), // Prim taper + 1.0d, // Prim revolutions + 1.0d, // Prim radius + 0.0d); // Prim skew + } + + // Set prim params for a box, cylinder or prism and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primTaper, LSL_Types.Vector3 primShear) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primHoleType, + primCut, primHollow, primTwist, primTaper, primShear)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Validate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); + CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); + Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); + CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); + CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 6), primTest + " prim taper"); + CheckllSetPrimitiveParamsVector(primShear, m_lslApi.llList2Vector(primParams, 7), primTest + " prim shear"); + } + + // Set prim params for a sphere and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primDimple) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primHoleType, + primCut, primHollow, primTwist, primDimple)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Validate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); + CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); + Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); + CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); + CheckllSetPrimitiveParamsVector(primDimple, m_lslApi.llList2Vector(primParams, 6), primTest + " prim dimple"); + } + + // Set prim params for a torus, tube or ring and check results. + public void CheckllSetPrimitiveParams(string primTest, + LSL_Types.Vector3 primSize, int primType, int primHoleType, LSL_Types.Vector3 primCut, + double primHollow, LSL_Types.Vector3 primTwist, LSL_Types.Vector3 primHoleSize, + LSL_Types.Vector3 primShear, LSL_Types.Vector3 primProfCut, LSL_Types.Vector3 primTaper, + double primRev, double primRadius, double primSkew) + { + // Set the prim params. + m_lslApi.llSetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, primSize, + ScriptBaseClass.PRIM_TYPE, primType, primHoleType, + primCut, primHollow, primTwist, primHoleSize, primShear, primProfCut, + primTaper, primRev, primRadius, primSkew)); + + // Get params for prim to validate settings. + LSL_Types.list primParams = + m_lslApi.llGetPrimitiveParams(new LSL_Types.list(ScriptBaseClass.PRIM_SIZE, ScriptBaseClass.PRIM_TYPE)); + + // Valdate settings. + CheckllSetPrimitiveParamsVector(primSize, m_lslApi.llList2Vector(primParams, 0), primTest + " prim size"); + Assert.AreEqual(primType, m_lslApi.llList2Integer(primParams, 1), + "TestllSetPrimitiveParams " + primTest + " prim type check fail"); + Assert.AreEqual(primHoleType, m_lslApi.llList2Integer(primParams, 2), + "TestllSetPrimitiveParams " + primTest + " prim hole default check fail"); + CheckllSetPrimitiveParamsVector(primCut, m_lslApi.llList2Vector(primParams, 3), primTest + " prim cut"); + Assert.AreEqual(primHollow, m_lslApi.llList2Float(primParams, 4), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim hollow check fail"); + CheckllSetPrimitiveParamsVector(primTwist, m_lslApi.llList2Vector(primParams, 5), primTest + " prim twist"); + CheckllSetPrimitiveParamsVector(primHoleSize, m_lslApi.llList2Vector(primParams, 6), primTest + " prim hole size"); + CheckllSetPrimitiveParamsVector(primShear, m_lslApi.llList2Vector(primParams, 7), primTest + " prim shear"); + CheckllSetPrimitiveParamsVector(primProfCut, m_lslApi.llList2Vector(primParams, 8), primTest + " prim profile cut"); + CheckllSetPrimitiveParamsVector(primTaper, m_lslApi.llList2Vector(primParams, 9), primTest + " prim taper"); + Assert.AreEqual(primRev, m_lslApi.llList2Float(primParams, 10), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim revolution fail"); + Assert.AreEqual(primRadius, m_lslApi.llList2Float(primParams, 11), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim radius fail"); + Assert.AreEqual(primSkew, m_lslApi.llList2Float(primParams, 12), FLOAT_ACCURACY, + "TestllSetPrimitiveParams " + primTest + " prim skew fail"); + } + + public void CheckllSetPrimitiveParamsVector(LSL_Types.Vector3 vecCheck, LSL_Types.Vector3 vecReturned, string msg) + { + // Check each vector component against expected result. + Assert.AreEqual(vecCheck.x, vecReturned.x, VECTOR_COMPONENT_ACCURACY, + "TestllSetPrimitiveParams " + msg + " vector check fail on x component"); + Assert.AreEqual(vecCheck.y, vecReturned.y, VECTOR_COMPONENT_ACCURACY, + "TestllSetPrimitiveParams " + msg + " vector check fail on y component"); + Assert.AreEqual(vecCheck.z, vecReturned.z, VECTOR_COMPONENT_ACCURACY, + "TestllSetPrimitiveParams " + msg + " vector check fail on z component"); + } + [Test] // llVecNorm test. public void TestllVecNorm() diff --git a/prebuild.xml b/prebuild.xml index 411ceb051d..b56c5b506e 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3146,6 +3146,7 @@ + From e19843a0ee6deb1f9f96a954c97c011b3110aac0 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Sun, 14 Aug 2011 17:45:23 +0200 Subject: [PATCH 57/90] WorldMap: Added map item for Land-for-Sale. Implemented backlist item timeouts (default 10 minutes; see also new config file setting BlacklistTimeout) and removing backlisted neigboring regions that have been restarted from the blacklist. --- .../World/WorldMap/WorldMapModule.cs | 210 ++++++++++++++++-- bin/OpenSimDefaults.ini | 3 + 2 files changed, 192 insertions(+), 21 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 7b00597171..710230abdc 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -46,6 +46,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.CoreModules.World.Land; using Caps=OpenSim.Framework.Capabilities.Caps; using OSDArray=OpenMetaverse.StructuredData.OSDArray; using OSDMap=OpenMetaverse.StructuredData.OSDMap; @@ -68,6 +69,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap protected Scene m_scene; private List cachedMapBlocks = new List(); private int cachedTime = 0; + private int blacklistTimeout = 10*60*1000; // 10 minutes private byte[] myMapImageJPEG; protected volatile bool m_Enabled = false; private Dictionary m_openRequests = new Dictionary(); @@ -85,6 +87,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap IConfig startupConfig = config.Configs["Startup"]; if (startupConfig.GetString("WorldMapModule", "WorldMap") == "WorldMap") m_Enabled = true; + + blacklistTimeout = startupConfig.GetInt("BlacklistTimeout", 10*60) * 1000; } public virtual void AddRegion (Scene scene) @@ -159,11 +163,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap m_scene.EventManager.OnClientClosed += ClientLoggedOut; m_scene.EventManager.OnMakeChildAgent += MakeChildAgent; m_scene.EventManager.OnMakeRootAgent += MakeRootAgent; + m_scene.EventManager.OnRegionUp += OnRegionUp; + + StartThread(new object()); } // this has to be called with a lock on m_scene protected virtual void RemoveHandlers() { + StopThread(); + + m_scene.EventManager.OnRegionUp -= OnRegionUp; m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent; m_scene.EventManager.OnMakeChildAgent -= MakeChildAgent; m_scene.EventManager.OnClientClosed -= ClientLoggedOut; @@ -279,7 +289,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap /// public LLSDMapLayerResponse GetMapLayer(LLSDMapRequest mapReq) { - m_log.Debug("[WORLD MAP]: MapLayer Request in region: " + m_scene.RegionInfo.RegionName); + m_log.DebugFormat("[WORLD MAP]: MapLayer Request in region: {0}", m_scene.RegionInfo.RegionName); LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); return mapResponse; @@ -321,8 +331,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_rootAgents) { m_rootAgents.Remove(AgentId); - if (m_rootAgents.Count == 0) - StopThread(); } } #endregion @@ -362,6 +370,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { +// m_log.DebugFormat("[WORLD MAP]: Handle MapItem request {0} {1}", regionhandle, itemtype); + lock (m_rootAgents) { if (!m_rootAgents.Contains(remoteClient.AgentId)) @@ -370,7 +380,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap uint xstart = 0; uint ystart = 0; Utils.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); - if (itemtype == 6) // we only sevice 6 right now (avatar green dots) + if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) { if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) { @@ -414,14 +424,58 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // Remote Map Item Request // ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes. - // Note that we only start up a remote mapItem Request thread if there's users who could - // be making requests - if (!threadrunning) - { - m_log.Warn("[WORLD MAP]: Starting new remote request thread manually. This means that AvatarEnteringParcel never fired! This needs to be fixed! Don't Mantis this, as the developers can see it in this message"); - StartThread(new object()); - } + RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); + } + } else if (itemtype == 7) // Service 7 (MAP_ITEM_LAND_FOR_SALE) + { + if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) + { + // Parcels + ILandChannel landChannel = m_scene.LandChannel; + List parcels = landChannel.AllParcels(); + // Local Map Item Request + int tc = Environment.TickCount; + List mapitems = new List(); + mapItemReply mapitem = new mapItemReply(); + if ((parcels != null) && (parcels.Count >= 1)) + { + foreach (ILandObject parcel_interface in parcels) + { + // Play it safe + if (!(parcel_interface is LandObject)) + continue; + + LandObject land = (LandObject)parcel_interface; + LandData parcel = land.LandData; + + // Show land for sale + if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale) + { + Vector3 min = parcel.AABBMin; + Vector3 max = parcel.AABBMax; + float x = (min.X+max.X)/2; + float y = (min.Y+max.Y)/2; + + mapitem = new mapItemReply(); + mapitem.x = (uint)(xstart + x); + mapitem.y = (uint)(ystart + y); + // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); + mapitem.id = UUID.Zero; + mapitem.name = parcel.Name; + mapitem.Extra = parcel.Area; + mapitem.Extra2 = parcel.SalePrice; + mapitems.Add(mapitem); + } + } + } + remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); + } + else + { + // Remote Map Item Request + + // ensures that the blockingqueue doesn't get borked if the GetAgents() timing changes. RequestMapItems("",remoteClient.AgentId,flags,EstateID,godlike,itemtype,regionhandle); } } @@ -542,6 +596,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags); } + + // Service 7 (MAP_ITEM_LAND_FOR_SALE) + uint itemtype = 7; + + if (response.ContainsKey(itemtype.ToString())) + { + List returnitems = new List(); + OSDArray itemarray = (OSDArray)response[itemtype.ToString()]; + for (int i = 0; i < itemarray.Count; i++) + { + OSDMap mapitem = (OSDMap)itemarray[i]; + mapItemReply mi = new mapItemReply(); + mi.x = (uint)mapitem["X"].AsInteger(); + mi.y = (uint)mapitem["Y"].AsInteger(); + mi.id = mapitem["ID"].AsUUID(); + mi.Extra = mapitem["Extra"].AsInteger(); + mi.Extra2 = mapitem["Extra2"].AsInteger(); + mi.name = mapitem["Name"].AsString(); + returnitems.Add(mi); + } + av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags); + } } } } @@ -589,12 +665,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private OSDMap RequestMapItemsAsync(UUID id, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle) { +// m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype); + string httpserver = ""; bool blacklisted = false; lock (m_blacklistedregions) { if (m_blacklistedregions.ContainsKey(regionhandle)) - blacklisted = true; + { + if (Environment.TickCount > (m_blacklistedregions[regionhandle] + blacklistTimeout)) + { + m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted region {0}", regionhandle); + + m_blacklistedregions.Remove(regionhandle); + } + else + blacklisted = true; + } } if (blacklisted) @@ -636,7 +723,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_blacklistedurls) { if (m_blacklistedurls.ContainsKey(httpserver)) - blacklisted = true; + { + if (Environment.TickCount > (m_blacklistedurls[httpserver] + blacklistTimeout)) + { + m_log.DebugFormat("[WORLDMAP]: Unblock blacklisted URL {0}", httpserver); + + m_blacklistedurls.Remove(httpserver); + } + else + blacklisted = true; + } } // Can't find the http server @@ -1064,6 +1160,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); + // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) + OSDMap responsemap = new OSDMap(); int tc = Environment.TickCount; if (m_scene.GetRootAgentCount() == 0) @@ -1096,6 +1194,60 @@ namespace OpenSim.Region.CoreModules.World.WorldMap }); responsemap["6"] = responsearr; } + + // Service 7 (MAP_ITEM_LAND_FOR_SALE) + + ILandChannel landChannel = m_scene.LandChannel; + List parcels = landChannel.AllParcels(); + + if ((parcels == null) || (parcels.Count == 0)) + { + OSDMap responsemapdata = new OSDMap(); + responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1)); + responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1)); + responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); + responsemapdata["Name"] = OSD.FromString(""); + responsemapdata["Extra"] = OSD.FromInteger(0); + responsemapdata["Extra2"] = OSD.FromInteger(0); + OSDArray responsearr = new OSDArray(); + responsearr.Add(responsemapdata); + + responsemap["7"] = responsearr; + } + else + { + OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); + foreach (ILandObject parcel_interface in parcels) + { + // Play it safe + if (!(parcel_interface is LandObject)) + continue; + + LandObject land = (LandObject)parcel_interface; + LandData parcel = land.LandData; + + // Show land for sale + if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale) + { + Vector3 min = parcel.AABBMin; + Vector3 max = parcel.AABBMax; + float x = (min.X+max.X)/2; + float y = (min.Y+max.Y)/2; + + OSDMap responsemapdata = new OSDMap(); + responsemapdata["X"] = OSD.FromInteger((int)(xstart + x)); + responsemapdata["Y"] = OSD.FromInteger((int)(ystart + y)); + // responsemapdata["Z"] = OSD.FromInteger((int)m_scene.GetGroundHeight(x,y)); + responsemapdata["ID"] = OSD.FromUUID(UUID.Zero); + responsemapdata["Name"] = OSD.FromString(parcel.Name); + responsemapdata["Extra"] = OSD.FromInteger(parcel.Area); + responsemapdata["Extra2"] = OSD.FromInteger(parcel.SalePrice); + responsearr.Add(responsemapdata); + } + } + responsemap["7"] = responsearr; + } + return responsemap; } @@ -1144,12 +1296,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap private void MakeRootAgent(ScenePresence avatar) { - // You may ask, why this is in a threadpool to start with.. - // The reason is so we don't cause the thread to freeze waiting - // for the 1 second it costs to start a thread manually. - if (!threadrunning) - Util.FireAndForget(this.StartThread); - lock (m_rootAgents) { if (!m_rootAgents.Contains(avatar.UUID)) @@ -1164,8 +1310,30 @@ namespace OpenSim.Region.CoreModules.World.WorldMap lock (m_rootAgents) { m_rootAgents.Remove(avatar.UUID); - if (m_rootAgents.Count == 0) - StopThread(); + } + } + + public void OnRegionUp(GridRegion otherRegion) + { + ulong regionhandle = otherRegion.RegionHandle; + string httpserver = otherRegion.ServerURI + "MAP/MapItems/" + regionhandle.ToString(); + + lock (m_blacklistedregions) + { + if (!m_blacklistedregions.ContainsKey(regionhandle)) + m_blacklistedregions.Remove(regionhandle); + } + + lock (m_blacklistedurls) + { + if (m_blacklistedurls.ContainsKey(httpserver)) + m_blacklistedurls.Remove(httpserver); + } + + lock (m_cachedRegionMapItemsAddress) + { + if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) + m_cachedRegionMapItemsAddress.Remove(regionhandle); } } diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 23218f1000..31e86a59d9 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -216,6 +216,9 @@ ;WorldMapModule = "WorldMap" ;MapImageModule = "MapImageModule" + ; World map blacklist timeout in seconds + ;BlacklistTimeout = 600 + ; Set to false to not generate any maptiles ;GenerateMaptiles = true From 70ea62544716134447884e999898267497b85a12 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Sun, 14 Aug 2011 18:20:20 +0200 Subject: [PATCH 58/90] Added optional Login Service parameter "Currency" to be able to change the currency name shown in the viewer. --- .../LLLoginService/LLLoginResponse.cs | 19 ++++++++++++++++++- .../Services/LLLoginService/LLLoginService.cs | 4 +++- bin/Robust.HG.ini.example | 2 ++ bin/Robust.ini.example | 2 ++ .../StandaloneCommon.ini.example | 2 ++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index f68c078c39..1a874c8ea5 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -183,6 +183,8 @@ namespace OpenSim.Services.LLLoginService private BuddyList m_buddyList = null; + private string currency; + static LLLoginResponse() { // This is being set, but it's not used @@ -218,7 +220,7 @@ namespace OpenSim.Services.LLLoginService public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List gestures, string message, - GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL) + GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL, string currency) : this() { FillOutInventoryData(invSkel, libService); @@ -236,6 +238,7 @@ namespace OpenSim.Services.LLLoginService StartLocation = where; MapTileURL = mapTileURL; SearchURL = searchURL; + Currency = currency; FillOutHomeData(pinfo, home); LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); @@ -382,6 +385,8 @@ namespace OpenSim.Services.LLLoginService initialOutfit.Add(InitialOutfitHash); mapTileURL = String.Empty; searchURL = String.Empty; + + currency = String.Empty; } @@ -456,6 +461,12 @@ namespace OpenSim.Services.LLLoginService responseData["buddy-list"] = m_buddyList.ToArray(); } + if (currency != String.Empty) + { + // responseData["real_currency"] = currency; + responseData["currency"] = currency; + } + responseData["login"] = "true"; return responseData; @@ -940,6 +951,12 @@ namespace OpenSim.Services.LLLoginService set { m_buddyList = value; } } + public string Currency + { + get { return currency; } + set { currency = value; } + } + #endregion public class UserInfo diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 00405a118a..4ccc7ff148 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -75,6 +75,7 @@ namespace OpenSim.Services.LLLoginService protected bool m_AllowRemoteSetLoginLevel; protected string m_MapTileURL; protected string m_SearchURL; + protected string m_Currency; protected string m_AllowedClients; protected string m_DeniedClients; @@ -108,6 +109,7 @@ namespace OpenSim.Services.LLLoginService m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty); + m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty); m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); @@ -408,7 +410,7 @@ namespace OpenSim.Services.LLLoginService // Finally, fill out the response and return it // LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService, - where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL); + where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_SearchURL, m_Currency); m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); return response; diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index ea271b864a..b760abde52 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -203,6 +203,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" + ;Currency = "" + WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 14f79aac14..a36d255c94 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -188,6 +188,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService" FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" + ;Currency = "" + WelcomeMessage = "Welcome, Avatar!" AllowRemoteSetLoginLevel = "false" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index ee0523f91a..babd1160c0 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -99,6 +99,8 @@ ;; For Viewer 2 MapTileURL = "http://127.0.0.1:9000/" + ;Currency = "" + ;; Regular expressions for controlling which client versions are accepted/denied. ;; An empty string means nothing is checked. ;; From 9a6ad1535e83a4d1b216ae879173ab8c524da60b Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Mon, 15 Aug 2011 17:46:51 +0200 Subject: [PATCH 59/90] Added console command "delete object outside" to delete all objects outside region boundaries. This is especiyll useful in cases where physical objects outside regions boundaries cause much physics engine lag. --- OpenSim/Region/Framework/Scenes/Scene.cs | 39 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9aa9bf530b..13b4cbcb71 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -611,6 +611,10 @@ namespace OpenSim.Region.Framework.Scenes "delete object name ", "Delete object by name", HandleDeleteObject); + MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", + "delete object outside", + "Delete all objects outside boundaries", HandleDeleteObject); + //Bind Storage Manager functions to some land manager functions for this scene EventManager.OnLandObjectAdded += new EventManager.LandObjectAdded(simDataService.StoreLandObject); @@ -4941,11 +4945,19 @@ namespace OpenSim.Region.Framework.Scenes private void HandleDeleteObject(string module, string[] cmd) { - if (cmd.Length < 4) + if (cmd.Length < 3) return; string mode = cmd[2]; - string o = cmd[3]; + string o = ""; + + if (mode != "outside") + { + if (cmd.Length < 4) + return; + + o = cmd[3]; + } List deletes = new List(); @@ -4987,10 +4999,33 @@ namespace OpenSim.Region.Framework.Scenes deletes.Add(g); }); break; + case "outside": + ForEachSOG(delegate (SceneObjectGroup g) + { + SceneObjectPart rootPart = g.RootPart; + bool delete = false; + + if (rootPart.GroupPosition.Z < 0.0 || rootPart.GroupPosition.Z > 10000.0) + { + delete = true; + } else { + ILandObject parcel = LandChannel.GetLandObject(rootPart.GroupPosition.X, rootPart.GroupPosition.Y); + + if (parcel == null || parcel.LandData.Name == "NO LAND") + delete = true; + } + + if (delete && !rootPart.IsAttachment && !deletes.Contains(g)) + deletes.Add(g); + }); + break; } foreach (SceneObjectGroup g in deletes) + { + m_log.InfoFormat("[SCENE]: Deleting object {0}", g.UUID); DeleteSceneObject(g, false); + } } private void HandleReloadEstate(string module, string[] cmd) From e870442e310195e234ed62c373aeb4eff8b5e791 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 15 Aug 2011 12:59:17 -0400 Subject: [PATCH 60/90] Remove un-needed ATTACH command in migration script. This was causing issues when using specified paths to database files by using a hard-coded name. --- OpenSim/Data/SQLite/Resources/XInventoryStore.migrations | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations b/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations index d5b3019c76..de44982710 100644 --- a/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations +++ b/OpenSim/Data/SQLite/Resources/XInventoryStore.migrations @@ -41,11 +41,9 @@ COMMIT; :VERSION 2 -ATTACH 'inventoryStore.db' AS old; - BEGIN TRANSACTION; INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders; INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems; -COMMIT; \ No newline at end of file +COMMIT; From dc772c608d886b3fe55b7cfef6189e47372c777b Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 15 Aug 2011 16:17:32 -0400 Subject: [PATCH 61/90] Fix for monodevelop External libraries need the "path=..." set so Prebuild.exe can properly build the projects --- prebuild.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prebuild.xml b/prebuild.xml index b56c5b506e..9877973873 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3150,7 +3150,7 @@ - + From 0784791a44d5f5b7db7c3d2534cc158160819d01 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 15 Aug 2011 16:21:04 -0400 Subject: [PATCH 62/90] Add "shutdown" message to RegionReady Add "shutdown" message when removing region. From a patch submitted by Michelle Argus. Thanks Michelle --- .../Scripting/RegionReadyModule/RegionReadyModule.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 05c729a0d7..963d1e2542 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -126,6 +126,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; + if(m_uri != string.Empty) + { + RRAlert("shutdown"); + } + m_scene = null; } From 8c95c83562db7e273cbf555514224773f21a2b19 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:03:43 +0100 Subject: [PATCH 63/90] On Flotsam asset cache, go back to moving the file from the temporary location rather than copying. Copying doesn't prevent IOExceptions on Windows due to file locking. (e.g. Mantis 5642, 5630). So instead go back to moving the file, swallowing IOExceptions that occur just for the move due to competing caching threads or even different opensimulator instances. --- .../CoreModules/Asset/FlotsamAssetCache.cs | 75 ++++++++++++------- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index abfc771498..b2f6e135a1 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -593,39 +593,60 @@ namespace Flotsam.RegionModules.AssetCache try { - if (!Directory.Exists(directory)) + try { - Directory.CreateDirectory(directory); + if (!Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + stream = File.Open(tempname, FileMode.Create); + BinaryFormatter bformatter = new BinaryFormatter(); + bformatter.Serialize(stream, asset); + } + catch (IOException e) + { + m_log.ErrorFormat( + "[FLOTSAM ASSET CACHE]: Failed to write asset {0} to temporary location {1} (final {2}) on cache in {3}. Exception {4} {5}.", + asset.ID, tempname, filename, directory, e.Message, e.StackTrace); + + return; + } + finally + { + if (stream != null) + stream.Close(); } - stream = File.Open(tempname, FileMode.Create); - BinaryFormatter bformatter = new BinaryFormatter(); - bformatter.Serialize(stream, asset); - stream.Close(); - - // Now that it's written, rename it so that it can be found. - // We're doing this as a file copy operation so that if two threads are competing to cache this asset, - // then both suceed instead of one failing when it tries to move the file to a final filename that - // already exists. - // This assumes that the file copy operation is atomic. Assuming this holds, then copying also works - // if another simulator is using the same cache directory. - File.Copy(tempname, filename, true); - File.Delete(tempname); - - if (m_LogLevel >= 2) - m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[FLOTSAM ASSET CACHE]: Failed to write asset {0} to cache. Directory {1}, tempname {2}, filename {3}. Exception {4} {5}.", - asset.ID, directory, tempname, filename, e.Message, e.StackTrace); + try + { + // Now that it's written, rename it so that it can be found. + // + // File.Copy(tempname, filename, true); + // File.Delete(tempname); + // + // For a brief period, this was done as a separate copy and then temporary file delete operation. + // However, this causes exceptions on Windows when other threads attempt to read a file + // which is still being copied. So instead, go back to moving the file and swallowing any IOException + // that occurs because two threads race to cache the same data (and the second fails because the file + // already exists). + // + // This situation occurs fairly rarely anyway. We assume in this that moves are atomic on the + // filesystem. + File.Move(tempname, filename); + + if (m_LogLevel >= 2) + m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Cache Stored :: {0}", asset.ID); + } + catch (IOException) + { + // If we see an IOException here it's likely that some other competing thread has written the + // cache file first, so ignore. Other IOException errors (e.g. filesystem full) should be + // signally by the earlier temporary file writing code. + } } finally { - if (stream != null) - stream.Close(); - // Even if the write fails with an exception, we need to make sure // that we release the lock on that file, otherwise it'll never get // cached From fd3a7ab70c04742a8ea776180144ea016e0d4e31 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:31:08 +0100 Subject: [PATCH 64/90] minor: change some comment text in flotsam asset cache --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index b2f6e135a1..22c301be84 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -625,11 +625,10 @@ namespace Flotsam.RegionModules.AssetCache // File.Copy(tempname, filename, true); // File.Delete(tempname); // - // For a brief period, this was done as a separate copy and then temporary file delete operation. + // For a brief period, this was done as a separate copy and then temporary file delete operation to + // avoid an IOException caused by move if some competing thread had already written the file. // However, this causes exceptions on Windows when other threads attempt to read a file - // which is still being copied. So instead, go back to moving the file and swallowing any IOException - // that occurs because two threads race to cache the same data (and the second fails because the file - // already exists). + // which is still being copied. So instead, go back to moving the file and swallow any IOException. // // This situation occurs fairly rarely anyway. We assume in this that moves are atomic on the // filesystem. From e29e50798a248bbcae3b541397a6087a511d5133 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:31:48 +0100 Subject: [PATCH 65/90] minor: Add warning to OpenSim.ini.example about bullet plugins not working right now, pending the new plugin --- bin/OpenSim.ini.example | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index bcfaf76704..45fe399d9e 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -151,6 +151,7 @@ ;; OpenDynamicsEngine is by some distance the most developed physics engine ;; basicphysics effectively does not model physics at all, making all ;; objects phantom + ;; The Bullet plugins do not work properly right now. A better Bullet plugin is on the way. ;; Default is OpenDynamicsEngine ; physics = OpenDynamicsEngine ; physics = basicphysics From 96ee87e39bf0310aa5648b04e1a5d47d5795daab Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:38:51 +0100 Subject: [PATCH 66/90] Change the default standalone asset cache to be the Flotsam asset cache (with memory caching not enabled). This matches the GridCommon setting and is the best tested setting. It appears to work fine on standalone. Also, add information that the flotsam asset cache is the recommended cache, since it is most used and actively maintained. --- bin/config-include/GridCommon.ini.example | 1 + bin/config-include/StandaloneCommon.ini.example | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 4e340592a6..c5598c087e 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -122,6 +122,7 @@ [Modules] ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. ;; Copy the config .example file into your own .ini file and change configs there + ;; We recommend the use of the FlotsamAssetCache since this is most actively maintained. AssetCaching = "FlotsamAssetCache" Include-FlotsamCache = "config-include/FlotsamCache.ini" diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index babd1160c0..431dce1471 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -45,14 +45,15 @@ [Modules] ;; Choose 0 or 1 cache modules, and the corresponding config file, if it exists. ;; Copy the config .example file into your own .ini file and change configs there + ;; We recommend the use of the FlotsamAssetCache since this is most actively maintained. + + AssetCaching = "FlotsamAssetCache" + Include-FlotsamCache = "config-include/FlotsamCache.ini" ;AssetCaching = "GlynnTuckerAssetCache" - ;AssetCaching = "FlotsamAssetCache" - ;Include-FlotsamCache = "config-include/FlotsamCache.ini" - - AssetCaching = "CenomeMemoryAssetCache" - Include-CenomeCache = "config-include/CenomeCache.ini" + ; AssetCaching = "CenomeMemoryAssetCache" + ; Include-CenomeCache = "config-include/CenomeCache.ini" ;; Authorization is not on by default, as it depends on external php ;AuthorizationServices = "LocalAuthorizationServicesConnector" From 8d866ae8c3e2c866f8b4b905d5a74370042100c3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:45:01 +0100 Subject: [PATCH 67/90] minor: remove some mono compiler warnings --- OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | 6 +++--- OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index 22c05c4eae..e7bd2e764a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs @@ -50,8 +50,8 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class GetMeshModule : INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; private IAssetService m_AssetService; @@ -113,7 +113,7 @@ namespace OpenSim.Region.ClientStack.Linden public void RegisterCaps(UUID agentID, Caps caps) { - UUID capID = UUID.Random(); +// UUID capID = UUID.Random(); //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); if (m_URL == "localhost") diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index 24ab06a43d..fffcee2b7e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs @@ -54,8 +54,9 @@ namespace OpenSim.Region.ClientStack.Linden [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class GetTextureModule : INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; private IAssetService m_assetService; From eb431f91c092eda1e06bb5f47d604eedcf892ec7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:50:15 +0100 Subject: [PATCH 68/90] Add terminating quotes to http addresses in [SimulatorFeatures] section of OpenSim.ini.example. As per http://opensimulator.org/mantis/view.php?id=5638. Thanks DutchGlory. --- bin/OpenSim.ini.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 45fe399d9e..c36d2a4ea6 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -319,8 +319,8 @@ ; meant to override the MapImage and search server url given at login, and varying ; on a sim-basis. ; Viewers that don't understand it, will ignore it - ;MapImageServerURI = "http://127.0.0.1:9000/ - ;SearchServerURI = "http://127.0.0.1:9000/ + ;MapImageServerURI = "http://127.0.0.1:9000/" + ;SearchServerURI = "http://127.0.0.1:9000/" [Chat] From 66eb537d0cedfd017fd8872fb1b60ed15d871d2b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:56:56 +0100 Subject: [PATCH 69/90] relocate AttachmentTests.cs to AttachmentsModuleTests.cs --- .../Avatar/Attachments/Tests/AttachmentsModuleTests.cs} | 4 ++-- prebuild.xml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) rename OpenSim/Region/{Framework/Scenes/Tests/AttachmentTests.cs => CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs} (98%) diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs similarity index 98% rename from OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs rename to OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 07b30f40c0..cc810d7e73 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -44,13 +44,13 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; -namespace OpenSim.Region.Framework.Scenes.Tests +namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests { /// /// Attachment tests /// [TestFixture] - public class AttachmentTests + public class AttachmentsModuleTests { public Scene scene, scene2; public UUID agent1; diff --git a/prebuild.xml b/prebuild.xml index 9877973873..618b469fbe 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2958,6 +2958,7 @@ + From 601257f8b6ff7ad97f62e0ab2a428912095bf6dc Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 21:58:52 +0100 Subject: [PATCH 70/90] remove setting up of second scene in attachments since it's not currently used --- .../Tests/AttachmentsModuleTests.cs | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index cc810d7e73..b008499fba 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -52,10 +52,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests [TestFixture] public class AttachmentsModuleTests { - public Scene scene, scene2; + public Scene scene; public UUID agent1; public static Random random; - public ulong region1, region2; + public ulong region1; public AgentCircuitData acd1; public SceneObjectGroup sog1, sog2, sog3; @@ -65,13 +65,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests TestHelpers.InMethod(); scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); interregionComms.PostInitialise(); SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); - SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms); agent1 = UUID.Random(); random = new Random(); @@ -81,7 +79,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; - region2 = scene2.RegionInfo.RegionHandle; SceneHelpers.AddScenePresence(scene, agent1); } @@ -116,25 +113,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // I'm commenting this test because scene setup NEEDS InventoryService to // be non-null //[Test] - public void T032_CrossAttachments() - { - TestHelpers.InMethod(); - - ScenePresence presence = scene.GetScenePresence(agent1); - ScenePresence presence2 = scene2.GetScenePresence(agent1); - presence2.AddAttachment(sog1); - presence2.AddAttachment(sog2); - - ISharedRegionModule serialiser = new SerialiserModule(); - SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); - SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); - - Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); - - //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); - Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); - Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); - } +// public void T032_CrossAttachments() +// { +// TestHelpers.InMethod(); +// +// ScenePresence presence = scene.GetScenePresence(agent1); +// ScenePresence presence2 = scene2.GetScenePresence(agent1); +// presence2.AddAttachment(sog1); +// presence2.AddAttachment(sog2); +// +// ISharedRegionModule serialiser = new SerialiserModule(); +// SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); +// SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); +// +// Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); +// +// //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); +// Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); +// Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); +// } private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent) { From c58b32e7baf199fd2168851a1f718d5650f31423 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 22:09:13 +0100 Subject: [PATCH 71/90] drop number of attachments in test from 3 to 2 to reduce text complexity --- .../Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b008499fba..2e32377c9b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests public static Random random; public ulong region1; public AgentCircuitData acd1; - public SceneObjectGroup sog1, sog2, sog3; + public SceneObjectGroup sog1, sog2; [TestFixtureSetUp] public void Init() @@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); - sog3 = NewSOG(UUID.Random(), scene, agent1); //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); region1 = scene.RegionInfo.RegionHandle; @@ -92,7 +91,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests presence.AddAttachment(sog1); presence.AddAttachment(sog2); - presence.AddAttachment(sog3); Assert.That(presence.HasAttachments(), Is.True); Assert.That(presence.ValidateAttachments(), Is.True); @@ -106,7 +104,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests ScenePresence presence = scene.GetScenePresence(agent1); presence.RemoveAttachment(sog1); presence.RemoveAttachment(sog2); - presence.RemoveAttachment(sog3); Assert.That(presence.HasAttachments(), Is.False); } From 0bbf7c21d719de19d517417523e36bc25ac6ad70 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 22:13:13 +0100 Subject: [PATCH 72/90] Isolate existing incomplete attachments tests rather than have them rely on each other. Much easier to debug this way. --- .../Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 2e32377c9b..d1829963be 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -59,11 +59,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests public AgentCircuitData acd1; public SceneObjectGroup sog1, sog2; - [TestFixtureSetUp] + [SetUp] public void Init() { - TestHelpers.InMethod(); - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); @@ -83,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests } [Test] - public void T030_TestAddAttachments() + public void TestAddAttachments() { TestHelpers.InMethod(); @@ -97,11 +95,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests } [Test] - public void T031_RemoveAttachments() + public void TestRemoveAttachments() { TestHelpers.InMethod(); ScenePresence presence = scene.GetScenePresence(agent1); + presence.AddAttachment(sog1); + presence.AddAttachment(sog2); presence.RemoveAttachment(sog1); presence.RemoveAttachment(sog2); Assert.That(presence.HasAttachments(), Is.False); From d3c10e609e2862165c3a9a4e1f436634191201d3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 22:27:52 +0100 Subject: [PATCH 73/90] Move some previously common code back into separate tests. Remove unused region handle from test. --- .../Tests/AttachmentsModuleTests.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index d1829963be..c52409000d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -55,7 +55,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests public Scene scene; public UUID agent1; public static Random random; - public ulong region1; public AgentCircuitData acd1; public SceneObjectGroup sog1, sog2; @@ -73,11 +72,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); - - //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize)); - region1 = scene.RegionInfo.RegionHandle; - - SceneHelpers.AddScenePresence(scene, agent1); } [Test] @@ -85,8 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests { TestHelpers.InMethod(); - ScenePresence presence = scene.GetScenePresence(agent1); - + ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); presence.AddAttachment(sog1); presence.AddAttachment(sog2); @@ -99,14 +92,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests { TestHelpers.InMethod(); - ScenePresence presence = scene.GetScenePresence(agent1); + ScenePresence presence = SceneHelpers.AddScenePresence(scene, agent1); presence.AddAttachment(sog1); - presence.AddAttachment(sog2); + presence.AddAttachment(sog2); presence.RemoveAttachment(sog1); presence.RemoveAttachment(sog2); Assert.That(presence.HasAttachments(), Is.False); } +// [Test] +// public void TestRezAttachmentsOnAvatarEntrance() +// { +// ScenePresence presence = scene.GetScenePresence(agent1); +// } + // I'm commenting this test because scene setup NEEDS InventoryService to // be non-null //[Test] From 57e54d84d641787d40a2b45549f6f2d373c5f2f2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 23:05:08 +0100 Subject: [PATCH 74/90] Add new FireAndForgetMethod.None. This executes the callback on the same thread that made the request. Designed for use only by regression tests that rely on a predicable event ordering. --- OpenSim/Framework/AvatarAppearance.cs | 12 ++++- OpenSim/Framework/Util.cs | 11 ++++- .../Tests/AttachmentsModuleTests.cs | 46 +++++++++++++------ 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 02af5d9d7c..ab4ed66ae6 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -412,12 +412,20 @@ namespace OpenSim.Framework } /// - /// Add an attachment, if the attachpoint has the + /// Add an attachment + /// + /// + /// If the attachpoint has the /// 0x80 bit set then we assume this is an append /// operation otherwise we replace whatever is /// currently attached at the attachpoint + /// + /// + /// If UUID.Zero, then an any attachment at the attachpoint is removed. + /// + /// /// return true if something actually changed - /// + /// public bool SetAttachment(int attachpoint, UUID item, UUID asset) { if (attachpoint == 0) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 984a7a81f7..51ced7b3ac 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -56,8 +56,13 @@ namespace OpenSim.Framework /// /// The method used by Util.FireAndForget for asynchronously firing events /// + /// + /// None is used to execute the method in the same thread that made the call. It should only be used by regression + /// test code that relies on predictable event ordering. + /// public enum FireAndForgetMethod { + None, UnsafeQueueUserWorkItem, QueueUserWorkItem, BeginInvoke, @@ -89,7 +94,8 @@ namespace OpenSim.Framework public static readonly Regex UUIDPattern = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); - public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; + public static FireAndForgetMethod DefaultFireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; + public static FireAndForgetMethod FireAndForgetMethod = DefaultFireAndForgetMethod; /// /// Gets the name of the directory where the current running executable @@ -1506,6 +1512,9 @@ namespace OpenSim.Framework switch (FireAndForgetMethod) { + case FireAndForgetMethod.None: + realCallback.Invoke(obj); + break; case FireAndForgetMethod.UnsafeQueueUserWorkItem: ThreadPool.UnsafeQueueUserWorkItem(realCallback, obj); break; diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index c52409000d..7f258645d5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -37,10 +37,11 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; @@ -61,18 +62,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests [SetUp] public void Init() { - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. + Util.FireAndForgetMethod = FireAndForgetMethod.None; - ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); - interregionComms.Initialise(new IniConfigSource()); - interregionComms.PostInitialise(); - SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms); + scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + SceneHelpers.SetupSceneModules(scene, new AttachmentsModule()); agent1 = UUID.Random(); random = new Random(); sog1 = NewSOG(UUID.Random(), scene, agent1); sog2 = NewSOG(UUID.Random(), scene, agent1); - } + } + + [TearDown] + public void TearDown() + { + // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple + // threads. Possibly, later tests should be rewritten not to worry about such things. + Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; + } [Test] public void TestAddAttachments() @@ -100,11 +108,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests Assert.That(presence.HasAttachments(), Is.False); } -// [Test] -// public void TestRezAttachmentsOnAvatarEntrance() -// { -// ScenePresence presence = scene.GetScenePresence(agent1); -// } + [Test] + public void TestRezAttachmentsOnAvatarEntrance() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID spId = TestHelpers.ParseTail(0x1); + UUID attItemId = TestHelpers.ParseTail(0x2); + UUID attAssetId = TestHelpers.ParseTail(0x3); + + AgentCircuitData acd = SceneHelpers.GenerateAgentData(spId); + acd.Appearance = new AvatarAppearance(); + acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItemId, attAssetId); + ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); + +// Assert.That(presence.HasAttachments(), Is.True); + } // I'm commenting this test because scene setup NEEDS InventoryService to // be non-null From d73c42407848edbf7d9c37fab17585fd6038c269 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 16 Aug 2011 23:12:58 +0100 Subject: [PATCH 75/90] get rid of logged warnings about lack of some modules - afaik these never occur in real life and just clutter up tests --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 18632d7671..90c4706c4b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1197,10 +1197,6 @@ namespace OpenSim.Region.Framework.Scenes IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) m_agentTransfer.EnableChildAgents(this); - else - m_log.DebugFormat( - "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}", - m_scene.RegionInfo.RegionName); IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) @@ -2516,13 +2512,7 @@ namespace OpenSim.Region.Framework.Scenes // We have an appearance but we may not have the baked textures. Check the asset cache // to see if all the baked textures are already here. if (m_scene.AvatarFactory != null) - { cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient); - } - else - { - m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); - } // If we aren't using a cached appearance, then clear out the baked textures if (!cachedappearance) From 696bd448334c89607c95385f05a53e2ab72cb984 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Aug 2011 00:37:33 +0100 Subject: [PATCH 76/90] Add new regression TestRezAttachmentsOnAvatarEntrance() to do simple attachments check --- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Tests/AttachmentsModuleTests.cs | 22 ++++++++--- .../InventoryAccess/InventoryAccessModule.cs | 12 ++++++ .../Scenes/Tests/UserInventoryTests.cs | 8 ++-- .../Common/Helpers/UserAccountHelpers.cs | 8 ++-- .../Common/Helpers/UserInventoryHelpers.cs | 37 +++++++++++++++++-- 6 files changed, 69 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index ebb5bd2b13..4dbc5e6600 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments false, false, remoteClient.AgentId, true); // m_log.DebugFormat( -// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", +// "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", // objatt.Name, remoteClient.Name, AttachmentPt); if (objatt != null) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 7f258645d5..8c79ab4972 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -38,6 +38,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Attachments; +using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.Framework.Scenes; @@ -65,8 +66,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. Util.FireAndForgetMethod = FireAndForgetMethod.None; - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - SceneHelpers.SetupSceneModules(scene, new AttachmentsModule()); + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); + + scene = SceneHelpers.SetupScene(); + SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule()); agent1 = UUID.Random(); random = new Random(); @@ -114,16 +119,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - UUID spId = TestHelpers.ParseTail(0x1); + UUID userId = TestHelpers.ParseTail(0x1); UUID attItemId = TestHelpers.ParseTail(0x2); UUID attAssetId = TestHelpers.ParseTail(0x3); - AgentCircuitData acd = SceneHelpers.GenerateAgentData(spId); + UserAccountHelpers.CreateUserWithInventory(scene, userId); + InventoryItemBase attItem + = UserInventoryHelpers.CreateInventoryItem( + scene, "att", attItemId, attAssetId, userId, InventoryType.Object); + + AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); acd.Appearance = new AvatarAppearance(); - acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItemId, attAssetId); + acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); -// Assert.That(presence.HasAttachments(), Is.True); + Assert.That(presence.HasAttachments(), Is.True); } // I'm commenting this test because scene setup NEEDS InventoryService to diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 493314700c..65ba87b16f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -964,8 +964,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } } } + else + { + m_log.WarnFormat( + "[InventoryAccessModule]: Could not find asset {0} for item {1} {2} for {3} in RezObject()", item.AssetID, item.Name, item.ID, remoteClient.Name); + } + return group; } + else + { + m_log.WarnFormat( + "[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()", + itemID, remoteClient.Name); + } return null; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 50b1a480db..55fc1e73f8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); - UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); - UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID); @@ -86,8 +86,8 @@ namespace OpenSim.Region.Framework.Tests // log4net.Config.XmlConfigurator.Configure(); Scene scene = SceneHelpers.SetupScene(); - UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, 1001); - UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, 1002); + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); InventoryFolderBase folder1 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index d924ecd5c8..b73df2ca4c 100644 --- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs @@ -118,13 +118,12 @@ namespace OpenSim.Tests.Common public static UserAccount CreateUserWithInventory(Scene scene) { - return CreateUserWithInventory(scene, 99); + return CreateUserWithInventory(scene, TestHelpers.ParseTail(99)); } - public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) + public static UserAccount CreateUserWithInventory(Scene scene, UUID userId) { - return CreateUserWithInventory( - scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll"); + return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll"); } public static UserAccount CreateUserWithInventory( @@ -139,7 +138,6 @@ namespace OpenSim.Tests.Common { // FIXME: This should really be set up by UserAccount itself ua.ServiceURLs = new Dictionary(); - scene.UserAccountService.StoreUserAccount(ua); scene.InventoryService.CreateUserInventory(ua.PrincipalID); scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 1703597549..4e60ca9ed8 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -52,7 +52,22 @@ namespace OpenSim.Tests.Common /// public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) { - return CreateInventoryItem(scene, itemName, UUID.Random(), userId); + return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, InventoryType.Notecard); + } + + /// + /// Creates an item of the given type with an accompanying asset. + /// + /// + /// + /// + /// + /// Type of item to create + /// + public static InventoryItemBase CreateInventoryItem( + Scene scene, string itemName, UUID userId, InventoryType type) + { + return CreateInventoryItem(scene, itemName, UUID.Random(), UUID.Random(), userId, type); } /// @@ -61,18 +76,32 @@ namespace OpenSim.Tests.Common /// /// /// + /// /// + /// Type of item to create /// - public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) + public static InventoryItemBase CreateInventoryItem( + Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type) { - AssetBase asset = AssetHelpers.CreateAsset(scene, userId); + AssetBase asset = null; + + if (type == InventoryType.Notecard) + asset = AssetHelpers.CreateAsset(scene, userId); + else if (type == InventoryType.Object) + asset + = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); + else + throw new Exception(string.Format("Inventory type {0} not supported", type)); + + scene.AssetService.Store(asset); + InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; item.AssetID = asset.FullID; item.ID = itemId; item.Owner = userId; item.AssetType = asset.Type; - item.InvType = (int)InventoryType.Notecard; + item.InvType = (int)type; InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); From bd5d35ee323df9b15d5303c2dcad7e29a4f3e0eb Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Aug 2011 00:42:58 +0100 Subject: [PATCH 77/90] extend test to check that there is one attachment and that it has the right name --- .../Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 8c79ab4972..5bac4c6206 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -122,11 +122,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests UUID userId = TestHelpers.ParseTail(0x1); UUID attItemId = TestHelpers.ParseTail(0x2); UUID attAssetId = TestHelpers.ParseTail(0x3); + string attName = "att"; UserAccountHelpers.CreateUserWithInventory(scene, userId); InventoryItemBase attItem = UserInventoryHelpers.CreateInventoryItem( - scene, "att", attItemId, attAssetId, userId, InventoryType.Object); + scene, attName, attItemId, attAssetId, userId, InventoryType.Object); AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); acd.Appearance = new AvatarAppearance(); @@ -134,6 +135,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); Assert.That(presence.HasAttachments(), Is.True); + List attachments = presence.Attachments; + + Assert.That(attachments.Count, Is.EqualTo(1)); + Assert.That(attachments[0].Name, Is.EqualTo(attName)); } // I'm commenting this test because scene setup NEEDS InventoryService to From acfdca34fd9bf6d66d144ae5c0a325dd5e864517 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Aug 2011 01:35:33 +0100 Subject: [PATCH 78/90] Fix issue where loading a new appearance onto an NPC would not remove the previous attachments from the scene. Addresses http://opensimulator.org/mantis/view.php?id=5636 --- .../Avatar/Attachments/AttachmentsModule.cs | 4 ++-- .../Region/Framework/Interfaces/IAttachmentsModule.cs | 3 ++- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 10 ++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 4dbc5e6600..0316d2947a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) { - m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); +// m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); try { @@ -466,7 +466,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); group.DetachToInventoryPrep(); - m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); +// m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); // If an item contains scripts, it's always changed. // This ensures script state is saved on detach diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 6cc64c6113..4cb3df24ab 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -96,9 +96,10 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Detach an object from the avatar. /// - /// + /// /// This method is called in response to a client's detach request, so we only update the information in /// inventory + /// /// /// void DetachObject(uint objectLocalID, IClientAPI remoteClient); diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 11fda6df1e..3b7ae9d246 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -143,6 +143,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC if (!m_avatars.ContainsKey(agentId)) return false; + // FIXME: An extremely bad bit of code that reaches directly into the attachments list and manipulates it + List attachments = sp.Attachments; + lock (attachments) + { + foreach (SceneObjectGroup att in attachments) + scene.DeleteSceneObject(att, false); + + attachments.Clear(); + } + AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); sp.Appearance = npcAppearance; sp.RezAttachments(); From 4a9b8184f71197d1270a920b5e4ad85c9de6bed5 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Aug 2011 01:51:58 +0100 Subject: [PATCH 79/90] For now, supress 'OH NOES' warnings given by HGInventoryBroker.CacheInventoryServiceURL when it tries to cache it for an NPC This concept is meaningless for NPCs. However, it might be better to make NPCism an actual property on ScenePresence and check. Addresses http://opensimulator.org/mantis/view.php?id=5643 --- .../Inventory/HGInventoryBroker.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 698fd569e4..72ae336352 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -211,11 +211,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return; } } - else - { - m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); - return; - } +// else +// { +// m_log.DebugFormat("[HG INVENTORY CONNECTOR]: User {0} does not have InventoryServerURI. OH NOES!", userID); +// return; +// } } } if (sp == null) From 6b51d8a10e44eed7c39b58aab256789ab188ecca Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Aug 2011 23:24:41 +0100 Subject: [PATCH 80/90] In the asset service, check that an asset exists before attempting to store it. --- OpenSim/Data/MySQL/MySQLAssetData.cs | 9 +++++++-- OpenSim/Services/AssetService/AssetService.cs | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index e740232a31..a743479dd3 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs @@ -251,12 +251,14 @@ namespace OpenSim.Data.MySQL } /// - /// check if the asset UUID exist in database + /// Check if the asset exists in the database /// /// The asset UUID - /// true if exist. + /// true if it exists, false otherwise. override public bool ExistsAsset(UUID uuid) { +// m_log.DebugFormat("[ASSETS DB]: Checking for asset {0}", uuid); + bool assetExists = false; lock (m_dbLock) @@ -273,7 +275,10 @@ namespace OpenSim.Data.MySQL using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (dbReader.Read()) + { +// m_log.DebugFormat("[ASSETS DB]: Found asset {0}", uuid); assetExists = true; + } } } catch (Exception e) diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index c7a259d2ca..d40aa4b7cd 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -174,10 +174,12 @@ namespace OpenSim.Services.AssetService public virtual string Store(AssetBase asset) { -// m_log.DebugFormat( -// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.ID, asset.Data.Length); - - m_Database.StoreAsset(asset); + if (!m_Database.ExistsAsset(asset.FullID)) + { +// m_log.DebugFormat( +// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length); + m_Database.StoreAsset(asset); + } return asset.ID; } From eb8b6b7d523dd6ef540d7860fc3e2121d8f60f09 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Aug 2011 23:28:57 +0100 Subject: [PATCH 81/90] minor: remove mono compiler warning --- OpenSim/Services/HypergridService/HGInstantMessageService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index 0d59636b72..0c9cfd38c2 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -120,7 +120,7 @@ namespace OpenSim.Services.HypergridService public bool IncomingInstantMessage(GridInstantMessage im) { // m_log.DebugFormat("[HG IM SERVICE]: Received message from {0} to {1}", im.fromAgentID, im.toAgentID); - UUID toAgentID = new UUID(im.toAgentID); +// UUID toAgentID = new UUID(im.toAgentID); bool success = false; if (m_IMSimConnector != null) From d8f886ccdb6f1bf185e7edaed7cd80b3027d58f2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Aug 2011 23:41:20 +0100 Subject: [PATCH 82/90] comment out noisy attachments logging --- .../Avatar/Attachments/AttachmentsModule.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 0316d2947a..a3639e8fd0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -226,9 +226,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments public UUID RezSingleAttachmentFromInventory( IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus) { - m_log.DebugFormat( - "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", - (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Rezzing attachment to point {0} from item {1} for {2}", +// (AttachmentPoint)AttachmentPt, itemID, remoteClient.Name); // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // be removed when that functionality is implemented in opensim @@ -566,8 +566,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// protected void AttachToAgent(ScenePresence avatar, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { - m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", - so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); +// m_log.DebugFormat("[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", +// so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); so.DetachFromBackup(); From c1a34cd8da293e63d3cba70b5271c9a297789db2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 18 Aug 2011 00:53:05 +0100 Subject: [PATCH 83/90] Don't try to save changed attachment states when an NPC with attachments is removed from the scene. This is done by introducing a PresenceType enum into ScenePresence which currently has two values, User and Npc. This seems better than a SaveAttachments flag in terms of code comprehension, though I'm still slightly uneasy about introducing these semantics to core objects --- OpenSim/Framework/IScene.cs | 7 ++-- OpenSim/Framework/PresenceType.cs | 39 +++++++++++++++++++ .../ClientStack/Linden/UDP/LLClientView.cs | 2 +- .../Avatar/Attachments/AttachmentsModule.cs | 4 +- .../Examples/SimpleModule/RegionModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++-- OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 ++- .../Region/Framework/Scenes/ScenePresence.cs | 12 ++++-- .../Scenes/Tests/ScenePresenceAgentTests.cs | 4 +- .../Server/IRCClientView.cs | 2 +- .../OptionalModules/World/NPC/NPCModule.cs | 2 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 14 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 OpenSim/Framework/PresenceType.cs diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index b5f975b7be..8f7a2e5b4e 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -72,10 +72,11 @@ namespace OpenSim.Framework /// /// Register the new client with the scene. The client starts off as a child agent - the later agent crossing - /// will promote it to a root agent during login. + /// will promote it to a root agent. /// - /// + /// The type of agent to add. + void AddNewClient(IClientAPI client, PresenceType type); /// /// Remove the given client from the scene. diff --git a/OpenSim/Framework/PresenceType.cs b/OpenSim/Framework/PresenceType.cs new file mode 100644 index 0000000000..8c4c6e686b --- /dev/null +++ b/OpenSim/Framework/PresenceType.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; + +namespace OpenSim.Framework +{ + /// + /// Indicate the type of ScenePresence. + /// + public enum PresenceType + { + User, + Npc + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1d35973646..f71871e1c7 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -692,7 +692,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void Start() { - m_scene.AddNewClient(this); + m_scene.AddNewClient(this, PresenceType.User); RefreshGroupMembership(); } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a3639e8fd0..97a1be607d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -501,10 +501,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// Update the attachment asset for the new sog details if they have changed. /// - /// + /// /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects, /// these details are not stored on the region. - /// + /// /// /// /// diff --git a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs index 088b81876a..3b8ce379f0 100644 --- a/OpenSim/Region/Examples/SimpleModule/RegionModule.cs +++ b/OpenSim/Region/Examples/SimpleModule/RegionModule.cs @@ -95,7 +95,7 @@ namespace OpenSim.Region.Examples.SimpleModule for (int i = 0; i < 1; i++) { MyNpcCharacter m_character = new MyNpcCharacter(m_scene); - m_scene.AddNewClient(m_character); + m_scene.AddNewClient(m_character, PresenceType.Npc); m_scene.AgentCrossing(m_character.AgentId, Vector3.Zero, false); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 13b4cbcb71..ae88a87712 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2543,10 +2543,11 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Avatar Methods /// - /// Adding a New Client and Create a Presence for it. + /// Add a new client and create a child agent for it. /// /// - public override void AddNewClient(IClientAPI client) + /// The type of agent to add. + public override void AddNewClient(IClientAPI client, PresenceType type) { AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); bool vialogin = false; @@ -2566,7 +2567,7 @@ namespace OpenSim.Region.Framework.Scenes m_clientManager.Add(client); SubscribeToClientEvents(client); - ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance); + ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); m_eventManager.TriggerOnNewPresence(sp); sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; @@ -3149,7 +3150,7 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnRemovePresence(agentID); - if (avatar != null && (!avatar.IsChildAgent)) + if (avatar != null && (!avatar.IsChildAgent) && avatar.PresenceType != PresenceType.Npc) avatar.SaveChangedAttachments(); ForEachClient( diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 2f1cdc1212..ec94f105cf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -175,7 +175,7 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Agent/Avatar - public abstract void AddNewClient(IClientAPI client); + public abstract void AddNewClient(IClientAPI client, PresenceType type); public abstract void RemoveClient(UUID agentID, bool closeChildAgents); public bool TryGetScenePresence(UUID agentID, out object scenePresence) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 65dc2c9cf6..f40b373e15 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -590,12 +590,13 @@ namespace OpenSim.Region.Framework.Scenes } } - protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) + protected internal ScenePresence CreateAndAddChildScenePresence( + IClientAPI client, AvatarAppearance appearance, PresenceType type) { ScenePresence newAvatar = null; // ScenePresence always defaults to child agent - newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); + newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance, type); AddScenePresence(newAvatar); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 90c4706c4b..e3bd393b80 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -75,6 +75,11 @@ namespace OpenSim.Region.Framework.Scenes private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// What type of presence is this? User, NPC, etc. + /// + public PresenceType PresenceType { get; private set; } + // private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes(); private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags)); private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f); @@ -715,8 +720,9 @@ namespace OpenSim.Region.Framework.Scenes m_animator = new ScenePresenceAnimator(this); } - private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() + private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, PresenceType type) : this() { + PresenceType = type; m_DrawDistance = world.DefaultDrawDistance; m_rootRegionHandle = reginfo.RegionHandle; m_controllingClient = client; @@ -764,8 +770,8 @@ namespace OpenSim.Region.Framework.Scenes SetDirectionVectors(); } - public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) - : this(client, world, reginfo) + public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) + : this(client, world, reginfo, type) { m_appearance = appearance; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index dd2c7170fa..35b41fb6c1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -207,7 +207,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests scene.NewUserConnection(acd1, 0, out reason); if (testclient == null) testclient = new TestClient(acd1, scene); - scene.AddNewClient(testclient); + scene.AddNewClient(testclient, PresenceType.User); ScenePresence presence = scene.GetScenePresence(agent1); presence.MakeRootAgent(new Vector3(90,90,90),false); @@ -257,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Adding child agent to region 1001 string reason; scene2.NewUserConnection(acd1,0, out reason); - scene2.AddNewClient(testclient); + scene2.AddNewClient(testclient, PresenceType.User); ScenePresence presence = scene.GetScenePresence(agent1); presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true); diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 15201da44d..c413634c61 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -893,7 +893,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public void Start() { - Scene.AddNewClient(this); + Scene.AddNewClient(this, PresenceType.User); // Mimicking LLClientView which gets always set appearance from client. Scene scene = (Scene)Scene; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3b7ae9d246..c1da803a40 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -190,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC // } scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); - scene.AddNewClient(npcAvatar); + scene.AddNewClient(npcAvatar, PresenceType.Npc); ScenePresence sp; if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 8d2108c116..03df7abddc 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -379,7 +379,7 @@ namespace OpenSim.Tests.Common // Stage 2: add the new client as a child agent to the scene TestClient client = new TestClient(agentData, scene); - scene.AddNewClient(client); + scene.AddNewClient(client, PresenceType.User); // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. ScenePresence scp = scene.GetScenePresence(agentData.AgentID); diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 7b64947221..b7cefeb9b5 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -579,7 +579,7 @@ namespace OpenSim.Tests.Common.Mock // Stage 2: add the new client as a child agent to the scene TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); - TeleportTargetScene.AddNewClient(TeleportSceneClient); + TeleportTargetScene.AddNewClient(TeleportSceneClient, PresenceType.User); } public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, From 45c37ef494df3e6303a2c0346cb239731d448bed Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 18 Aug 2011 01:11:23 +0100 Subject: [PATCH 84/90] refactor: Fold 3 ScenePresence() constructors into one since only one is called. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e3bd393b80..564a45623c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -713,15 +713,12 @@ namespace OpenSim.Region.Framework.Scenes #region Constructor(s) - public ScenePresence() + public ScenePresence( + IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) { m_sendCourseLocationsMethod = SendCoarseLocationsDefault; CreateSceneViewer(); m_animator = new ScenePresenceAnimator(this); - } - - private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, PresenceType type) : this() - { PresenceType = type; m_DrawDistance = world.DefaultDrawDistance; m_rootRegionHandle = reginfo.RegionHandle; @@ -768,11 +765,7 @@ namespace OpenSim.Region.Framework.Scenes RegisterToEvents(); SetDirectionVectors(); - } - public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) - : this(client, world, reginfo, type) - { m_appearance = appearance; } From 8d29d490a10c840a5b4f7b58c66e04295fe34edd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 18 Aug 2011 01:16:58 +0100 Subject: [PATCH 85/90] minor: remove some mono compiler warnings --- OpenSim/Data/MSSQL/MSSQLMigration.cs | 2 +- OpenSim/Data/MSSQL/MSSQLXInventoryData.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLMigration.cs b/OpenSim/Data/MSSQL/MSSQLMigration.cs index 1aa96c7ff0..c2fecefc7b 100644 --- a/OpenSim/Data/MSSQL/MSSQLMigration.cs +++ b/OpenSim/Data/MSSQL/MSSQLMigration.cs @@ -88,7 +88,7 @@ namespace OpenSim.Data.MSSQL cmd.ExecuteNonQuery(); } } - catch (Exception ex) + catch (Exception) { throw new Exception(sql); diff --git a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs index 10b0f2938f..b19a0da872 100644 --- a/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLXInventoryData.cs @@ -191,7 +191,7 @@ namespace OpenSim.Data.MSSQL { cmd.ExecuteNonQuery(); } - catch (Exception e) + catch (Exception) { return false; } From 49258350e8e34ce36bce08a2f40b8824d67449ab Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 18 Aug 2011 01:22:01 +0100 Subject: [PATCH 86/90] refactor: fold CreateSceneViewer() back into ScenePresence constructor --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 564a45623c..719f2da63f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -717,7 +717,7 @@ namespace OpenSim.Region.Framework.Scenes IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance, PresenceType type) { m_sendCourseLocationsMethod = SendCoarseLocationsDefault; - CreateSceneViewer(); + m_sceneViewer = new SceneViewer(this); m_animator = new ScenePresenceAnimator(this); PresenceType = type; m_DrawDistance = world.DefaultDrawDistance; @@ -769,11 +769,6 @@ namespace OpenSim.Region.Framework.Scenes m_appearance = appearance; } - private void CreateSceneViewer() - { - m_sceneViewer = new SceneViewer(this); - } - public void RegisterToEvents() { m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; From 3146f4bae0d6c0b190fb6b8477c690046a1c79af Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 18 Aug 2011 23:36:43 +0100 Subject: [PATCH 87/90] Don't need to try both AssetService.Get and GetCached in GetMesh since Get always calls GetCached and code paths were identical --- .../Handlers/GetMesh/GetMeshHandler.cs | 45 ++++--------------- OpenSim/Services/Interfaces/IAssetService.cs | 8 +++- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs index c60abb1fb1..720640e260 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshHandler.cs @@ -57,7 +57,6 @@ namespace OpenSim.Capabilities.Handlers public Hashtable ProcessGetMesh(Hashtable request, UUID AgentId, Caps cap) { - Hashtable responsedata = new Hashtable(); responsedata["int_response_code"] = 400; //501; //410; //404; responsedata["content_type"] = "text/plain"; @@ -69,7 +68,6 @@ namespace OpenSim.Capabilities.Handlers if (request.ContainsKey("mesh_id")) meshStr = request["mesh_id"].ToString(); - UUID meshID = UUID.Zero; if (!String.IsNullOrEmpty(meshStr) && UUID.TryParse(meshStr, out meshID)) { @@ -82,12 +80,11 @@ namespace OpenSim.Capabilities.Handlers return responsedata; } - AssetBase mesh; - // Only try to fetch locally cached textures. Misses are redirected - mesh = m_assetService.GetCached(meshID.ToString()); + AssetBase mesh = m_assetService.Get(meshID.ToString()); + if (mesh != null) { - if (mesh.Type == (SByte)AssetType.Mesh) + if (mesh.Type == (SByte)AssetType.Mesh) { responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); responsedata["content_type"] = "application/vnd.ll.mesh"; @@ -105,39 +102,15 @@ namespace OpenSim.Capabilities.Handlers } else { - mesh = m_assetService.Get(meshID.ToString()); - if (mesh != null) - { - if (mesh.Type == (SByte)AssetType.Mesh) - { - responsedata["str_response_string"] = Convert.ToBase64String(mesh.Data); - responsedata["content_type"] = "application/vnd.ll.mesh"; - responsedata["int_response_code"] = 200; - } - // Optionally add additional mesh types here - else - { - responsedata["int_response_code"] = 404; //501; //410; //404; - responsedata["content_type"] = "text/plain"; - responsedata["keepalive"] = false; - responsedata["str_response_string"] = "Unfortunately, this asset isn't a mesh."; - return responsedata; - } - } - - else - { - responsedata["int_response_code"] = 404; //501; //410; //404; - responsedata["content_type"] = "text/plain"; - responsedata["keepalive"] = false; - responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; - return responsedata; - } + responsedata["int_response_code"] = 404; //501; //410; //404; + responsedata["content_type"] = "text/plain"; + responsedata["keepalive"] = false; + responsedata["str_response_string"] = "Your Mesh wasn't found. Sorry!"; + return responsedata; } - } return responsedata; } } -} +} \ No newline at end of file diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index 1ac1cec358..80494f177a 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs @@ -56,7 +56,7 @@ namespace OpenSim.Services.Interfaces byte[] GetData(string id); /// - /// Synchronously fetches an asset from the local cache only + /// Synchronously fetches an asset from the local cache only. /// /// Asset ID /// The fetched asset, or null if it did not exist in the local cache @@ -75,7 +75,9 @@ namespace OpenSim.Services.Interfaces /// /// Creates a new asset /// - /// Returns a random ID if none is passed into it + /// + /// Returns a random ID if none is passed via the asset argument. + /// /// /// string Store(AssetBase asset); @@ -83,7 +85,9 @@ namespace OpenSim.Services.Interfaces /// /// Update an asset's content /// + /// /// Attachments and bare scripts need this!! + /// /// /// /// From c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 19 Aug 2011 00:45:22 +0100 Subject: [PATCH 88/90] Stop NPC's getting hypergrid like names in some circumstances. This meant punching in another AddUser() method in IUserManagement to do a direct name to UUID associated without the account check (since NPCs don't have accounts). May address http://opensimulator.org/mantis/view.php?id=5645 --- .../UserManagement/UserManagementModule.cs | 45 +++++++++++++------ .../Framework/Interfaces/IUserManagement.cs | 37 ++++++++++++++- OpenSim/Region/Framework/Scenes/Scene.cs | 44 +++++++++++------- .../World/NPC/Tests/NPCModuleTests.cs | 6 ++- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 1 + 5 files changed, 103 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index a4861ec0d5..b0b35e4d0d 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -186,7 +186,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - private string[] GetUserNames(UUID uuid) { string[] returnstring = new string[2]; @@ -292,6 +291,25 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement return userID.ToString(); } + public void AddUser(UUID uuid, string first, string last) + { + if (m_UserCache.ContainsKey(uuid)) + return; + + UserData user = new UserData(); + user.Id = uuid; + user.FirstName = first; + user.LastName = last; + // user.ProfileURL = we should initialize this to the default + + AddUserInternal(user); + } + + public void AddUser(UUID uuid, string first, string last, string profileURL) + { + AddUser(uuid, profileURL + ";" + first + " " + last); + } + public void AddUser(UUID id, string creatorData) { if (m_UserCache.ContainsKey(id)) @@ -299,18 +317,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, craetorData {1}", id, creatorData); - UserData user = new UserData(); - user.Id = id; UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); if (account != null) { - user.FirstName = account.FirstName; - user.LastName = account.LastName; - // user.ProfileURL = we should initialize this to the default + AddUser(id, account.FirstName, account.LastName); } else { + UserData user = new UserData(); + user.Id = id; + if (creatorData != null && creatorData != string.Empty) { //creatorData = ; @@ -338,17 +355,19 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement user.FirstName = "Unknown"; user.LastName = "User"; } + + AddUserInternal(user); } - - lock (m_UserCache) - m_UserCache[id] = user; - - m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.HomeURL); } - public void AddUser(UUID uuid, string first, string last, string profileURL) + void AddUserInternal(UserData user) { - AddUser(uuid, profileURL + ";" + first + " " + last); + lock (m_UserCache) + m_UserCache[user.Id] = user; + + m_log.DebugFormat( + "[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", + user.Id, user.FirstName, user.LastName, user.HomeURL); } //public void AddUser(UUID uuid, string userData) diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 5d30aa8e24..c66e053aa3 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs @@ -5,13 +5,48 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { + /// + /// This maintains the relationship between a UUID and a user name. + /// public interface IUserManagement { string GetUserName(UUID uuid); string GetUserHomeURL(UUID uuid); string GetUserUUI(UUID uuid); string GetUserServerURL(UUID uuid, string serverType); - void AddUser(UUID uuid, string userData); + + /// + /// Add a user. + /// + /// + /// If an account is found for the UUID, then the names in this will be used rather than any information + /// extracted from creatorData. + /// + /// + /// The creator data for this user. + void AddUser(UUID uuid, string creatorData); + + /// + /// Add a user. + /// + /// + /// The UUID is related to the name without any other checks being performed, such as user account presence. + /// + /// + /// + /// + void AddUser(UUID uuid, string firstName, string lastName); + + /// + /// Add a user. + /// + /// + /// The arguments apart from uuid are formed into a creatorData string and processing proceeds as for the + /// AddUser(UUID uuid, string creatorData) method. + /// + /// + /// + /// void AddUser(UUID uuid, string firstName, string lastName, string profileURL); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ae88a87712..513c0ea7a8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2582,12 +2582,13 @@ namespace OpenSim.Region.Framework.Scenes } } - if (GetScenePresence(client.AgentId) != null) + ScenePresence createdSp = GetScenePresence(client.AgentId); + if (createdSp != null) { m_LastLogin = Util.EnvironmentTickCount(); // Cache the user's name - CacheUserName(aCircuit); + CacheUserName(createdSp, aCircuit); EventManager.TriggerOnNewClient(client); if (vialogin) @@ -2595,28 +2596,41 @@ namespace OpenSim.Region.Framework.Scenes } } - private void CacheUserName(AgentCircuitData aCircuit) + /// + /// Cache the user name for later use. + /// + /// + /// + private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) { IUserManagement uMan = RequestModuleInterface(); if (uMan != null) { - string homeURL = string.Empty; string first = aCircuit.firstname, last = aCircuit.lastname; - if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) - homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); - - if (aCircuit.lastname.StartsWith("@")) + if (sp.PresenceType == PresenceType.Npc) { - string[] parts = aCircuit.firstname.Split('.'); - if (parts.Length >= 2) - { - first = parts[0]; - last = parts[1]; - } + uMan.AddUser(aCircuit.AgentID, first, last); } + else + { + string homeURL = string.Empty; - uMan.AddUser(aCircuit.AgentID, first, last, homeURL); + if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) + homeURL = aCircuit.ServiceURLs["HomeURI"].ToString(); + + if (aCircuit.lastname.StartsWith("@")) + { + string[] parts = aCircuit.firstname.Split('.'); + if (parts.Length >= 2) + { + first = parts[0]; + last = parts[1]; + } + } + + uMan.AddUser(aCircuit.AgentID, first, last, homeURL); + } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index f8afc5a0fe..78296a4e1f 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -34,6 +34,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; +using OpenSim.Region.CoreModules.Framework.UserManagement; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Avatar; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -57,8 +58,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests config.Configs["NPC"].Set("Enabled", "true"); AvatarFactoryModule afm = new AvatarFactoryModule(); + UserManagementModule umm = new UserManagementModule(); + TestScene scene = SceneHelpers.SetupScene(); - SceneHelpers.SetupSceneModules(scene, config, afm, new NPCModule()); + SceneHelpers.SetupSceneModules(scene, config, afm, umm, new NPCModule()); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); // ScenePresence originalAvatar = scene.GetScenePresence(originalClient.AgentId); @@ -81,6 +84,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests Assert.That(npc, Is.Not.Null); Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); + Assert.That(umm.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); } [Test] diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 03df7abddc..086a72553c 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -331,6 +331,7 @@ namespace OpenSim.Tests.Common agentData.InventoryFolder = UUID.Zero; agentData.startpos = Vector3.Zero; agentData.CapsPath = "http://wibble.com"; + agentData.ServiceURLs = new Dictionary(); return agentData; } From bb5b396fc5ac15d7451df407e75c2ca99c0b9dd1 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 18 Aug 2011 15:27:03 -0700 Subject: [PATCH 89/90] Fix exception when using BasicPhysics --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 7778ebcd8c..a0e87d058f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1603,7 +1603,6 @@ namespace OpenSim.Region.Framework.Scenes RotationOffset, RigidBody, m_localId); - PhysActor.SetMaterial(Material); } catch { @@ -1615,6 +1614,7 @@ namespace OpenSim.Region.Framework.Scenes { PhysActor.SOPName = this.Name; // save object name and desc into the PhysActor so ODE internals know the joint/body info PhysActor.SOPDescription = this.Description; + PhysActor.SetMaterial(Material); DoPhysicsPropertyUpdate(RigidBody, true); PhysActor.SetVolumeDetect(VolumeDetectActive ? 1 : 0); } @@ -4530,11 +4530,11 @@ namespace OpenSim.Region.Framework.Scenes RotationOffset, UsePhysics, m_localId); - PhysActor.SetMaterial(Material); pa = PhysActor; if (pa != null) { + PhysActor.SetMaterial(Material); DoPhysicsPropertyUpdate(UsePhysics, true); if (m_parentGroup != null) From a0a0c64cb181b56d9e87bbcf9eaa731171af2e41 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 19 Aug 2011 03:02:17 +0100 Subject: [PATCH 90/90] Get rid of HttpServer.dll to avoid confusion since we use HttpServer_OpenSim.dll (patched version) instead --- bin/HttpServer.dll | Bin 102400 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/HttpServer.dll diff --git a/bin/HttpServer.dll b/bin/HttpServer.dll deleted file mode 100755 index 717ceed3d16ee876515231ee9d1302b0371089cb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 102400 zcmeFacYIvM6+b$+?A@l7wU)H2Vq0>NeA(5?D&PtRT^5=tO3hEPIJNWcP9ObIO^0g`}u-|v~btCeud`@PS5|2!5vcTSlz zXU?4IbFcR9xlCC~DI5R3`bw#vU*Kk?P=eAg0(iF)q*VLTBTrolc>Uaj z-&o)q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