Merge branch 'master' of /home/opensim/var/repo/opensim
commit
3926c196df
|
@ -409,10 +409,6 @@ namespace OpenSim
|
||||||
m_console.Commands.AddCommand("General", false, "modules unload",
|
m_console.Commands.AddCommand("General", false, "modules unload",
|
||||||
"modules unload <name>",
|
"modules unload <name>",
|
||||||
"Unload a module", HandleModules);
|
"Unload a module", HandleModules);
|
||||||
|
|
||||||
m_console.Commands.AddCommand("Objects", false, "kill uuid",
|
|
||||||
"kill uuid <UUID>",
|
|
||||||
"Kill an object by UUID", KillUUID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ShutdownSpecific()
|
public override void ShutdownSpecific()
|
||||||
|
@ -1309,58 +1305,6 @@ namespace OpenSim
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Kill an object given its UUID.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cmdparams"></param>
|
|
||||||
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 <UUID>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
|
|
||||||
#region IAttachmentsModule
|
#region IAttachmentsModule
|
||||||
|
|
||||||
|
public void CopyAttachments(IScenePresence sp, AgentData ad)
|
||||||
|
{
|
||||||
|
lock (sp.AttachmentsSyncLock)
|
||||||
|
{
|
||||||
|
// Attachment objects
|
||||||
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
|
if (attachments.Count > 0)
|
||||||
|
{
|
||||||
|
ad.AttachmentObjects = new List<ISceneObject>();
|
||||||
|
ad.AttachmentObjectStates = new List<string>();
|
||||||
|
// IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RezAttachments. This should only be called upon login on the first region.
|
/// RezAttachments. This should only be called upon login on the first region.
|
||||||
/// Attachment rezzings on crossings and TPs are done in a different way.
|
/// Attachment rezzings on crossings and TPs are done in a different way.
|
||||||
|
|
|
@ -38,11 +38,14 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Region.CoreModules.Avatar.Attachments;
|
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.Framework.InventoryAccess;
|
||||||
using OpenSim.Region.CoreModules.World.Serialiser;
|
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||||
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
using OpenSim.Tests.Common.Mock;
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
|
||||||
|
@ -52,27 +55,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
/// Attachment tests
|
/// Attachment tests
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class AttachmentsModuleTests
|
public class AttachmentsModuleTests : OpenSimTestCase
|
||||||
{
|
{
|
||||||
private Scene scene;
|
|
||||||
private AttachmentsModule m_attMod;
|
|
||||||
private ScenePresence m_presence;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Standard user ID
|
|
||||||
/// </summary>
|
|
||||||
private UUID m_userId = TestHelpers.ParseTail(0x1);
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Standard attachment item ID
|
|
||||||
// /// </summary>
|
|
||||||
// private UUID m_attItemId = TestHelpers.ParseTail(0x10);
|
|
||||||
//
|
|
||||||
// /// <summary>
|
|
||||||
// /// Standard attachment asset ID
|
|
||||||
// /// </summary>
|
|
||||||
// private UUID m_attAssetId = TestHelpers.ParseTail(0x11);
|
|
||||||
|
|
||||||
[TestFixtureSetUp]
|
[TestFixtureSetUp]
|
||||||
public void FixtureInit()
|
public void FixtureInit()
|
||||||
{
|
{
|
||||||
|
@ -80,18 +64,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Util.FireAndForgetMethod = FireAndForgetMethod.None;
|
Util.FireAndForgetMethod = FireAndForgetMethod.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
IConfigSource config = new IniConfigSource();
|
|
||||||
config.AddConfig("Modules");
|
|
||||||
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
|
||||||
|
|
||||||
scene = new SceneHelpers().SetupScene();
|
|
||||||
m_attMod = new AttachmentsModule();
|
|
||||||
SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule());
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestFixtureTearDown]
|
[TestFixtureTearDown]
|
||||||
public void TearDown()
|
public void TearDown()
|
||||||
{
|
{
|
||||||
|
@ -100,6 +72,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
|
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Scene CreateDefaultTestScene()
|
||||||
|
{
|
||||||
|
IConfigSource config = new IniConfigSource();
|
||||||
|
config.AddConfig("Modules");
|
||||||
|
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||||
|
|
||||||
|
Scene scene = new SceneHelpers().SetupScene();
|
||||||
|
SceneHelpers.SetupSceneModules(scene, config, new AttachmentsModule(), new BasicInventoryAccessModule());
|
||||||
|
|
||||||
|
return scene;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an attachment item in the given user's inventory. Does not attach.
|
/// Creates an attachment item in the given user's inventory. Does not attach.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -109,11 +93,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// The attachment item.
|
/// The attachment item.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
|
/// <param name='scene'></param>
|
||||||
/// <param name='userId'></param>
|
/// <param name='userId'></param>
|
||||||
/// <param name='attName'></param>
|
/// <param name='attName'></param>
|
||||||
/// <param name='rawItemId'></param>
|
/// <param name='rawItemId'></param>
|
||||||
/// <param name='rawAssetId'></param>
|
/// <param name='rawAssetId'></param>
|
||||||
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(
|
return UserInventoryHelpers.CreateInventoryItem(
|
||||||
scene,
|
scene,
|
||||||
|
@ -130,18 +116,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// TestHelpers.EnableLogging();
|
// TestHelpers.EnableLogging();
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
Scene scene = CreateDefaultTestScene();
|
||||||
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
string attName = "att";
|
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);
|
scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false);
|
||||||
|
|
||||||
// Check status on scene presence
|
// Check status on scene presence
|
||||||
Assert.That(m_presence.HasAttachments(), Is.True);
|
Assert.That(sp.HasAttachments(), Is.True);
|
||||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
Assert.That(attachments.Count, Is.EqualTo(1));
|
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||||
SceneObjectGroup attSo = attachments[0];
|
SceneObjectGroup attSo = attachments[0];
|
||||||
Assert.That(attSo.Name, Is.EqualTo(attName));
|
Assert.That(attSo.Name, Is.EqualTo(attName));
|
||||||
|
@ -152,14 +139,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
|
|
||||||
// Check item status
|
// Check item status
|
||||||
Assert.That(
|
Assert.That(
|
||||||
m_presence.Appearance.GetAttachpoint(attSo.FromItemID),
|
sp.Appearance.GetAttachpoint(attSo.FromItemID),
|
||||||
Is.EqualTo((int)AttachmentPoint.Chest));
|
Is.EqualTo((int)AttachmentPoint.Chest));
|
||||||
|
|
||||||
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
|
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID));
|
||||||
Assert.That(attachmentItem, Is.Not.Null);
|
Assert.That(attachmentItem, Is.Not.Null);
|
||||||
Assert.That(attachmentItem.Name, Is.EqualTo(attName));
|
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));
|
Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID));
|
||||||
|
|
||||||
// TestHelpers.DisableLogging();
|
// TestHelpers.DisableLogging();
|
||||||
|
@ -171,17 +158,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
Scene scene = CreateDefaultTestScene();
|
||||||
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
m_attMod.RezSingleAttachmentFromInventory(
|
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
|
|
||||||
// Check scene presence status
|
// Check scene presence status
|
||||||
Assert.That(m_presence.HasAttachments(), Is.True);
|
Assert.That(sp.HasAttachments(), Is.True);
|
||||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
Assert.That(attachments.Count, Is.EqualTo(1));
|
Assert.That(attachments.Count, Is.EqualTo(1));
|
||||||
SceneObjectGroup attSo = attachments[0];
|
SceneObjectGroup attSo = attachments[0];
|
||||||
Assert.That(attSo.Name, Is.EqualTo(attItem.Name));
|
Assert.That(attSo.Name, Is.EqualTo(attItem.Name));
|
||||||
|
@ -191,8 +179,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(attSo.IsTemporary, Is.False);
|
Assert.That(attSo.IsTemporary, Is.False);
|
||||||
|
|
||||||
// Check appearance status
|
// Check appearance status
|
||||||
Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1));
|
Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(1));
|
||||||
Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
|
Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -201,23 +189,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
Scene scene = CreateDefaultTestScene();
|
||||||
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
ISceneEntity so
|
ISceneEntity so
|
||||||
= m_attMod.RezSingleAttachmentFromInventory(
|
= scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId);
|
scene.AttachmentsModule.DetachSingleAttachmentToGround(sp, so.LocalId);
|
||||||
|
|
||||||
// Check scene presence status
|
// Check scene presence status
|
||||||
Assert.That(m_presence.HasAttachments(), Is.False);
|
Assert.That(sp.HasAttachments(), Is.False);
|
||||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
Assert.That(attachments.Count, Is.EqualTo(0));
|
Assert.That(attachments.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
// Check appearance status
|
// 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
|
// Check item status
|
||||||
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
|
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
|
||||||
|
@ -232,22 +221,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
Scene scene = CreateDefaultTestScene();
|
||||||
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
|
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);
|
||||||
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, ua1.PrincipalID);
|
||||||
|
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
|
InventoryItemBase attItem = CreateAttachmentItem(scene, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
m_attMod.RezSingleAttachmentFromInventory(
|
scene.AttachmentsModule.RezSingleAttachmentFromInventory(
|
||||||
m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
|
sp, attItem.ID, (uint)AttachmentPoint.Chest);
|
||||||
m_attMod.DetachSingleAttachmentToInv(m_presence, attItem.ID);
|
scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, attItem.ID);
|
||||||
|
|
||||||
// Check status on scene presence
|
// Check status on scene presence
|
||||||
Assert.That(m_presence.HasAttachments(), Is.False);
|
Assert.That(sp.HasAttachments(), Is.False);
|
||||||
List<SceneObjectGroup> attachments = m_presence.GetAttachments();
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
Assert.That(attachments.Count, Is.EqualTo(0));
|
Assert.That(attachments.Count, Is.EqualTo(0));
|
||||||
|
|
||||||
// Check item status
|
// Check item status
|
||||||
Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
|
Assert.That(sp.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -259,10 +249,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
Scene scene = CreateDefaultTestScene();
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(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 = new AvatarAppearance();
|
||||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||||
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
||||||
|
@ -281,10 +272,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
Scene scene = CreateDefaultTestScene();
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(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 = new AvatarAppearance();
|
||||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||||
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
|
||||||
|
@ -314,10 +306,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
{
|
{
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
|
|
||||||
UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
|
Scene scene = CreateDefaultTestScene();
|
||||||
InventoryItemBase attItem = CreateAttachmentItem(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 = new AvatarAppearance();
|
||||||
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
|
||||||
ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd);
|
ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd);
|
||||||
|
@ -332,6 +325,92 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
|
||||||
Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition));
|
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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
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, ua1.PrincipalID, "att", 0x10, 0x20);
|
||||||
|
|
||||||
|
sceneA.AttachmentsModule.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(ua1.PrincipalID);
|
||||||
|
|
||||||
|
// This is appearance data, as opposed to actually rezzed attachments
|
||||||
|
List<AvatarAttachment> 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<SceneObjectGroup> 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(ua1.PrincipalID);
|
||||||
|
|
||||||
|
// Since this is appearance data, it is still present on the child avatar!
|
||||||
|
List<AvatarAttachment> 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<SceneObjectGroup> actualSceneAAttachments = afterTeleportSceneASp.GetAttachments();
|
||||||
|
Assert.That(actualSceneAAttachments.Count, Is.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
// I'm commenting this test because scene setup NEEDS InventoryService to
|
// I'm commenting this test because scene setup NEEDS InventoryService to
|
||||||
// be non-null
|
// be non-null
|
||||||
//[Test]
|
//[Test]
|
||||||
|
|
|
@ -48,7 +48,7 @@ using OpenSim.Tests.Common.Mock;
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class InventoryArchiveTestCase
|
public class InventoryArchiveTestCase : OpenSimTestCase
|
||||||
{
|
{
|
||||||
protected ManualResetEvent mre = new ManualResetEvent(false);
|
protected ManualResetEvent mre = new ManualResetEvent(false);
|
||||||
|
|
||||||
|
@ -84,8 +84,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
protected string m_coaItemName = "Coalesced Item";
|
protected string m_coaItemName = "Coalesced Item";
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public virtual void SetUp()
|
public override void SetUp()
|
||||||
{
|
{
|
||||||
|
base.SetUp();
|
||||||
m_iarStream = new MemoryStream(m_iarStreamBytes);
|
m_iarStream = new MemoryStream(m_iarStreamBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -709,6 +709,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
agent.CallbackURI, region.RegionName);
|
agent.CallbackURI, region.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up operations once an agent has moved away through cross or teleport.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='sp'></param>
|
||||||
|
/// <param name='logout'></param>
|
||||||
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
|
protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout)
|
||||||
{
|
{
|
||||||
if (sp.Scene.AttachmentsModule != null)
|
if (sp.Scene.AttachmentsModule != null)
|
||||||
|
@ -1666,6 +1671,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Object Transfers
|
#region Object Transfers
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Move the given scene object into a new region depending on which region its absolute position has moved
|
/// Move the given scene object into a new region depending on which region its absolute position has moved
|
||||||
/// into.
|
/// into.
|
||||||
|
@ -1967,35 +1973,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return successYN;
|
return successYN;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
|
/// <summary>
|
||||||
|
/// Cross the attachments for an avatar into the destination region.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name='destination'></param>
|
||||||
|
/// <param name='sp'></param>
|
||||||
|
/// <param name='silent'></param>
|
||||||
|
protected void CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent)
|
||||||
{
|
{
|
||||||
List<SceneObjectGroup> m_attachments = sp.GetAttachments();
|
List<SceneObjectGroup> attachments = sp.GetAttachments();
|
||||||
|
|
||||||
// Validate
|
// m_log.DebugFormat(
|
||||||
// foreach (SceneObjectGroup gobj in m_attachments)
|
// "[ENTITY TRANSFER MODULE]: Crossing {0} attachments into {1} for {2}",
|
||||||
// {
|
// m_attachments.Count, destination.RegionName, sp.Name);
|
||||||
// if (gobj == null || gobj.IsDeleted)
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
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 the prim group is null then something must have happened to it!
|
||||||
if (gobj != null && !gobj.IsDeleted)
|
if (gobj != null && !gobj.IsDeleted)
|
||||||
{
|
{
|
||||||
// Set the parent localID to 0 so it transfers over properly.
|
SceneObjectGroup clone = (SceneObjectGroup)gobj.CloneForNewScene();
|
||||||
gobj.RootPart.SetParentLocalId(0);
|
clone.RootPart.GroupPosition = gobj.RootPart.AttachedPos;
|
||||||
gobj.AbsolutePosition = gobj.RootPart.AttachedPos;
|
clone.IsAttachment = false;
|
||||||
gobj.IsAttachment = false;
|
|
||||||
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
|
//gobj.RootPart.LastOwnerID = gobj.GetFromAssetID();
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName);
|
m_log.DebugFormat(
|
||||||
CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent);
|
"[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}",
|
||||||
|
clone.UUID, destination.RegionName);
|
||||||
|
|
||||||
|
CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, clone, silent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sp.ClearAttachments();
|
sp.ClearAttachments();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -98,7 +98,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||||
m_console.Commands.AddCommand(
|
m_console.Commands.AddCommand(
|
||||||
"Objects", false, "delete object name",
|
"Objects", false, "delete object name",
|
||||||
"delete object name [--regex] <name>",
|
"delete object name [--regex] <name>",
|
||||||
"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);
|
HandleDeleteObject);
|
||||||
|
|
||||||
m_console.Commands.AddCommand(
|
m_console.Commands.AddCommand(
|
||||||
|
@ -118,7 +119,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||||
false,
|
false,
|
||||||
"show object name",
|
"show object name",
|
||||||
"show object name [--regex] <name>",
|
"show object name [--regex] <name>",
|
||||||
"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);
|
HandleShowObjectByName);
|
||||||
|
|
||||||
m_console.Commands.AddCommand(
|
m_console.Commands.AddCommand(
|
||||||
|
@ -133,7 +135,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
|
||||||
false,
|
false,
|
||||||
"show part name",
|
"show part name",
|
||||||
"show part name [--regex] <name>",
|
"show part name [--regex] <name>",
|
||||||
"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);
|
HandleShowPartByName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,20 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
public interface IAttachmentsModule
|
public interface IAttachmentsModule
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Copy attachment data from a ScenePresence into the AgentData structure for transmission to another simulator
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='sp'></param>
|
||||||
|
/// <param name='ad'></param>
|
||||||
|
void CopyAttachments(IScenePresence sp, AgentData ad);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy attachment data from an AgentData structure into a ScenePresence.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name='ad'></param>
|
||||||
|
/// <param name='sp'></param>
|
||||||
|
void CopyAttachments(AgentData ad, IScenePresence sp);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RezAttachments. This should only be called upon login on the first region.
|
/// RezAttachments. This should only be called upon login on the first region.
|
||||||
/// Attachment rezzings on crossings and TPs are done in a different way.
|
/// Attachment rezzings on crossings and TPs are done in a different way.
|
||||||
|
|
|
@ -40,6 +40,12 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public interface IScenePresence : ISceneAgent
|
public interface IScenePresence : ISceneAgent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Copy of the script states while the agent is in transit. This state may
|
||||||
|
/// need to be placed back in case of transfer fail.
|
||||||
|
/// </summary>
|
||||||
|
List<string> InTransitScriptStates { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
|
/// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -3084,31 +3084,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
// Attachment objects
|
if (Scene.AttachmentsModule != null)
|
||||||
List<SceneObjectGroup> attachments = GetAttachments();
|
Scene.AttachmentsModule.CopyAttachments(this, cAgent);
|
||||||
if (attachments.Count > 0)
|
|
||||||
{
|
|
||||||
cAgent.AttachmentObjects = new List<ISceneObject>();
|
|
||||||
cAgent.AttachmentObjectStates = new List<string>();
|
|
||||||
// IScriptModule se = m_scene.RequestModuleInterface<IScriptModule>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyFrom(AgentData cAgent)
|
private void CopyFrom(AgentData cAgent)
|
||||||
|
@ -3178,18 +3155,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (cAgent.Anims != null)
|
if (cAgent.Anims != null)
|
||||||
Animator.Animations.FromArray(cAgent.Anims);
|
Animator.Animations.FromArray(cAgent.Anims);
|
||||||
|
|
||||||
if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
|
if (Scene.AttachmentsModule != null)
|
||||||
{
|
Scene.AttachmentsModule.CopyAttachments(cAgent, this);
|
||||||
m_attachments = new List<SceneObjectGroup>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CopyAgent(out IAgentData agent)
|
public bool CopyAgent(out IAgentData agent)
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace OpenSim.Services.GridService
|
||||||
if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0)
|
if (MainConsole.Instance.Commands.Resolve(new string[] { "show", "regions" }).Length == 0)
|
||||||
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
MainConsole.Instance.Commands.AddCommand("Regions", true,
|
||||||
"show regions",
|
"show regions",
|
||||||
"show all regions",
|
"show regions",
|
||||||
"Show details on all regions",
|
"Show details on all regions",
|
||||||
String.Empty,
|
String.Empty,
|
||||||
HandleShowRegions);
|
HandleShowRegions);
|
||||||
|
@ -650,13 +650,19 @@ namespace OpenSim.Services.GridService
|
||||||
ConsoleDisplayTable dispTable = new ConsoleDisplayTable();
|
ConsoleDisplayTable dispTable = new ConsoleDisplayTable();
|
||||||
dispTable.AddColumn("Name", 16);
|
dispTable.AddColumn("Name", 16);
|
||||||
dispTable.AddColumn("ID", 36);
|
dispTable.AddColumn("ID", 36);
|
||||||
|
dispTable.AddColumn("Position", 11);
|
||||||
dispTable.AddColumn("Owner ID", 36);
|
dispTable.AddColumn("Owner ID", 36);
|
||||||
dispTable.AddColumn("Flags", 60);
|
dispTable.AddColumn("Flags", 60);
|
||||||
|
|
||||||
foreach (RegionData r in regions)
|
foreach (RegionData r in regions)
|
||||||
{
|
{
|
||||||
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
OpenSim.Data.RegionFlags flags = (OpenSim.Data.RegionFlags)Convert.ToInt32(r.Data["flags"]);
|
||||||
dispTable.AddRow(r.RegionName, r.RegionID.ToString(), r.Data["owner_uuid"].ToString(), flags.ToString());
|
dispTable.AddRow(
|
||||||
|
r.RegionName,
|
||||||
|
r.RegionID.ToString(),
|
||||||
|
string.Format("{0},{1}", r.coordX, r.coordY),
|
||||||
|
r.Data["owner_uuid"].ToString(),
|
||||||
|
flags.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
MainConsole.Instance.Output(dispTable.ToString());
|
MainConsole.Instance.Output(dispTable.ToString());
|
||||||
|
|
|
@ -126,6 +126,11 @@ namespace OpenSim.Tests.Common
|
||||||
return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll");
|
return CreateUserWithInventory(scene, "Bill", "Bailey", userId, "troll");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UserAccount CreateUserWithInventory(Scene scene, int userId)
|
||||||
|
{
|
||||||
|
return CreateUserWithInventory(scene, "Bill", "Bailey", TestHelpers.ParseTail(userId), "troll");
|
||||||
|
}
|
||||||
|
|
||||||
public static UserAccount CreateUserWithInventory(
|
public static UserAccount CreateUserWithInventory(
|
||||||
Scene scene, string firstName, string lastName, UUID userId, string pw)
|
Scene scene, string firstName, string lastName, UUID userId, string pw)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* 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 NUnit.Framework;
|
||||||
|
|
||||||
|
namespace OpenSim.Tests.Common
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class OpenSimTestCase
|
||||||
|
{
|
||||||
|
[SetUp]
|
||||||
|
public virtual void SetUp()
|
||||||
|
{
|
||||||
|
// TestHelpers.InMethod();
|
||||||
|
// Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests
|
||||||
|
// to have logging on if it failed with an exception.
|
||||||
|
TestHelpers.DisableLogging();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Tests.Common
|
||||||
</root>
|
</root>
|
||||||
</log4net>"));
|
</log4net>"));
|
||||||
|
|
||||||
private static Stream DisableLoggingConfigStream
|
private static MemoryStream DisableLoggingConfigStream
|
||||||
= new MemoryStream(
|
= new MemoryStream(
|
||||||
Encoding.UTF8.GetBytes(
|
Encoding.UTF8.GetBytes(
|
||||||
// "<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/><appender-ref ref=\"A1\"/></root></log4net></configuration>"));
|
// "<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/><appender-ref ref=\"A1\"/></root></log4net></configuration>"));
|
||||||
|
@ -109,6 +109,7 @@ namespace OpenSim.Tests.Common
|
||||||
public static void DisableLogging()
|
public static void DisableLogging()
|
||||||
{
|
{
|
||||||
log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream);
|
log4net.Config.XmlConfigurator.Configure(DisableLoggingConfigStream);
|
||||||
|
DisableLoggingConfigStream.Position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue