From 750ad2d3afd6fcf32a9e04794d860e117559a78f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 14 Dec 2012 22:15:40 +0000 Subject: Fix issue where calling llVolumeDetect(FALSE) would not remove phantom flag, causing subsequent issues if physics was re-enabled. Added regression tests Addresses http://opensimulator.org/mantis/view.php?id=6365 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 +- .../Scenes/Tests/SceneObjectStatusTests.cs | 41 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f79ac96..ff67d6d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3993,13 +3993,14 @@ namespace OpenSim.Region.Framework.Scenes VolumeDetectActive = true; } } - else + else if (SetVD != wasVD) { // 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) pa.SetVolumeDetect(0); + RemFlag(PrimFlags.Phantom); VolumeDetectActive = false; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 093cbd2..8eb3191 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -78,6 +78,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests } [Test] + public void TestSetNonPhysicsVolumeDetectSinglePrim() + { + TestHelpers.InMethod(); + + m_scene.AddSceneObject(m_so1); + + SceneObjectPart rootPart = m_so1.RootPart; + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + + m_so1.ScriptSetVolumeDetect(true); + +// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); + + m_so1.ScriptSetVolumeDetect(false); + + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + } + + [Test] public void TestSetPhysicsSinglePrim() { TestHelpers.InMethod(); @@ -89,13 +109,32 @@ namespace OpenSim.Region.Framework.Scenes.Tests m_so1.ScriptSetPhysicsStatus(true); -// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); m_so1.ScriptSetPhysicsStatus(false); Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); } + + [Test] + public void TestSetPhysicsVolumeDetectSinglePrim() + { + TestHelpers.InMethod(); + + m_scene.AddSceneObject(m_so1); + + SceneObjectPart rootPart = m_so1.RootPart; + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + + m_so1.ScriptSetPhysicsStatus(true); + m_so1.ScriptSetVolumeDetect(true); + + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics)); + + m_so1.ScriptSetVolumeDetect(false); + + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); + } [Test] public void TestSetPhysicsLinkset() -- cgit v1.1