From 8205fe79ceaeebd31509a044005bf27d226dbe07 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sun, 22 Apr 2012 19:51:51 +0100 Subject: Fix bug where setting phantom on a prim would result in a server log message rather than setting phantom. This was an oversight when removing some race conditions from PhysicsActor setting recently. Regression tests extended to probe this code path. Extending regression tests required implementation of a BasicPhysicsPrim (there was none before). However, BasicPhysics plugin is still of no current practical use other than to fill in as a component for other parts of regression testing. --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 +++++--------- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 ++++++--- .../Framework/Scenes/Tests/SceneObjectStatusTests.cs | 2 ++ 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e488fe1..a87dfb7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -684,8 +684,8 @@ namespace OpenSim.Region.Framework.Scenes //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); - PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); - CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); + PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); + CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) @@ -800,13 +800,11 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; } - /// - /// Mock constructor for scene group persistency unit tests. - /// SceneObjectGroup RegionId property is delegated to Scene. - /// - /// public Scene(RegionInfo regInfo) { + PhysicalPrims = true; + CollidablePrims = true; + BordersLocked = true; Border northBorder = new Border(); northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- @@ -833,8 +831,6 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager = new EventManager(); m_permissions = new ScenePermissions(this); - -// m_lastUpdate = Util.EnvironmentTickCount(); } #endregion diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1592131..4bec2d4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4290,7 +4290,10 @@ namespace OpenSim.Region.Framework.Scenes AddFlag(PrimFlags.Phantom); if (PhysActor != null) + { RemoveFromPhysics(); + pa = null; + } } else // Not phantom { @@ -4356,7 +4359,7 @@ namespace OpenSim.Region.Framework.Scenes { pa.SetVolumeDetect(1); AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active - this.VolumeDetectActive = true; + VolumeDetectActive = true; } } else @@ -4364,9 +4367,9 @@ namespace OpenSim.Region.Framework.Scenes // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like // (mumbles, well, at least if you have infinte CPU powers :-)) if (pa != null) - PhysActor.SetVolumeDetect(0); + pa.SetVolumeDetect(0); - this.VolumeDetectActive = false; + VolumeDetectActive = false; } if (SetTemporary) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 882031c..51751ef 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -62,6 +62,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); + m_scene.AddSceneObject(m_so1); + SceneObjectPart rootPart = m_so1.RootPart; Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); -- cgit v1.1