本文整理汇总了C#中OpenSim.Tests.Common.SceneHelpers.GetSceneObjectPart方法的典型用法代码示例。如果您正苦于以下问题:C# SceneHelpers.GetSceneObjectPart方法的具体用法?C# SceneHelpers.GetSceneObjectPart怎么用?C# SceneHelpers.GetSceneObjectPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Tests.Common.SceneHelpers
的用法示例。
在下文中一共展示了SceneHelpers.GetSceneObjectPart方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDeRezSceneObject
public void TestDeRezSceneObject()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectPart part
= new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
part.Name = "obj1";
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
List<uint> localIds = new List<uint>();
localIds.Add(part.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Null);
}
示例2: TestDeRezSceneObject
public void TestDeRezSceneObject()
{
TestHelpers.InMethod();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, new PermissionsModule());
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", userId);
uint soLocalId = so.LocalId;
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
// Check that object isn't deleted until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(1));
Assert.That(client.ReceivedKills[0], Is.EqualTo(soLocalId));
}
示例3: TestDeleteSceneObjectAsyncToUserInventory
public void TestDeleteSceneObjectAsyncToUserInventory()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
string myObjectName = "Fred";
TestScene scene = new SceneHelpers().SetupScene();
IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Modules");
config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
SceneHelpers.SetupSceneModules(
scene, configSource, new object[] { new BasicInventoryAccessModule() });
SceneHelpers.SetupSceneModules(scene, new object[] { });
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
InventoryFolderBase folder1
= UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1", false);
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(so.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
Assert.That(so.IsDeleted, Is.True);
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Null);
// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
InventoryItemBase retrievedItem
= UserInventoryHelpers.GetInventoryItem(
scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
// Check that we now have the taken part in our inventory
Assert.That(retrievedItem, Is.Not.Null);
// Check that the taken part has actually disappeared
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
// Assert.That(retrievedPart, Is.Null);
}
示例4: TestDeRezSceneObjectNotOwner
public void TestDeRezSceneObjectNotOwner()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(scene, new PermissionsModule());
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectPart part
= new SceneObjectPart(objectOwnerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
part.Name = "obj1";
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
List<uint> localIds = new List<uint>();
localIds.Add(part.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
sogd.InventoryDeQueueAndDelete();
// Object should still be in the scene.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
}
示例5: TestDeRezSceneObject
public void TestDeRezSceneObject()
{
TestHelpers.InMethod();
UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
IConfigSource configSource = new IniConfigSource();
IConfig config = configSource.AddConfig("Startup");
config.Set("serverside_object_permissions", true);
SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() });
IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", userId);
uint soLocalId = so.LocalId;
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
// Check that object isn't deleted until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
// Assert.That(retrievedPart, Is.Not.Null);
// Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Null);
}
示例6: TestDeleteSceneObjectAsync
public void TestDeleteSceneObjectAsync()
{
TestHelpers.InMethod();
//log4net.Config.XmlConfigurator.Configure();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
TestScene scene = new SceneHelpers().SetupScene();
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(so.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
Assert.That(so.IsDeleted, Is.True);
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Null);
}
示例7: TestDeleteSceneObject
public void TestDeleteSceneObject()
{
TestHelpers.InMethod();
TestScene scene = new SceneHelpers().SetupScene();
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
Assert.That(so.IsDeleted, Is.False);
scene.DeleteSceneObject(so, false);
Assert.That(so.IsDeleted, Is.True);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Null);
}
示例8: TestAddExistingSceneObjectUuid
/// <summary>
/// It shouldn't be possible to add a scene object if one with that uuid already exists in the scene.
/// </summary>
public void TestAddExistingSceneObjectUuid()
{
TestHelpers.InMethod();
Scene scene = new SceneHelpers().SetupScene();
string obj1Name = "Alfred";
string obj2Name = "Betty";
UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
SceneObjectPart part1
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = obj1Name, UUID = objUuid };
Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
SceneObjectPart part2
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = obj2Name, UUID = objUuid };
Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part2), false), Is.False);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid);
//m_log.Debug("retrievedPart : {0}", retrievedPart);
// If the parts have the same UUID then we will consider them as one and the same
Assert.That(retrievedPart.Name, Is.EqualTo(obj1Name));
Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
}
示例9: TestTakeCopyWhenCopierIsOwnerWithPerms
public void TestTakeCopyWhenCopierIsOwnerWithPerms()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID);
uint soLocalId = so.LocalId;
// so.UpdatePermissions(
// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Copy, 1);
// so.UpdatePermissions(
// ua.PrincipalID, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
// so.UpdatePermissions(
// ua.PrincipalID, (byte)PermissionWho.Base, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
// scene.HandleObjectPermissionsUpdate(client, client.AgentId, client.SessionId, (byte)PermissionWho.Owner, so.LocalId, (uint)OpenMetaverse.PermissionMask.Transfer, 0);
// Ideally we might change these via client-focussed method calls as commented out above. However, this
// becomes very convoluted so we will set only the copy perm directly.
so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
// so.RootPart.OwnerMask = (uint)OpenMetaverse.PermissionMask.Copy;
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will currently plop it in Lost and Found
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1");
Assert.That(item, Is.Not.Null);
}
示例10: TestTakeCopyWhenCopierIsNotOwnerWithoutPerms
public void TestTakeCopyWhenCopierIsNotOwnerWithoutPerms()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
TestScene scene = new SceneHelpers().SetupScene("s1", TestHelpers.ParseTail(0x99), 1000, 1000, config);
SceneHelpers.SetupSceneModules(scene, config, new PermissionsModule(), new BasicInventoryAccessModule());
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(0x1));
TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, ua.PrincipalID).ControllingClient;
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2));
uint soLocalId = so.LocalId;
{
// Check that object is not copied if copy base perms is missing.
// Should not allow copy if base does not have this.
so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Transfer;
// Must be set so anyone can copy
so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
// Check that object is not copied
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
Assert.That(item, Is.Null);
}
{
// Check that object is not copied if copy trans perms is missing.
// Should not allow copy if base does not have this.
so.RootPart.BaseMask = (uint)OpenMetaverse.PermissionMask.Copy;
// Must be set so anyone can copy
so.RootPart.EveryoneMask = (uint)OpenMetaverse.PermissionMask.Copy;
// Check that object is not copied
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
// Check that object is still there.
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Not.Null);
Assert.That(client.ReceivedKills.Count, Is.EqualTo(0));
// Check that we have a copy in inventory
InventoryItemBase item
= UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1");
Assert.That(item, Is.Null);
}
{
// Check that object is not copied if everyone copy perms is missing.
// Should not allow copy if base does not have this.
so.RootPart.BaseMask = (uint)(OpenMetaverse.PermissionMask.Copy | OpenMetaverse.PermissionMask.Transfer);
// Make sure everyone perm does not allow copy
so.RootPart.EveryoneMask = (uint)(OpenMetaverse.PermissionMask.All & ~OpenMetaverse.PermissionMask.Copy);
// Check that object is not copied
List<uint> localIds = new List<uint>();
localIds.Add(so.LocalId);
// Specifying a UUID.Zero in this case will plop it in the Objects folder if we have perms
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.TakeCopy, UUID.Zero);
// Check that object isn't copied until we crank the sogd handle.
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
//.........这里部分代码省略.........