From f5316984abfcf72870c7e4d50c95c1cabc8cc588 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 25 Jun 2012 23:31:22 +0100
Subject: minor: update currently commented out log message at top of
AvatarFactoryModule.SetAppearance() for future use
---
.../Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 705233c..68a4cde 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -128,7 +128,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
///
public void SetAppearance(IScenePresence sp, Primitive.TextureEntry textureEntry, byte[] visualParams)
{
- // m_log.InfoFormat("[AVFACTORY]: start SetAppearance for {0}", client.AgentId);
+// m_log.DebugFormat(
+// "[AVFACTORY]: start SetAppearance for {0}, te {1}, visualParams {2}",
+// sp.Name, textureEntry, visualParams);
// TODO: This is probably not necessary any longer, just assume the
// textureEntry set implies that the appearance transaction is complete
--
cgit v1.1
From 988112d4460adb2c6621027145f4fe60b079c7e5 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Tue, 26 Jun 2012 15:14:25 -0400
Subject: Add stub for llCastRay
---
OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 06f5617..a0b3bc8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -954,6 +954,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llRequestDisplayName(id);
}
+ public LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
+ {
+ return m_LSL_Functions.llCastRay(start, end, options);
+ }
+
public void llLinkParticleSystem(int linknum, LSL_List rules)
{
m_LSL_Functions.llLinkParticleSystem(linknum, rules);
--
cgit v1.1
From 4b6c3fd4bb8e4c989a7f0b4c0687379ea4bc63c1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Jun 2012 21:06:47 +0100
Subject: If crossing attachments into another region pre-fatpack, clone
objects before changing properties to avoid hud display race condition with
update threads.
This matches behaviour in fatpack crossing, where attachments are cloned before their properties are changed.
This only applies to crossings to simulators running code released before April 2011.
---
.../EntityTransfer/EntityTransferModule.cs | 43 +++++++++++++---------
1 file changed, 26 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 7d82060..f5ebe97 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1666,6 +1666,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#endregion
#region Object Transfers
+
///
/// Move the given scene object into a new region depending on which region its absolute position has moved
/// into.
@@ -1967,35 +1968,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return successYN;
}
- protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
+ ///
+ /// Cross the attachments for an avatar into the destination region.
+ ///
+ ///
+ /// This is only invoked for simulators released prior to April 2011. Versions of OpenSimulator since then
+ /// transfer attachments in one go as part of the ChildAgentDataUpdate data passed in the update agent call.
+ ///
+ ///
+ ///
+ ///
+ protected void CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
{
- List m_attachments = sp.GetAttachments();
+ List attachments = sp.GetAttachments();
- // Validate
-// foreach (SceneObjectGroup gobj in m_attachments)
-// {
-// if (gobj == null || gobj.IsDeleted)
-// return false;
-// }
+// m_log.DebugFormat(
+// "[ENTITY TRANSFER MODULE]: Crossing {0} attachments into {1} for {2}",
+// m_attachments.Count, destination.RegionName, sp.Name);
- foreach (SceneObjectGroup gobj in m_attachments)
+ foreach (SceneObjectGroup gobj in attachments)
{
// If the prim group is null then something must have happened to it!
if (gobj != null && !gobj.IsDeleted)
{
- // Set the parent localID to 0 so it transfers over properly.
- gobj.RootPart.SetParentLocalId(0);
- gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
- gobj.IsAttachment = false;
+ SceneObjectGroup clone = (SceneObjectGroup)gobj.CloneForNewScene();
+ clone.RootPart.GroupPosition = gobj.RootPart.AttachedPos;
+ clone.IsAttachment = false;
+
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
- m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
- CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent);
+ m_log.DebugFormat(
+ "[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}",
+ clone.UUID, destination.RegionName);
+
+ CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, clone, silent);
}
}
sp.ClearAttachments();
-
- return true;
}
#endregion
--
cgit v1.1
From 32a4ce94f0b896eff0ca5b91b30714e776132acf Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Jun 2012 22:16:44 +0100
Subject: Add regression test to check that attachments in source region are
deleting when an agent teleports to a neighbouring region
---
.../Attachments/Tests/AttachmentsModuleTests.cs | 133 ++++++++++++++++++---
.../EntityTransfer/EntityTransferModule.cs | 5 +
2 files changed, 120 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 8f4a807..695994f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -38,6 +38,8 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.CoreModules.Avatar.Attachments;
+using OpenSim.Region.CoreModules.Framework;
+using OpenSim.Region.CoreModules.Framework.EntityTransfer;
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
@@ -54,7 +56,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
[TestFixture]
public class AttachmentsModuleTests
{
- private Scene scene;
private AttachmentsModule m_attMod;
private ScenePresence m_presence;
@@ -80,24 +81,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Util.FireAndForgetMethod = FireAndForgetMethod.None;
}
- [SetUp]
- public void Init()
+ [TestFixtureTearDown]
+ public void TearDown()
+ {
+ // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
+ // threads. Possibly, later tests should be rewritten not to worry about such things.
+ Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
+ }
+
+ private Scene CreateDefaultTestScene()
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
- scene = new SceneHelpers().SetupScene();
+ Scene scene = new SceneHelpers().SetupScene();
m_attMod = new AttachmentsModule();
SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
- }
- [TestFixtureTearDown]
- public void TearDown()
- {
- // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
- // threads. Possibly, later tests should be rewritten not to worry about such things.
- Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
+ return scene;
}
///
@@ -109,11 +111,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
///
/// The attachment item.
///
+ ///
///
///
///
///
- private InventoryItemBase CreateAttachmentItem(UUID userId, string attName, int rawItemId, int rawAssetId)
+ private InventoryItemBase CreateAttachmentItem(
+ Scene scene, UUID userId, string attName, int rawItemId, int rawAssetId)
{
return UserInventoryHelpers.CreateInventoryItem(
scene,
@@ -130,6 +134,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
+ Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
@@ -171,10 +176,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
+ Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
m_attMod.RezSingleAttachmentFromInventory(
m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
@@ -201,10 +207,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
+ Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
ISceneEntity so
= m_attMod.RezSingleAttachmentFromInventory(
@@ -232,10 +239,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
+ Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
m_attMod.RezSingleAttachmentFromInventory(
m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
@@ -259,8 +267,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
+ Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
acd.Appearance = new AvatarAppearance();
@@ -281,8 +290,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
+ Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
acd.Appearance = new AvatarAppearance();
@@ -314,8 +324,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
{
TestHelpers.InMethod();
+ Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
acd.Appearance = new AvatarAppearance();
@@ -332,6 +343,92 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition));
}
+ [Test]
+ public void TestSameSimulatorNeighbouringRegionsTeleport()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ AttachmentsModule attModA = new AttachmentsModule();
+ AttachmentsModule attModB = new AttachmentsModule();
+ EntityTransferModule etmA = new EntityTransferModule();
+ EntityTransferModule etmB = new EntityTransferModule();
+ LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
+
+ IConfigSource config = new IniConfigSource();
+ IConfig modulesConfig = config.AddConfig("Modules");
+ modulesConfig.Set("EntityTransferModule", etmA.Name);
+ modulesConfig.Set("SimulationServices", lscm.Name);
+ IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
+
+ // In order to run a single threaded regression test we do not want the entity transfer module waiting
+ // for a callback from the destination scene before removing its avatar data.
+ entityTransferConfig.Set("wait_for_callback", false);
+
+ SceneHelpers sh = new SceneHelpers();
+ TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
+ TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
+
+ SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
+ SceneHelpers.SetupSceneModules(
+ sceneA, config, new CapabilitiesModule(), etmA, attModA, new BasicInventoryAccessModule());
+ SceneHelpers.SetupSceneModules(
+ sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());
+
+ UserAccountHelpers.CreateUserWithInventory(sceneA, m_userId);
+ ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, m_userId, sh.SceneManager);
+ beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
+
+ InventoryItemBase attItem = CreateAttachmentItem(sceneA, m_userId, "att", 0x10, 0x20);
+
+ m_attMod.RezSingleAttachmentFromInventory(
+ beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);
+
+ Vector3 teleportPosition = new Vector3(10, 11, 12);
+ Vector3 teleportLookAt = new Vector3(20, 21, 22);
+
+ sceneA.RequestTeleportLocation(
+ beforeTeleportSp.ControllingClient,
+ sceneB.RegionInfo.RegionHandle,
+ teleportPosition,
+ teleportLookAt,
+ (uint)TeleportFlags.ViaLocation);
+
+ ((TestClient)beforeTeleportSp.ControllingClient).CompleteTeleportClientSide();
+
+ // Check attachments have made it into sceneB
+ ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(m_userId);
+
+ // This is appearance data, as opposed to actually rezzed attachments
+ List sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();
+ Assert.That(sceneBAttachments.Count, Is.EqualTo(1));
+ Assert.That(sceneBAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest));
+ Assert.That(sceneBAttachments[0].ItemID, Is.EqualTo(attItem.ID));
+ Assert.That(sceneBAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
+ Assert.That(afterTeleportSceneBSp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
+
+ // This is the actual attachment
+ List actualSceneBAttachments = afterTeleportSceneBSp.GetAttachments();
+ Assert.That(actualSceneBAttachments.Count, Is.EqualTo(1));
+ SceneObjectGroup actualSceneBAtt = actualSceneBAttachments[0];
+ Assert.That(actualSceneBAtt.Name, Is.EqualTo(attItem.Name));
+ Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
+
+ // Check attachments have been removed from sceneA
+ ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(m_userId);
+
+ // Since this is appearance data, it is still present on the child avatar!
+ List sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();
+ Assert.That(sceneAAttachments.Count, Is.EqualTo(1));
+ Assert.That(afterTeleportSceneASp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
+
+ // This is the actual attachment, which should no longer exist
+ List actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();
+ Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));
+
+// TestHelpers.DisableLogging();
+ }
+
// I'm commenting this test because scene setup NEEDS InventoryService to
// be non-null
//[Test]
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index f5ebe97..46738f6 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -709,6 +709,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.CallbackURI, region.RegionName);
}
+ ///
+ /// Clean up operations once an agent has moved away through cross or teleport.
+ ///
+ ///
+ ///
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
{
if (sp.Scene.AttachmentsModule != null)
--
cgit v1.1
From 4329cc7b8a698acc6154f3e195c6261c61014916 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Jun 2012 22:21:54 +0100
Subject: refactor: make m_presence a local variable in all
AttachmentsModuleTests since it doesn't need to be global and some tests set
up more than one sp
---
.../Attachments/Tests/AttachmentsModuleTests.cs | 51 +++++++++++-----------
1 file changed, 25 insertions(+), 26 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 695994f..4c750bc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -57,7 +57,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
public class AttachmentsModuleTests
{
private AttachmentsModule m_attMod;
- private ScenePresence m_presence;
///
/// Standard user ID
@@ -136,17 +135,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
string attName = "att";
- SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup;
+ SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID).ParentGroup;
- m_attMod.AttachObject(m_presence, so, (uint)AttachmentPoint.Chest, false);
+ m_attMod.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false);
// Check status on scene presence
- Assert.That(m_presence.HasAttachments(), Is.True);
- List attachments = m_presence.GetAttachments();
+ Assert.That(sp.HasAttachments(), Is.True);
+ List attachments = sp.GetAttachments();
Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0];
Assert.That(attSo.Name, Is.EqualTo(attName));
@@ -157,14 +156,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// Check item status
Assert.That(
- m_presence.Appearance.GetAttachpoint(attSo.FromItemID),
+ sp.Appearance.GetAttachpoint(attSo.FromItemID),
Is.EqualTo((int)AttachmentPoint.Chest));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(attName));
- InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(m_presence.UUID, AssetType.Object);
+ InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object);
Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
// TestHelpers.DisableLogging();
@@ -178,16 +177,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
m_attMod.RezSingleAttachmentFromInventory(
- m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
+ sp, attItem.ID, (uint)AttachmentPoint.Chest);
// Check scene presence status
- Assert.That(m_presence.HasAttachments(), Is.True);
- List attachments = m_presence.GetAttachments();
+ Assert.That(sp.HasAttachments(), Is.True);
+ List attachments = sp.GetAttachments();
Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0];
Assert.That(attSo.Name, Is.EqualTo(attItem.Name));
@@ -197,8 +196,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attSo.IsTemporary, Is.False);
// Check appearance status
- Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1));
- Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
+ Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
+ Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
}
[Test]
@@ -209,22 +208,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
ISceneEntity so
= m_attMod.RezSingleAttachmentFromInventory(
- m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
- m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId);
+ sp, attItem.ID, (uint)AttachmentPoint.Chest);
+ m_attMod.DetachSingleAttachmentToGround(sp, so.LocalId);
// Check scene presence status
- Assert.That(m_presence.HasAttachments(), Is.False);
- List attachments = m_presence.GetAttachments();
+ Assert.That(sp.HasAttachments(), Is.False);
+ List attachments = sp.GetAttachments();
Assert.That(attachments.Count, Is.EqualTo(0));
// Check appearance status
- Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0));
+ Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(0));
// Check item status
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
@@ -241,21 +240,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Scene scene = CreateDefaultTestScene();
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
m_attMod.RezSingleAttachmentFromInventory(
- m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
- m_attMod.DetachSingleAttachmentToInv(m_presence, attItem.ID);
+ sp, attItem.ID, (uint)AttachmentPoint.Chest);
+ m_attMod.DetachSingleAttachmentToInv(sp, attItem.ID);
// Check status on scene presence
- Assert.That(m_presence.HasAttachments(), Is.False);
- List attachments = m_presence.GetAttachments();
+ Assert.That(sp.HasAttachments(), Is.False);
+ List attachments = sp.GetAttachments();
Assert.That(attachments.Count, Is.EqualTo(0));
// Check item status
- Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
+ Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
}
///
--
cgit v1.1
From 2b82c421adf23cc47e1dc4f6da941b7cd2a407b6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Jun 2012 22:31:25 +0100
Subject: refactor: Use local attachment module variables instead of global
m_attMod.
This also avoids confusion between tests where one sets up m_attMod and another accidentally uses it after failing to set one up itself.
---
.../Attachments/Tests/AttachmentsModuleTests.cs | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 4c750bc..d233faf 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -56,8 +56,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
[TestFixture]
public class AttachmentsModuleTests
{
- private AttachmentsModule m_attMod;
-
///
/// Standard user ID
///
@@ -95,8 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
Scene scene = new SceneHelpers().SetupScene();
- m_attMod = new AttachmentsModule();
- SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
+ SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule());
return scene;
}
@@ -141,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID).ParentGroup;
- m_attMod.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false);
+ scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false);
// Check status on scene presence
Assert.That(sp.HasAttachments(), Is.True);
@@ -181,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
- m_attMod.RezSingleAttachmentFromInventory(
+ scene.AttachmentsModule.RezSingleAttachmentFromInventory(
sp, attItem.ID, (uint)AttachmentPoint.Chest);
// Check scene presence status
@@ -213,9 +210,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
ISceneEntity so
- = m_attMod.RezSingleAttachmentFromInventory(
+ = scene.AttachmentsModule.RezSingleAttachmentFromInventory(
sp, attItem.ID, (uint)AttachmentPoint.Chest);
- m_attMod.DetachSingleAttachmentToGround(sp, so.LocalId);
+ scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId);
// Check scene presence status
Assert.That(sp.HasAttachments(), Is.False);
@@ -244,9 +241,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
- m_attMod.RezSingleAttachmentFromInventory(
+ scene.AttachmentsModule.RezSingleAttachmentFromInventory(
sp, attItem.ID, (uint)AttachmentPoint.Chest);
- m_attMod.DetachSingleAttachmentToInv(sp, attItem.ID);
+ scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, attItem.ID);
// Check status on scene presence
Assert.That(sp.HasAttachments(), Is.False);
@@ -364,6 +361,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// for a callback from the destination scene before removing its avatar data.
entityTransferConfig.Set("wait_for_callback", false);
+ modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule");
+
SceneHelpers sh = new SceneHelpers();
TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
@@ -380,7 +379,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
InventoryItemBase attItem = CreateAttachmentItem(sceneA, m_userId, "att", 0x10, 0x20);
- m_attMod.RezSingleAttachmentFromInventory(
+ sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);
Vector3 teleportPosition = new Vector3(10, 11, 12);
--
cgit v1.1
From 99954c14980817adae427ab8ac4cdf07cbad0d7d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Jun 2012 22:53:08 +0100
Subject: refactor: Remove unnecessary AttachmentModuleTests.m_userId in favour
of local variables
---
.../Attachments/Tests/AttachmentsModuleTests.cs | 66 +++++++++-------------
1 file changed, 26 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index d233faf..ddfc6cb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
@@ -56,21 +57,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
[TestFixture]
public class AttachmentsModuleTests
{
- ///
- /// Standard user ID
- ///
- private UUID m_userId = TestHelpers.ParseTail(0x1);
-
-// ///
-// /// Standard attachment item ID
-// ///
-// private UUID m_attItemId = TestHelpers.ParseTail(0x10);
-//
-// ///
-// /// Standard attachment asset ID
-// ///
-// private UUID m_attAssetId = TestHelpers.ParseTail(0x11);
-
[TestFixtureSetUp]
public void FixtureInit()
{
@@ -131,8 +117,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// TestHelpers.EnableLogging();
Scene scene = CreateDefaultTestScene();
- UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
string attName = "att";
@@ -173,10 +159,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = CreateDefaultTestScene();
- UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
- InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
sp, attItem.ID, (uint)AttachmentPoint.Chest);
@@ -204,10 +190,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = CreateDefaultTestScene();
- UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
- InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
ISceneEntity so
= scene.AttachmentsModule.RezSingleAttachmentFromInventory(
@@ -236,10 +222,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = CreateDefaultTestScene();
- UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- ScenePresence sp = SceneHelpers.AddScenePresence(scene, m_userId);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
- InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
sp, attItem.ID, (uint)AttachmentPoint.Chest);
@@ -264,10 +250,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = CreateDefaultTestScene();
- UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
- AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
acd.Appearance = new AvatarAppearance();
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
@@ -287,10 +273,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// log4net.Config.XmlConfigurator.Configure();
Scene scene = CreateDefaultTestScene();
- UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
- AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
acd.Appearance = new AvatarAppearance();
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
@@ -321,10 +307,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
Scene scene = CreateDefaultTestScene();
- UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
- InventoryItemBase attItem = CreateAttachmentItem(scene, m_userId, "att", 0x10, 0x20);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
+ InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
- AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
acd.Appearance = new AvatarAppearance();
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd);
@@ -373,11 +359,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneHelpers.SetupSceneModules(
sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());
- UserAccountHelpers.CreateUserWithInventory(sceneA, m_userId);
- ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, m_userId, sh.SceneManager);
+ UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);
+ ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, ua1.PrincipalID, sh.SceneManager);
beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
- InventoryItemBase attItem = CreateAttachmentItem(sceneA, m_userId, "att", 0x10, 0x20);
+ InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20);
sceneA.AttachmentsModule.RezSingleAttachmentFromInventory(
beforeTeleportSp, attItem.ID, (uint)AttachmentPoint.Chest);
@@ -395,7 +381,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
((TestClient)beforeTeleportSp.ControllingClient).CompleteTeleportClientSide();
// Check attachments have made it into sceneB
- ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(m_userId);
+ ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID);
// This is appearance data, as opposed to actually rezzed attachments
List sceneBAttachments = afterTeleportSceneBSp.Appearance.GetAttachments();
@@ -413,7 +399,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(actualSceneBAtt.AttachmentPoint, Is.EqualTo((uint)AttachmentPoint.Chest));
// Check attachments have been removed from sceneA
- ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(m_userId);
+ ScenePresence afterTeleportSceneASp = sceneA.GetScenePresence(ua1.PrincipalID);
// Since this is appearance data, it is still present on the child avatar!
List sceneAAttachments = afterTeleportSceneASp.Appearance.GetAttachments();
--
cgit v1.1
From 0b298777907d29027336813d84e589f0cb78419b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Jun 2012 23:15:15 +0100
Subject: Fix output for help on some object region console commands
---
.../CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 830d9cb..e5cd3e2 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -98,7 +98,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
m_console.Commands.AddCommand(
"Objects", false, "delete object name",
"delete object name [--regex] ",
- "Delete a scene object by name.\nIf --regex is specified then the name is treatead as a regular expression",
+ "Delete a scene object by name.",
+ "If --regex is specified then the name is treatead as a regular expression",
HandleDeleteObject);
m_console.Commands.AddCommand(
@@ -118,7 +119,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
false,
"show object name",
"show object name [--regex] ",
- "Show details of scene objects with the given name.\nIf --regex is specified then the name is treatead as a regular expression",
+ "Show details of scene objects with the given name.",
+ "If --regex is specified then the name is treatead as a regular expression",
HandleShowObjectByName);
m_console.Commands.AddCommand(
@@ -133,7 +135,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
false,
"show part name",
"show part name [--regex] ",
- "Show details of scene object parts with the given name.\nIf --regex is specified then the name is treatead as a regular expression",
+ "Show details of scene object parts with the given name.",
+ "If --regex is specified then the name is treatead as a regular expression",
HandleShowPartByName);
}
--
cgit v1.1
From 87ca820f9bc19fc1f8c7b88a87bdef59e0a5bd0b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Jun 2012 23:28:48 +0100
Subject: Replace "kill uuid" console command with the more consistent "delete
object uuid", which was present in the last opensim release.
---
OpenSim/Region/Application/OpenSim.cs | 56 -----------------------------------
1 file changed, 56 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 04ff4e6..56ad5c9 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -409,10 +409,6 @@ namespace OpenSim
m_console.Commands.AddCommand("General", false, "modules unload",
"modules unload ",
"Unload a module", HandleModules);
-
- m_console.Commands.AddCommand("Objects", false, "kill uuid",
- "kill uuid ",
- "Kill an object by UUID", KillUUID);
}
public override void ShutdownSpecific()
@@ -1309,58 +1305,6 @@ namespace OpenSim
return result;
}
- ///
- /// Kill an object given its UUID.
- ///
- ///
- protected void KillUUID(string module, string[] cmdparams)
- {
- if (cmdparams.Length > 2)
- {
- UUID id = UUID.Zero;
- SceneObjectGroup grp = null;
- Scene sc = null;
-
- if (!UUID.TryParse(cmdparams[2], out id))
- {
- MainConsole.Instance.Output("[KillUUID]: Error bad UUID format!");
- return;
- }
-
- m_sceneManager.ForEachScene(
- delegate(Scene scene)
- {
- SceneObjectPart part = scene.GetSceneObjectPart(id);
- if (part == null)
- return;
-
- grp = part.ParentGroup;
- sc = scene;
- });
-
- if (grp == null)
- {
- MainConsole.Instance.Output(String.Format("[KillUUID]: Given UUID {0} not found!", id));
- }
- else
- {
- MainConsole.Instance.Output(String.Format("[KillUUID]: Found UUID {0} in scene {1}", id, sc.RegionInfo.RegionName));
- try
- {
- sc.DeleteSceneObject(grp, false);
- }
- catch (Exception e)
- {
- m_log.ErrorFormat("[KillUUID]: Error while removing objects from scene: " + e);
- }
- }
- }
- else
- {
- MainConsole.Instance.Output("[KillUUID]: Usage: kill uuid ");
- }
- }
-
#endregion
}
}
--
cgit v1.1
From 5bec5bcf714a94129070cf1b6219984496cbd6c2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 27 Jun 2012 00:00:49 +0100
Subject: Automatically disable log4net before each regression test so that
logging is confined to a single test if it's turned on.
This involves making test classes inherit from a common OpenSimTestCase.
This will be applied to more classes as required.
---
.../CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | 4 +---
.../Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index ddfc6cb..65722fe 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
/// Attachment tests
///
[TestFixture]
- public class AttachmentsModuleTests
+ public class AttachmentsModuleTests : OpenSimTestCase
{
[TestFixtureSetUp]
public void FixtureInit()
@@ -409,8 +409,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// This is the actual attachment, which should no longer exist
List actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();
Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));
-
-// TestHelpers.DisableLogging();
}
// I'm commenting this test because scene setup NEEDS InventoryService to
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
index 90ae69d..f9d4b78 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -48,7 +48,7 @@ using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
[TestFixture]
- public class InventoryArchiveTestCase
+ public class InventoryArchiveTestCase : OpenSimTestCase
{
protected ManualResetEvent mre = new ManualResetEvent(false);
--
cgit v1.1
From d0432133172f4147f7401f214c703611978423cd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 27 Jun 2012 00:41:46 +0100
Subject: refactor: Move ScenePresence <-> AgentData attachments copying code
into AttachmentsModule.
---
.../Avatar/Attachments/AttachmentsModule.cs | 50 ++++++++++++++++++++++
.../Framework/Interfaces/IAttachmentsModule.cs | 14 ++++++
.../Region/Framework/Interfaces/IScenePresence.cs | 6 +++
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 41 ++----------------
4 files changed, 74 insertions(+), 37 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 2b0e4ab..4a7fbce 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -100,6 +100,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
#region IAttachmentsModule
+ public void CopyAttachments(IScenePresence sp, AgentData ad)
+ {
+ lock (sp.AttachmentsSyncLock)
+ {
+ // Attachment objects
+ List attachments = sp.GetAttachments();
+ if (attachments.Count > 0)
+ {
+ ad.AttachmentObjects = new List();
+ ad.AttachmentObjectStates = new List();
+ // IScriptModule se = m_scene.RequestModuleInterface();
+ sp.InTransitScriptStates.Clear();
+
+ foreach (SceneObjectGroup sog in attachments)
+ {
+ // We need to make a copy and pass that copy
+ // because of transfers withn the same sim
+ ISceneObject clone = sog.CloneForNewScene();
+ // Attachment module assumes that GroupPosition holds the offsets...!
+ ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
+ ((SceneObjectGroup)clone).IsAttachment = false;
+ ad.AttachmentObjects.Add(clone);
+ string state = sog.GetStateSnapshot();
+ ad.AttachmentObjectStates.Add(state);
+ sp.InTransitScriptStates.Add(state);
+ // Let's remove the scripts of the original object here
+ sog.RemoveScriptInstances(true);
+ }
+ }
+ }
+ }
+
+ public void CopyAttachments(AgentData ad, IScenePresence sp)
+ {
+ if (ad.AttachmentObjects != null && ad.AttachmentObjects.Count > 0)
+ {
+ lock (sp.AttachmentsSyncLock)
+ sp.ClearAttachments();
+
+ int i = 0;
+ foreach (ISceneObject so in ad.AttachmentObjects)
+ {
+ ((SceneObjectGroup)so).LocalId = 0;
+ ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
+ so.SetState(ad.AttachmentObjectStates[i++], m_scene);
+ m_scene.IncomingCreateObject(Vector3.Zero, so);
+ }
+ }
+ }
+
///
/// RezAttachments. This should only be called upon login on the first region.
/// Attachment rezzings on crossings and TPs are done in a different way.
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index fde5de1..375d334 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -36,6 +36,20 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IAttachmentsModule
{
///
+ /// Copy attachment data from a ScenePresence into the AgentData structure for transmission to another simulator
+ ///
+ ///
+ ///
+ void CopyAttachments(IScenePresence sp, AgentData ad);
+
+ ///
+ /// Copy attachment data from an AgentData structure into a ScenePresence.
+ ///
+ ///
+ ///
+ void CopyAttachments(AgentData ad, IScenePresence sp);
+
+ ///
/// RezAttachments. This should only be called upon login on the first region.
/// Attachment rezzings on crossings and TPs are done in a different way.
///
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index 5e43843..19a8236 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -41,6 +41,12 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IScenePresence : ISceneAgent
{
///
+ /// Copy of the script states while the agent is in transit. This state may
+ /// need to be placed back in case of transfer fail.
+ ///
+ List InTransitScriptStates { get; }
+
+ ///
/// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
///
///
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 909c7c8..c7a670f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3084,31 +3084,8 @@ namespace OpenSim.Region.Framework.Scenes
}
catch { }
- // Attachment objects
- List attachments = GetAttachments();
- if (attachments.Count > 0)
- {
- cAgent.AttachmentObjects = new List();
- cAgent.AttachmentObjectStates = new List();
-// IScriptModule se = m_scene.RequestModuleInterface();
- InTransitScriptStates.Clear();
-
- foreach (SceneObjectGroup sog in attachments)
- {
- // We need to make a copy and pass that copy
- // because of transfers withn the same sim
- ISceneObject clone = sog.CloneForNewScene();
- // Attachment module assumes that GroupPosition holds the offsets...!
- ((SceneObjectGroup)clone).RootPart.GroupPosition = sog.RootPart.AttachedPos;
- ((SceneObjectGroup)clone).IsAttachment = false;
- cAgent.AttachmentObjects.Add(clone);
- string state = sog.GetStateSnapshot();
- cAgent.AttachmentObjectStates.Add(state);
- InTransitScriptStates.Add(state);
- // Let's remove the scripts of the original object here
- sog.RemoveScriptInstances(true);
- }
- }
+ if (Scene.AttachmentsModule != null)
+ Scene.AttachmentsModule.CopyAttachments(this, cAgent);
}
private void CopyFrom(AgentData cAgent)
@@ -3178,18 +3155,8 @@ namespace OpenSim.Region.Framework.Scenes
if (cAgent.Anims != null)
Animator.Animations.FromArray(cAgent.Anims);
- if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
- {
- m_attachments = new List();
- int i = 0;
- foreach (ISceneObject so in cAgent.AttachmentObjects)
- {
- ((SceneObjectGroup)so).LocalId = 0;
- ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule();
- so.SetState(cAgent.AttachmentObjectStates[i++], m_scene);
- m_scene.IncomingCreateObject(Vector3.Zero, so);
- }
- }
+ if (Scene.AttachmentsModule != null)
+ Scene.AttachmentsModule.CopyAttachments(cAgent, this);
}
public bool CopyAgent(out IAgentData agent)
--
cgit v1.1
From bb48060b447a1b9c85f8652cd4bd177558d3bb0d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 27 Jun 2012 00:50:36 +0100
Subject: Fix issue in InventoryArchiveTestCase where it didn't call down to
OpenSimTestCase.SetUp()
---
.../Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
index f9d4b78..1056865 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -84,8 +84,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
protected string m_coaItemName = "Coalesced Item";
[SetUp]
- public virtual void SetUp()
+ public override void SetUp()
{
+ base.SetUp();
m_iarStream = new MemoryStream(m_iarStreamBytes);
}
--
cgit v1.1
From f9769a9fcb84a68622abe23160274796937ae0d4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 28 Jun 2012 00:37:23 +0100
Subject: minor: reuse colon index calculation in XEngine.OnRezScript. The
index if a colon is found on the first line will always be the same as for
the whole script.
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 06ed9d6..73d384d 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -768,12 +768,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
int colon = firstline.IndexOf(':');
if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1)
{
- string engineName = firstline.Substring(2, colon-2);
+ string engineName = firstline.Substring(2, colon - 2);
if (names.Contains(engineName))
{
engine = engineName;
- script = "//" + script.Substring(script.IndexOf(':')+1);
+ script = "//" + script.Substring(colon + 1);
}
else
{
--
cgit v1.1
From 25baa2d894e9bbbb173eb4e6ebe1478d2e3c1265 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 28 Jun 2012 00:58:36 +0100
Subject: Avoid reporting false positives when a colon is in a comment in the
first line of a script where the user was not trying to select a different
script engine.
This works by only posting the "Selected engine unavailable" message if we're falling back on XEngine and the language is one handled by XEngine.
In cases where the language is not handled or not allowed, the user will still be notified by the later compiler error.
This avoids the overwhelming majority of false positives where the first line contains a : for other reasons (e.g. source control systems, vim settings, etc.)
Ultimately, I think it would be better to detect script language/engine with a mechanism that didn't just rely on : detection (e.g like #! in unix scripts).
---
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 58 ++++++++++++++++++--------
1 file changed, 41 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 73d384d..a709be3 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -779,24 +779,48 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
if (engine == ScriptEngineName)
{
- SceneObjectPart part =
- m_Scene.GetSceneObjectPart(
- localID);
-
- TaskInventoryItem item =
- part.Inventory.GetInventoryItem(itemID);
-
- ScenePresence presence =
- m_Scene.GetScenePresence(
- item.OwnerID);
-
- if (presence != null)
+ // If we are falling back on XEngine as the default engine, then only complain to the user
+ // if a script language has been explicitly set and it's one that we recognize. If it's
+ // explicitly not allowed or the script is not in LSL then the user will be informed by a later compiler message.
+ //
+ // This avoids the overwhelming number of false positives where we're in this code because
+ // there's a colon in a comment in the first line of a script for entirely
+ // unrelated reasons (e.g. vim settings).
+ //
+ // TODO: A better fix would be to deprecate simple : detection and look for some less likely
+ // string to begin the comment (like #! in unix shell scripts).
+ bool scriptExplicitlyInXEngineLanguage = false;
+ string restOfScript = script.Substring(colon + 1);
+
+ // FIXME: These are hardcoded because they are currently hardcoded in Compiler.cs
+ if (restOfScript.StartsWith("c#")
+ || restOfScript.StartsWith("vb")
+ || restOfScript.StartsWith("lsl")
+ || restOfScript.StartsWith("js")
+ || restOfScript.StartsWith("yp"))
+ scriptExplicitlyInXEngineLanguage = true;
+
+ if (scriptExplicitlyInXEngineLanguage)
{
- presence.ControllingClient.SendAgentAlertMessage(
- "Selected engine unavailable. "+
- "Running script on "+
- ScriptEngineName,
- false);
+ SceneObjectPart part =
+ m_Scene.GetSceneObjectPart(
+ localID);
+
+ TaskInventoryItem item =
+ part.Inventory.GetInventoryItem(itemID);
+
+ ScenePresence presence =
+ m_Scene.GetScenePresence(
+ item.OwnerID);
+
+ if (presence != null)
+ {
+ presence.ControllingClient.SendAgentAlertMessage(
+ "Selected engine unavailable. "+
+ "Running script on "+
+ ScriptEngineName,
+ false);
+ }
}
}
}
--
cgit v1.1