当前位置: 首页>>代码示例>>C#>>正文


C# SceneHelpers.Backup方法代码示例

本文整理汇总了C#中OpenSim.Tests.Common.SceneHelpers.Backup方法的典型用法代码示例。如果您正苦于以下问题:C# SceneHelpers.Backup方法的具体用法?C# SceneHelpers.Backup怎么用?C# SceneHelpers.Backup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Tests.Common.SceneHelpers的用法示例。


在下文中一共展示了SceneHelpers.Backup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestDelinkPersistence

        public void TestDelinkPersistence()
        {
            TestHelpers.InMethod();
            //log4net.Config.XmlConfigurator.Configure();
            
            TestScene scene = new SceneHelpers().SetupScene();
            
            string rootPartName = "rootpart";
            UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
            string linkPartName = "linkpart";
            UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");

            SceneObjectPart rootPart
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 
                    { Name = rootPartName, UUID = rootPartUuid };
            
            SceneObjectPart linkPart
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 
                    { Name = linkPartName, UUID = linkPartUuid };
            SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart);
            scene.AddNewSceneObject(linkGroup, true);

            SceneObjectGroup sog = new SceneObjectGroup(rootPart);
            scene.AddNewSceneObject(sog, true);

            Assert.IsFalse(sog.GroupContainsForeignPrims);
            sog.LinkToGroup(linkGroup);
            Assert.IsTrue(sog.GroupContainsForeignPrims);

            scene.Backup(true);
            Assert.AreEqual(1, scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID).Count);

            // These changes should occur immediately without waiting for a backup pass
            SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
            Assert.IsFalse(groupToDelete.GroupContainsForeignPrims);

/* backup is async            
            scene.DeleteSceneObject(groupToDelete, false);

            List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);

            Assert.AreEqual(1, storedObjects.Count);
            Assert.AreEqual(1, storedObjects[0].Parts.Length);
            Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid));
*/
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:46,代码来源:SceneObjectLinkingTests.cs

示例2: TestLinkDelink2SceneObjects

        public void TestLinkDelink2SceneObjects()
        {
            TestHelpers.InMethod();
            
            bool debugtest = false; 

            Scene scene = new SceneHelpers().SetupScene();
            SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene);
            SceneObjectPart part1 = grp1.RootPart;
            SceneObjectGroup grp2 = SceneHelpers.AddSceneObject(scene);
            SceneObjectPart part2 = grp2.RootPart;

            grp1.AbsolutePosition = new Vector3(10, 10, 10);
            grp2.AbsolutePosition = Vector3.Zero;

            // <90,0,0>
//            grp1.UpdateGroupRotationR(Quaternion.CreateFromEulers(90 * Utils.DEG_TO_RAD, 0, 0));

            // <180,0,0>
            grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0));
            
            // Required for linking
            grp1.RootPart.ClearUpdateSchedule();
            grp2.RootPart.ClearUpdateSchedule();

            // Link grp2 to grp1.   part2 becomes child prim to grp1. grp2 is eliminated.
            Assert.IsFalse(grp1.GroupContainsForeignPrims);
            grp1.LinkToGroup(grp2);
            Assert.IsTrue(grp1.GroupContainsForeignPrims);

            scene.Backup(true);
            Assert.IsFalse(grp1.GroupContainsForeignPrims);

            // FIXME: Can't do this test yet since group 2 still has its root part!  We can't yet null this since
            // it might cause SOG.ProcessBackup() to fail due to the race condition.  This really needs to be fixed.
            Assert.That(grp2.IsDeleted, "SOG 2 was not registered as deleted after link.");
            Assert.That(grp2.Parts.Length, Is.EqualTo(0), "Group 2 still contained children after delink.");
            Assert.That(grp1.Parts.Length == 2);

            if (debugtest)
            {
                m_log.Debug("parts: " + grp1.Parts.Length);
                m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.GroupRotation);
                m_log.Debug("Group1: Prim1: OffsetPosition:"+ part1.OffsetPosition+", OffsetRotation:"+part1.RotationOffset);
                m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+part2.RotationOffset);
            }

            // root part should have no offset position or rotation
            Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity, 
                "root part should have no offset position or rotation");

            // offset position should be root part position - part2.absolute position.
            Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10),
                "offset position should be root part position - part2.absolute position.");

            float roll = 0;
            float pitch = 0;
            float yaw = 0;

            // There's a euler anomoly at 180, 0, 0 so expect 180 to turn into -180.
            part1.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw);
            Vector3 rotEuler1 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG);
            
            if (debugtest)
                m_log.Debug(rotEuler1);

            part2.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw);
            Vector3 rotEuler2 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG);
             
            if (debugtest)
                m_log.Debug(rotEuler2);

            Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f),
                "Not exactly sure what this is asserting...");

            // Delink part 2
            SceneObjectGroup grp3 = grp1.DelinkFromGroup(part2.LocalId);

            if (debugtest)
                m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);

            Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
            Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
            Assert.NotNull(grp3);
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:85,代码来源:SceneObjectLinkingTests.cs

示例3: TestNewSceneObjectLinkPersistence

        public void TestNewSceneObjectLinkPersistence()
        {
            TestHelpers.InMethod();
            //log4net.Config.XmlConfigurator.Configure();
            
            TestScene scene = new SceneHelpers().SetupScene();
            
            string rootPartName = "rootpart";
            UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
            string linkPartName = "linkpart";
            UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");

            SceneObjectPart rootPart
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 
                    { Name = rootPartName, UUID = rootPartUuid };
            SceneObjectPart linkPart
                = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 
                    { Name = linkPartName, UUID = linkPartUuid };

            SceneObjectGroup sog = new SceneObjectGroup(rootPart);
            sog.AddPart(linkPart);
            scene.AddNewSceneObject(sog, true);
            
            // In a test, we have to crank the backup handle manually.  Normally this would be done by the timer invoked
            // scene backup thread.
            scene.Backup(true);
            
            List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
            
            Assert.That(storedObjects.Count, Is.EqualTo(1));
            Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(2));
            Assert.That(storedObjects[0].ContainsPart(rootPartUuid));
            Assert.That(storedObjects[0].ContainsPart(linkPartUuid));
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:34,代码来源:SceneObjectLinkingTests.cs


注:本文中的OpenSim.Tests.Common.SceneHelpers.Backup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。