From ba89fc3aa1833c0fd6b5518d85ca966768597c6c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 5 Aug 2011 23:42:05 +0100
Subject: Add regression test for setting phantom status on a scene object.
This is not yet complete.
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 22 ++++----
OpenSim/Region/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
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 57baa99..3b6a458 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 90ad34e..e8a1070 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 0000000..a26fe33
--- /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
--
cgit v1.1
From c6c91e6599de6d4402ec0258da03cc975147da90 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 00:13:08 +0100
Subject: refactor: Fold most SOP.ScriptSet* methods back into script code.
Simplify.
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 25 ----------------------
.../Scenes/Tests/SceneObjectStatusTests.cs | 4 ++--
2 files changed, 2 insertions(+), 27 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e8a1070..afc386e 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 a26fe33..641c34e 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));
}
}
--
cgit v1.1
From cba40de109a0ab54a58324f105cbba799da70e39 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 00:22:14 +0100
Subject: extend phantom flag regression test to toggle back off
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +++
OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs | 4 ++++
2 files changed, 7 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index afc386e..7778ebc 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 641c34e..c0fca5d 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
--
cgit v1.1
From bda1a4be4567181df6c18ce6e059ca8982bc5fa1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 00:26:37 +0100
Subject: rename test SceneSetupHelpers -> SceneHelpers for consistency
---
.../Region/Framework/Scenes/Tests/AttachmentTests.cs | 14 +++++++-------
.../Framework/Scenes/Tests/EntityManagerTests.cs | 2 +-
.../Region/Framework/Scenes/Tests/SceneGraphTests.cs | 2 +-
.../Framework/Scenes/Tests/SceneObjectBasicTests.cs | 14 +++++++-------
.../Framework/Scenes/Tests/SceneObjectDeRezTests.cs | 12 ++++++------
.../Scenes/Tests/SceneObjectLinkingTests.cs | 20 ++++++++++----------
.../Framework/Scenes/Tests/SceneObjectResizeTests.cs | 8 ++++----
.../Framework/Scenes/Tests/SceneObjectStatusTests.cs | 2 +-
.../Scenes/Tests/SceneObjectUserGroupTests.cs | 6 +++---
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 20 ++++++++++----------
OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | 2 +-
.../Scenes/Tests/StandaloneTeleportTests.cs | 10 +++++-----
.../Framework/Scenes/Tests/TaskInventoryTests.cs | 12 ++++++------
.../Framework/Scenes/Tests/UserInventoryTests.cs | 4 ++--
.../Framework/Scenes/Tests/UuidGathererTests.cs | 2 +-
15 files changed, 65 insertions(+), 65 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
index 5586c65..85197db 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 f69a4b4..ebf595a 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 895f2bb..b7ff1b1 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 260d1c0..8b4771b 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 1b8c100..d201510 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 cb1d531..b09144d 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 c4047ee..8630476 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 c0fca5d..c2adb2a 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 8425d37..e0ab1c8 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 a37b338..8af1b38 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 13d93f9..8ffb22e 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 4074f5d..a3848a7 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 f4e14d4..a61832a 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 abca792..f6e2827 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 4da8df1..b0ea497 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);
}
--
cgit v1.1
From dad1d6df181151ae45fb998447b58d5589459627 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 00:31:03 +0100
Subject: rename TestHelper => TestHelpers for consistency
---
OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs | 8 ++++----
OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs | 8 ++++----
.../Region/Framework/Scenes/Tests/EntityManagerTests.cs | 4 ++--
OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs | 2 +-
.../Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 8 ++++----
.../Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | 4 ++--
.../Framework/Scenes/Tests/SceneObjectLinkingTests.cs | 8 ++++----
.../Framework/Scenes/Tests/SceneObjectResizeTests.cs | 4 ++--
.../Framework/Scenes/Tests/SceneObjectStatusTests.cs | 2 +-
.../Framework/Scenes/Tests/SceneObjectUserGroupTests.cs | 2 +-
.../Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 14 +++++++-------
OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | 2 +-
.../Framework/Scenes/Tests/StandaloneTeleportTests.cs | 2 +-
.../Region/Framework/Scenes/Tests/TaskInventoryTests.cs | 6 +++---
.../Region/Framework/Scenes/Tests/UserInventoryTests.cs | 4 ++--
OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | 4 ++--
16 files changed, 41 insertions(+), 41 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
index 85197db..fb28397 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 3a0dd00..ab6311b 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 ebf595a..a5d2b23 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 b7ff1b1..9a60e50 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 8b4771b..ff55680 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 d201510..c8a9ca3 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 b09144d..2912a46 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 8630476..b49c6e7 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 c2adb2a..2a342d5 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 e0ab1c8..e604885 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 8af1b38..9b5f52f 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 8ffb22e..8b8aea5 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 a3848a7..fb5a19f 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 a61832a..1abef8d 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 f6e2827..50b1a48 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 b0ea497..24de56e 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();
--
cgit v1.1
From 76f46b25454c0c9376130a59cc1b766c0d105dd0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 01:15:49 +0100
Subject: Do proper locking of m_localScenes list in SceneManager
---
OpenSim/Region/Framework/Scenes/SceneManager.cs | 233 ++++++++++++++----------
1 file changed, 140 insertions(+), 93 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 86ba2aa..069367d 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
--
cgit v1.1
From 83ba35a26bbbc844f4fd0f4964f3bc6155561e31 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 02:01:25 +0100
Subject: 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.
---
.../Scenes/Tests/ScenePresenceAgentTests.cs | 355 +++++++++++++++++++
.../Scenes/Tests/ScenePresenceTeleportTests.cs | 196 +++++++++++
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 385 ---------------------
.../Scenes/Tests/StandaloneTeleportTests.cs | 196 -----------
4 files changed, 551 insertions(+), 581 deletions(-)
create mode 100644 OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
create mode 100644 OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
new file mode 100644
index 0000000..04f5817
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -0,0 +1,355 @@
+/*
+ * 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.Reflection;
+using System.Text;
+using System.Threading;
+using System.Timers;
+using Timer=System.Timers.Timer;
+using Nini.Config;
+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.Framework.EntityTransfer;
+using OpenSim.Region.CoreModules.World.Serialiser;
+using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
+using OpenSim.Tests.Common;
+using OpenSim.Tests.Common.Mock;
+
+namespace OpenSim.Region.Framework.Scenes.Tests
+{
+ ///
+ /// Scene presence tests
+ ///
+ [TestFixture]
+ public class ScenePresenceAgentTests
+ {
+ public Scene scene, scene2, scene3;
+ public UUID agent1, agent2, agent3;
+ public static Random random;
+ public ulong region1,region2,region3;
+ public AgentCircuitData acd1;
+ public SceneObjectGroup sog1, sog2, sog3;
+ public TestClient testclient;
+
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ TestHelpers.InMethod();
+
+ 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();
+ SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
+ SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
+ SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
+
+ agent1 = UUID.Random();
+ agent2 = UUID.Random();
+ agent3 = UUID.Random();
+ random = new Random();
+ sog1 = SceneHelpers.CreateSceneObject(1, agent1);
+ scene.AddSceneObject(sog1);
+ sog2 = SceneHelpers.CreateSceneObject(1, agent1);
+ scene.AddSceneObject(sog2);
+ sog3 = SceneHelpers.CreateSceneObject(1, agent1);
+ scene.AddSceneObject(sog3);
+
+ region1 = scene.RegionInfo.RegionHandle;
+ region2 = scene2.RegionInfo.RegionHandle;
+ region3 = scene3.RegionInfo.RegionHandle;
+ }
+
+ ///
+ /// 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()
+ {
+ TestHelpers.InMethod();
+
+ string reason;
+
+ if (acd1 == null)
+ fixNullPresence();
+
+ scene.NewUserConnection(acd1, 0, out reason);
+ if (testclient == null)
+ testclient = new TestClient(acd1, scene);
+ scene.AddNewClient(testclient);
+
+ ScenePresence presence = scene.GetScenePresence(agent1);
+ presence.MakeRootAgent(new Vector3(90,90,90),false);
+
+ string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
+
+ presence.AddNeighbourRegion(region2, cap);
+ presence.AddNeighbourRegion(region3, cap);
+
+ List neighbours = presence.GetKnownRegionList();
+
+ Assert.That(neighbours.Count, Is.EqualTo(2));
+ }
+
+ [Test]
+ public void T013_TestRemoveNeighbourRegion()
+ {
+ TestHelpers.InMethod();
+
+ ScenePresence presence = scene.GetScenePresence(agent1);
+ presence.RemoveNeighbourRegion(region3);
+
+ List neighbours = presence.GetKnownRegionList();
+ Assert.That(neighbours.Count,Is.EqualTo(1));
+ /*
+ presence.MakeChildAgent;
+ presence.MakeRootAgent;
+ 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,
+ // and they sometimes fail in panda.
+ // We need to talk in order to develop a test
+ // that really tests region crossings. There are 3 async components,
+ // but things are synchronous among them. So there should be
+ // 3 threads in here.
+ //[Test]
+ public void T021_TestCrossToNewRegion()
+ {
+ TestHelpers.InMethod();
+
+ scene.RegisterRegionWithGrid();
+ scene2.RegisterRegionWithGrid();
+
+ // Adding child agent to region 1001
+ string reason;
+ scene2.NewUserConnection(acd1,0, out reason);
+ scene2.AddNewClient(testclient);
+
+ ScenePresence presence = scene.GetScenePresence(agent1);
+ presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
+
+ ScenePresence presence2 = scene2.GetScenePresence(agent1);
+
+ // Adding neighbour region caps info to presence2
+
+ string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
+ presence2.AddNeighbourRegion(region1, cap);
+
+ Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
+ Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
+
+ // Cross to x+1
+ presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
+ presence.Update();
+
+ EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
+
+ // Mimicking communication between client and server, by waiting OK from client
+ // sent by TestClient.CrossRegion call. Originally, this is network comm.
+ if (!wh.WaitOne(5000,false))
+ {
+ presence.Update();
+ if (!wh.WaitOne(8000,false))
+ throw new ArgumentException("1 - Timeout waiting for signal/variable.");
+ }
+
+ // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
+ // would normally be fired after receiving the reply packet from comm. done on the last line.
+ testclient.CompleteMovement();
+
+ // Crossings are asynchronous
+ int timer = 10;
+
+ // Make sure cross hasn't already finished
+ if (!presence.IsInTransit && !presence.IsChildAgent)
+ {
+ // If not and not in transit yet, give it some more time
+ Thread.Sleep(5000);
+ }
+
+ // Enough time, should at least be in transit by now.
+ while (presence.IsInTransit && timer > 0)
+ {
+ Thread.Sleep(1000);
+ timer-=1;
+ }
+
+ Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
+ Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
+ Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
+
+ // Cross Back
+ presence2.AbsolutePosition = new Vector3(-10, 3, 100);
+ presence2.Update();
+
+ if (!wh.WaitOne(5000,false))
+ {
+ presence2.Update();
+ if (!wh.WaitOne(8000,false))
+ throw new ArgumentException("2 - Timeout waiting for signal/variable.");
+ }
+ testclient.CompleteMovement();
+
+ if (!presence2.IsInTransit && !presence2.IsChildAgent)
+ {
+ // If not and not in transit yet, give it some more time
+ Thread.Sleep(5000);
+ }
+
+ // Enough time, should at least be in transit by now.
+ while (presence2.IsInTransit && timer > 0)
+ {
+ Thread.Sleep(1000);
+ timer-=1;
+ }
+
+ Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
+ Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
+ Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
+ }
+
+ public void fixNullPresence()
+ {
+ string firstName = "testfirstname";
+
+ AgentCircuitData agent = new AgentCircuitData();
+ agent.AgentID = agent1;
+ agent.firstname = firstName;
+ agent.lastname = "testlastname";
+ agent.SessionID = UUID.Zero;
+ agent.SecureSessionID = UUID.Zero;
+ agent.circuitcode = 123;
+ agent.BaseFolder = UUID.Zero;
+ agent.InventoryFolder = UUID.Zero;
+ agent.startpos = Vector3.Zero;
+ agent.CapsPath = GetRandomCapsObjectPath();
+
+ acd1 = agent;
+ }
+
+ public static string GetRandomCapsObjectPath()
+ {
+ UUID caps = UUID.Random();
+ string capsPath = caps.ToString();
+ capsPath = capsPath.Remove(capsPath.Length - 4, 4);
+ return capsPath;
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
new file mode 100644
index 0000000..4765a86
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -0,0 +1,196 @@
+/*
+ * 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 Nini.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenSim.Framework;
+using OpenSim.Framework.Communications;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
+using OpenSim.Tests.Common;
+using OpenSim.Tests.Common.Mock;
+using System.Threading;
+
+namespace OpenSim.Region.Framework.Scenes.Tests
+{
+ ///
+ /// Teleport tests in a standalone OpenSim
+ ///
+ [TestFixture]
+ public class ScenePresenceTeleportTests
+ {
+ ///
+ /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
+ ///
+ /// Does not yet do what is says on the tin.
+ /// Commenting for now
+ //[Test, LongRunning]
+ public void TestSimpleNotNeighboursTeleport()
+ {
+ TestHelpers.InMethod();
+ ThreadRunResults results = new ThreadRunResults();
+ results.Result = false;
+ results.Message = "Test did not run";
+ TestRunning testClass = new TestRunning(results);
+
+ Thread testThread = new Thread(testClass.run);
+
+ try
+ {
+ // Seems kind of redundant to start a thread and then join it, however.. We need to protect against
+ // A thread abort exception in the simulator code.
+ testThread.Start();
+ testThread.Join();
+ }
+ catch (ThreadAbortException)
+ {
+
+ }
+ Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message);
+ // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ try
+ {
+ if (MainServer.Instance != null) MainServer.Instance.Stop();
+ }
+ catch (NullReferenceException)
+ { }
+ }
+
+ }
+
+ public class ThreadRunResults
+ {
+ public bool Result = false;
+ public string Message = string.Empty;
+ }
+
+ public class TestRunning
+ {
+ public ThreadRunResults results;
+ public TestRunning(ThreadRunResults t)
+ {
+ results = t;
+ }
+ public void run(object o)
+ {
+
+ //results.Result = true;
+ log4net.Config.XmlConfigurator.Configure();
+
+ UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
+ UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
+
+ // shared module
+ ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
+
+
+ Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
+ SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
+ sceneB.RegisterRegionWithGrid();
+
+ 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 = SceneHelpers.AddClient(sceneA, agentId);
+
+ ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface();
+
+ results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl);
+
+ if (!results.Result)
+ {
+ results.Message = "Incorrect caps object path set up in sceneA";
+ return;
+ }
+
+ /*
+ Assert.That(
+ sceneACapsModule.GetCapsPath(agentId),
+ Is.EqualTo(client.CapsSeedUrl),
+ "Incorrect caps object path set up in sceneA");
+ */
+ // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
+
+
+ client.TeleportTargetScene = sceneB;
+ client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
+
+ results.Result = (sceneB.GetScenePresence(agentId) != null);
+ if (!results.Result)
+ {
+ results.Message = "Client does not have an agent in sceneB";
+ return;
+ }
+
+ //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
+
+ //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
+
+ results.Result = (sceneA.GetScenePresence(agentId) == null);
+ if (!results.Result)
+ {
+ results.Message = "Client still had an agent in sceneA";
+ return;
+ }
+
+ ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface();
+
+
+ results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort +
+ "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl);
+ if (!results.Result)
+ {
+ results.Message = "Incorrect caps object path set up in sceneB";
+ return;
+ }
+
+ // Temporary assertion - caps url construction should at least be doable through a method.
+ /*
+ Assert.That(
+ "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
+ Is.EqualTo(client.CapsSeedUrl),
+ "Incorrect caps object path set up in sceneB");
+ */
+ // This assertion will currently fail since we don't remove the caps paths when no longer needed
+ //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");
+
+ // TODO: Check that more of everything is as it should be
+
+ // TODO: test what happens if we try to teleport to a region that doesn't exist
+ }
+ }
+}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
deleted file mode 100644
index 9b5f52f..0000000
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * 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.Reflection;
-using System.Text;
-using System.Threading;
-using System.Timers;
-using Timer=System.Timers.Timer;
-using Nini.Config;
-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.Framework.EntityTransfer;
-using OpenSim.Region.CoreModules.World.Serialiser;
-using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
-using OpenSim.Tests.Common;
-using OpenSim.Tests.Common.Mock;
-
-namespace OpenSim.Region.Framework.Scenes.Tests
-{
- ///
- /// Scene presence tests
- ///
- [TestFixture]
- public class ScenePresenceTests
- {
- public Scene scene, scene2, scene3;
- public UUID agent1, agent2, agent3;
- public static Random random;
- public ulong region1,region2,region3;
- public AgentCircuitData acd1;
- public SceneObjectGroup sog1, sog2, sog3;
- public TestClient testclient;
-
- [TestFixtureSetUp]
- public void Init()
- {
- TestHelpers.InMethod();
-
- 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();
- SceneHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
- SceneHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
- SceneHelpers.SetupSceneModules(scene3, new IniConfigSource(), interregionComms);
-
- agent1 = UUID.Random();
- 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);
-
- //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
- region1 = scene.RegionInfo.RegionHandle;
- region2 = scene2.RegionInfo.RegionHandle;
- region3 = scene3.RegionInfo.RegionHandle;
- }
-
- ///
- /// 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()
- {
- TestHelpers.InMethod();
-
- string reason;
-
- if (acd1 == null)
- fixNullPresence();
-
- scene.NewUserConnection(acd1, 0, out reason);
- if (testclient == null)
- testclient = new TestClient(acd1, scene);
- scene.AddNewClient(testclient);
-
- ScenePresence presence = scene.GetScenePresence(agent1);
- presence.MakeRootAgent(new Vector3(90,90,90),false);
-
- string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
-
- presence.AddNeighbourRegion(region2, cap);
- presence.AddNeighbourRegion(region3, cap);
-
- List neighbours = presence.GetKnownRegionList();
-
- Assert.That(neighbours.Count, Is.EqualTo(2));
- }
-
- [Test]
- public void T013_TestRemoveNeighbourRegion()
- {
- TestHelpers.InMethod();
-
- ScenePresence presence = scene.GetScenePresence(agent1);
- presence.RemoveNeighbourRegion(region3);
-
- List neighbours = presence.GetKnownRegionList();
- Assert.That(neighbours.Count,Is.EqualTo(1));
- /*
- presence.MakeChildAgent;
- presence.MakeRootAgent;
- 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,
- // and they sometimes fail in panda.
- // We need to talk in order to develop a test
- // that really tests region crossings. There are 3 async components,
- // but things are synchronous among them. So there should be
- // 3 threads in here.
- //[Test]
- public void T021_TestCrossToNewRegion()
- {
- TestHelpers.InMethod();
-
- scene.RegisterRegionWithGrid();
- scene2.RegisterRegionWithGrid();
-
- // Adding child agent to region 1001
- string reason;
- scene2.NewUserConnection(acd1,0, out reason);
- scene2.AddNewClient(testclient);
-
- ScenePresence presence = scene.GetScenePresence(agent1);
- presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
-
- ScenePresence presence2 = scene2.GetScenePresence(agent1);
-
- // Adding neighbour region caps info to presence2
-
- string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
- presence2.AddNeighbourRegion(region1, cap);
-
- Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
- Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
-
- // Cross to x+1
- presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
- presence.Update();
-
- EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
-
- // Mimicking communication between client and server, by waiting OK from client
- // sent by TestClient.CrossRegion call. Originally, this is network comm.
- if (!wh.WaitOne(5000,false))
- {
- presence.Update();
- if (!wh.WaitOne(8000,false))
- throw new ArgumentException("1 - Timeout waiting for signal/variable.");
- }
-
- // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
- // would normally be fired after receiving the reply packet from comm. done on the last line.
- testclient.CompleteMovement();
-
- // Crossings are asynchronous
- int timer = 10;
-
- // Make sure cross hasn't already finished
- if (!presence.IsInTransit && !presence.IsChildAgent)
- {
- // If not and not in transit yet, give it some more time
- Thread.Sleep(5000);
- }
-
- // Enough time, should at least be in transit by now.
- while (presence.IsInTransit && timer > 0)
- {
- Thread.Sleep(1000);
- timer-=1;
- }
-
- Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
- Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
- Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
-
- // Cross Back
- presence2.AbsolutePosition = new Vector3(-10, 3, 100);
- presence2.Update();
-
- if (!wh.WaitOne(5000,false))
- {
- presence2.Update();
- if (!wh.WaitOne(8000,false))
- throw new ArgumentException("2 - Timeout waiting for signal/variable.");
- }
- testclient.CompleteMovement();
-
- if (!presence2.IsInTransit && !presence2.IsChildAgent)
- {
- // If not and not in transit yet, give it some more time
- Thread.Sleep(5000);
- }
-
- // Enough time, should at least be in transit by now.
- while (presence2.IsInTransit && timer > 0)
- {
- Thread.Sleep(1000);
- timer-=1;
- }
-
- Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
- Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
- Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
- }
-
- public void fixNullPresence()
- {
- string firstName = "testfirstname";
-
- AgentCircuitData agent = new AgentCircuitData();
- agent.AgentID = agent1;
- agent.firstname = firstName;
- agent.lastname = "testlastname";
- agent.SessionID = UUID.Zero;
- agent.SecureSessionID = UUID.Zero;
- agent.circuitcode = 123;
- agent.BaseFolder = UUID.Zero;
- agent.InventoryFolder = UUID.Zero;
- agent.startpos = Vector3.Zero;
- agent.CapsPath = GetRandomCapsObjectPath();
-
- acd1 = agent;
- }
-
- public static string GetRandomCapsObjectPath()
- {
- UUID caps = UUID.Random();
- string capsPath = caps.ToString();
- 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
- /// Teleport tests in a standalone OpenSim
- ///
- [TestFixture]
- public class StandaloneTeleportTests
- {
- ///
- /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
- ///
- /// Does not yet do what is says on the tin.
- /// Commenting for now
- //[Test, LongRunning]
- public void TestSimpleNotNeighboursTeleport()
- {
- TestHelpers.InMethod();
- ThreadRunResults results = new ThreadRunResults();
- results.Result = false;
- results.Message = "Test did not run";
- TestRunning testClass = new TestRunning(results);
-
- Thread testThread = new Thread(testClass.run);
-
- try
- {
- // Seems kind of redundant to start a thread and then join it, however.. We need to protect against
- // A thread abort exception in the simulator code.
- testThread.Start();
- testThread.Join();
- }
- catch (ThreadAbortException)
- {
-
- }
- Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message);
- // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
- }
-
- [TearDown]
- public void TearDown()
- {
- try
- {
- if (MainServer.Instance != null) MainServer.Instance.Stop();
- }
- catch (NullReferenceException)
- { }
- }
-
- }
-
- public class ThreadRunResults
- {
- public bool Result = false;
- public string Message = string.Empty;
- }
-
- public class TestRunning
- {
- public ThreadRunResults results;
- public TestRunning(ThreadRunResults t)
- {
- results = t;
- }
- public void run(object o)
- {
-
- //results.Result = true;
- log4net.Config.XmlConfigurator.Configure();
-
- UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100");
- UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200");
-
- // shared module
- ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
-
-
- Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010);
- SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
- sceneB.RegisterRegionWithGrid();
-
- 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 = SceneHelpers.AddClient(sceneA, agentId);
-
- ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface();
-
- results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl);
-
- if (!results.Result)
- {
- results.Message = "Incorrect caps object path set up in sceneA";
- return;
- }
-
- /*
- Assert.That(
- sceneACapsModule.GetCapsPath(agentId),
- Is.EqualTo(client.CapsSeedUrl),
- "Incorrect caps object path set up in sceneA");
- */
- // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
-
-
- client.TeleportTargetScene = sceneB;
- client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
-
- results.Result = (sceneB.GetScenePresence(agentId) != null);
- if (!results.Result)
- {
- results.Message = "Client does not have an agent in sceneB";
- return;
- }
-
- //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
-
- //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
-
- results.Result = (sceneA.GetScenePresence(agentId) == null);
- if (!results.Result)
- {
- results.Message = "Client still had an agent in sceneA";
- return;
- }
-
- ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface();
-
-
- results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort +
- "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl);
- if (!results.Result)
- {
- results.Message = "Incorrect caps object path set up in sceneB";
- return;
- }
-
- // Temporary assertion - caps url construction should at least be doable through a method.
- /*
- Assert.That(
- "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
- Is.EqualTo(client.CapsSeedUrl),
- "Incorrect caps object path set up in sceneB");
- */
- // This assertion will currently fail since we don't remove the caps paths when no longer needed
- //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");
-
- // TODO: Check that more of everything is as it should be
-
- // TODO: test what happens if we try to teleport to a region that doesn't exist
- }
- }
-}
--
cgit v1.1
From 85e07c78fbed9e85c142c0f565c27015ad95769d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 02:17:41 +0100
Subject: refactor: Change SceneHelpers.AddClient() to AddScenePresence().
This seems to make more sense as we can get SP.ControllingClient
---
.../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 ++++++++++++----------
.../Scenes/Tests/ScenePresenceTeleportTests.cs | 2 +-
6 files changed, 47 insertions(+), 37 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
index fb28397..07b30f4 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 ff55680..1ea2329 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 c8a9ca3..654b1a2 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 e604885..c13d82e 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 04f5817..73acf28 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 4765a86..39bb43a 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();
--
cgit v1.1
From e37f8cf90270ba6e1605bdb528ca205a35cfe049 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 02:27:25 +0100
Subject: 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(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 73acf28..6cf905a 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");
--
cgit v1.1
From eec54adac5b6745c147ac7f7db947dba16e39d06 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 02:38:38 +0100
Subject: remove some obsolete tests that are now done elsewhere
---
.../Scenes/Tests/ScenePresenceAgentTests.cs | 106 ++++++++++-----------
1 file changed, 53 insertions(+), 53 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 6cf905a..dd2c717 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()
--
cgit v1.1
From 6878049952ba25f853720d8f7fe0644569454c00 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 6 Aug 2011 03:06:05 +0100
Subject: get rid of bogus log message
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 -------
1 file changed, 7 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d354c0a..cd5228d 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;
--
cgit v1.1
From e869eeb0bfc48c769f680970f99e4c67dd5a1a70 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 9 Aug 2011 03:51:34 +0100
Subject: 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/Region/Framework/Interfaces/IAvatarFactory.cs | 8 ++++++++
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 19 ++++++++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactory.cs
index d0e5609..6817725 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 fa8d6b6..54575ca 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
@@ -44,6 +45,23 @@ namespace OpenSim.Region.Framework.Interfaces
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.
///
/// The UUID of the NPC
@@ -59,7 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces
///
void Say(UUID agentID, Scene scene, string text);
-
///
/// Delete an NPC.
///
--
cgit v1.1
From 92e96d394a1712ed16b0a7835dd2ccfde01f3fee Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 9 Aug 2011 23:11:07 +0100
Subject: When an NPC is created, stop telling neighbouring regions to expect a
child agent
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cd5228d..af28dd9 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)
--
cgit v1.1
From 195c1dc9b8b8511980d9a607a242b24a5a91da17 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 10 Aug 2011 00:26:38 +0100
Subject: implement osNpcStopMoveTo() to cancel any current move target
---
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 54575ca..763d2dc 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
--
cgit v1.1
From 4cb8d6379ddb39cfb8b30a63475e154a00a78110 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 10 Aug 2011 00:59:31 +0100
Subject: Stop trying to deregister caps or close child agents when an NPC is
removed
---
OpenSim/Region/Framework/Scenes/Scene.cs | 15 +++++++--------
OpenSim/Region/Framework/Scenes/SceneBase.cs | 12 +-----------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++---
3 files changed, 11 insertions(+), 22 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b3b6cbc..9aa9bf5 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 c4547f2..2f1cdc1 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 af28dd9..2db83eb 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)
--
cgit v1.1
From 5d6c9644faf6aeac38410af9cff97adfef88d7aa Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 10 Aug 2011 01:47:37 +0100
Subject: 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.
---
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 6 +++++-
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++++--
3 files changed, 13 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 763d2dc..06296c9 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 3b6a458..fe96152 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 2db83eb..b8e4e93 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;
--
cgit v1.1
From 7f499ff3f386d57bcd81ebb3f58f110011100604 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 10 Aug 2011 23:56:19 +0100
Subject: 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
---
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 06296c9..08b973d 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.
--
cgit v1.1
From 951ffad81e15a35bc9f847ea1448dd247a2e6e6f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Aug 2011 00:23:54 +0100
Subject: 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 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b8e4e93..12a4712 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;
--
cgit v1.1
From 4402851b086e7faf0d441d2ae0d5f6a3e1ea04b8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Aug 2011 01:56:42 +0100
Subject: 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.
---
.../Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 10 ++++++++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++
2 files changed, 14 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4ab818f..e07d8b4 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
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 12a4712..7a30684 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1745,6 +1745,12 @@ namespace OpenSim.Region.Framework.Scenes
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()
--
cgit v1.1
From 29093df1a7f3d2816d1b446524b2de18b0b5ac45 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Aug 2011 02:36:02 +0100
Subject: 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(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7a30684..e28d1fe 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
--
cgit v1.1
From 36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Aug 2011 02:54:15 +0100
Subject: instead of setting avatar rotation twice in SP.HandleAgentUpdate(),
eliminate the second setting in AddNewMovement()
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 30 +++++++++++-------------
1 file changed, 14 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e28d1fe..a1bd672 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;
--
cgit v1.1
From 1aa171189397f34d7d18fb358f7bd767d241675a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Aug 2011 03:05:51 +0100
Subject: 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 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a1bd672..afa896c 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);
}
--
cgit v1.1
From b3a4b1053157d65d0068bf5b3362dc28da4be85a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Aug 2011 03:16:46 +0100
Subject: 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(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index afa896c..18632d7 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();
}
--
cgit v1.1
From 50945dd56029a1280c581ea9b29213ab0e162a0a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Aug 2011 21:43:26 +0100
Subject: add regression test for osNpcCreate when cloning an in-region avatar
---
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 08b973d..5e5c4a1 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.
--
cgit v1.1
From 9a6ad1535e83a4d1b216ae879173ab8c524da60b Mon Sep 17 00:00:00 2001
From: Snoopy Pfeffer
Date: Mon, 15 Aug 2011 17:46:51 +0200
Subject: 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(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 9aa9bf5..13b4cbc 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)
--
cgit v1.1
From 66eb537d0cedfd017fd8872fb1b60ed15d871d2b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 16 Aug 2011 21:56:56 +0100
Subject: relocate AttachmentTests.cs to AttachmentsModuleTests.cs
---
.../Framework/Scenes/Tests/AttachmentTests.cs | 172 ---------------------
1 file changed, 172 deletions(-)
delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
deleted file mode 100644
index 07b30f4..0000000
--- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.Reflection;
-using System.Text;
-using System.Threading;
-using System.Timers;
-using Timer=System.Timers.Timer;
-using Nini.Config;
-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.World.Serialiser;
-using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
-using OpenSim.Tests.Common;
-using OpenSim.Tests.Common.Mock;
-
-namespace OpenSim.Region.Framework.Scenes.Tests
-{
- ///
- /// Attachment tests
- ///
- [TestFixture]
- public class AttachmentTests
- {
- public Scene scene, scene2;
- public UUID agent1;
- public static Random random;
- public ulong region1, region2;
- public AgentCircuitData acd1;
- public SceneObjectGroup sog1, sog2, sog3;
-
- [TestFixtureSetUp]
- public void Init()
- {
- 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();
- 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;
- region2 = scene2.RegionInfo.RegionHandle;
-
- SceneHelpers.AddScenePresence(scene, agent1);
- }
-
- [Test]
- public void T030_TestAddAttachments()
- {
- TestHelpers.InMethod();
-
- ScenePresence presence = scene.GetScenePresence(agent1);
-
- presence.AddAttachment(sog1);
- presence.AddAttachment(sog2);
- presence.AddAttachment(sog3);
-
- Assert.That(presence.HasAttachments(), Is.True);
- Assert.That(presence.ValidateAttachments(), Is.True);
- }
-
- [Test]
- public void T031_RemoveAttachments()
- {
- TestHelpers.InMethod();
-
- ScenePresence presence = scene.GetScenePresence(agent1);
- presence.RemoveAttachment(sog1);
- presence.RemoveAttachment(sog2);
- presence.RemoveAttachment(sog3);
- Assert.That(presence.HasAttachments(), Is.False);
- }
-
- // 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");
- }
-
- 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 < size; i++)
- {
- ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
- name.Append(ch);
- }
-
- return name.ToString();
- }
- }
-}
\ No newline at end of file
--
cgit v1.1
From d73c42407848edbf7d9c37fab17585fd6038c269 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 16 Aug 2011 23:12:58 +0100
Subject: 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(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 18632d7..90c4706 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)
--
cgit v1.1
From 696bd448334c89607c95385f05a53e2ab72cb984 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 17 Aug 2011 00:37:33 +0100
Subject: Add new regression TestRezAttachmentsOnAvatarEntrance() to do simple
attachments check
---
OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index 50b1a48..55fc1e7 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");
--
cgit v1.1
From acfdca34fd9bf6d66d144ae5c0a325dd5e864517 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 17 Aug 2011 01:35:33 +0100
Subject: 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
---
OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 6cc64c6..4cb3df2 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);
--
cgit v1.1
From c1a34cd8da293e63d3cba70b5271c9a297789db2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 18 Aug 2011 00:53:05 +0100
Subject: 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/Region/Framework/Scenes/Scene.cs | 9 +++++----
OpenSim/Region/Framework/Scenes/SceneBase.cs | 2 +-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 +++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++++++---
.../Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 4 ++--
5 files changed, 20 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 13b4cbc..ae88a87 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 2f1cdc1..ec94f10 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 65dc2c9..f40b373 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 90c4706..e3bd393 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 dd2c717..35b41fb 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);
--
cgit v1.1
From 45c37ef494df3e6303a2c0346cb239731d448bed Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 18 Aug 2011 01:11:23 +0100
Subject: 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(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e3bd393..564a456 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;
}
--
cgit v1.1
From 49258350e8e34ce36bce08a2f40b8824d67449ab Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 18 Aug 2011 01:22:01 +0100
Subject: refactor: fold CreateSceneViewer() back into ScenePresence
constructor
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 564a456..719f2da 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;
--
cgit v1.1
From c9e6b7bd10b2cdaa917e41259ae0d612f2171f7a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 19 Aug 2011 00:45:22 +0100
Subject: 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
---
.../Region/Framework/Interfaces/IUserManagement.cs | 37 ++++++++++++++++++-
OpenSim/Region/Framework/Scenes/Scene.cs | 42 ++++++++++++++--------
2 files changed, 64 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index 5d30aa8..c66e053 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 ae88a87..513c0ea 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)
+ {
+ uMan.AddUser(aCircuit.AgentID, first, last);
+ }
+ else
{
- string[] parts = aCircuit.firstname.Split('.');
- if (parts.Length >= 2)
+ string homeURL = string.Empty;
+
+ if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
+ homeURL = aCircuit.ServiceURLs["HomeURI"].ToString();
+
+ if (aCircuit.lastname.StartsWith("@"))
{
- first = parts[0];
- last = parts[1];
+ string[] parts = aCircuit.firstname.Split('.');
+ if (parts.Length >= 2)
+ {
+ first = parts[0];
+ last = parts[1];
+ }
}
- }
- uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
+ uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
+ }
}
}
--
cgit v1.1
From bb5b396fc5ac15d7451df407e75c2ca99c0b9dd1 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Thu, 18 Aug 2011 15:27:03 -0700
Subject: Fix exception when using BasicPhysics
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 7778ebc..a0e87d0 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)
--
cgit v1.1