From 06552f217ebd9301fd487c788a13fd75d61a46de Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 21 Apr 2012 00:54:48 +0100
Subject: Add TestSetPhysics() to SOP status tests
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 9 ++++++---
.../Framework/Scenes/Tests/SceneObjectStatusTests.cs | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 046553b..d2cd37d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1706,6 +1706,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
{
+ if (ParentGroup.Scene == null)
+ return;
+
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
return;
@@ -4161,7 +4164,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI.
- if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
+ if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{
string hingeString = "hingejoint";
return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
@@ -4177,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI.
- if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
+ if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{
string ballString = "balljoint";
return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
@@ -4193,7 +4196,7 @@ namespace OpenSim.Region.Framework.Scenes
// For now, we use the NINJA naming scheme for identifying joints.
// In the future, we can support other joint specification schemes such as a
// custom checkbox in the viewer GUI.
- if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
+ if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
{
return IsHingeJoint() || IsBallJoint();
}
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 2a342d5..16e8b63 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -62,5 +62,25 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
}
+
+ [Test]
+ public void TestSetPhysics()
+ {
+ TestHelpers.InMethod();
+
+// Scene scene = SceneSetupHelpers.SetupScene();
+ SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
+ SceneObjectPart rootPart = so.RootPart;
+ Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
+
+ so.ScriptSetPhysicsStatus(true);
+
+// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
+ Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
+
+ so.ScriptSetPhysicsStatus(false);
+
+ Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From 71900968b221b89860d1cef162f3b0d1236e1c73 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 21 Apr 2012 01:01:24 +0100
Subject: refactor: extract common setup code in SceneObjectStatusTests
---
.../Scenes/Tests/SceneObjectStatusTests.cs | 26 +++++++++++++---------
1 file changed, 16 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 16e8b63..b8e1b92 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -43,22 +43,30 @@ namespace OpenSim.Region.Framework.Scenes.Tests
[TestFixture]
public class SceneObjectStatusTests
{
+ private TestScene m_scene;
+ private SceneObjectGroup m_so1;
+
+ [SetUp]
+ public void Init()
+ {
+ m_scene = SceneHelpers.SetupScene();
+ SceneObjectGroup m_so1 = SceneHelpers.CreateSceneObject(1, UUID.Zero);
+ }
+
[Test]
public void TestSetPhantom()
{
TestHelpers.InMethod();
-// Scene scene = SceneSetupHelpers.SetupScene();
- SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
- SceneObjectPart rootPart = so.RootPart;
+ SceneObjectPart rootPart = m_so1.RootPart;
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
- so.ScriptSetPhantomStatus(true);
+ m_so1.ScriptSetPhantomStatus(true);
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
- so.ScriptSetPhantomStatus(false);
+ m_so1.ScriptSetPhantomStatus(false);
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
}
@@ -68,17 +76,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{
TestHelpers.InMethod();
-// Scene scene = SceneSetupHelpers.SetupScene();
- SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
- SceneObjectPart rootPart = so.RootPart;
+ SceneObjectPart rootPart = m_so1.RootPart;
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
- so.ScriptSetPhysicsStatus(true);
+ m_so1.ScriptSetPhysicsStatus(true);
// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
- so.ScriptSetPhysicsStatus(false);
+ m_so1.ScriptSetPhysicsStatus(false);
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
}
--
cgit v1.1
From 17bf2a62db39ba58ca691a6754bf79fe6b3ee474 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 21 Apr 2012 01:09:19 +0100
Subject: Add test for correct physics status on linking two physics objects
Also fixes last build break.
---
.../Scenes/Tests/SceneObjectStatusTests.cs | 28 ++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index b8e1b92..6270ac1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -26,6 +26,7 @@
*/
using System;
+using System.Collections.Generic;
using System.Reflection;
using NUnit.Framework;
using OpenMetaverse;
@@ -44,13 +45,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public class SceneObjectStatusTests
{
private TestScene m_scene;
+ private UUID m_ownerId = TestHelpers.ParseTail(0x1);
private SceneObjectGroup m_so1;
+ private SceneObjectGroup m_so2;
[SetUp]
public void Init()
{
m_scene = SceneHelpers.SetupScene();
- SceneObjectGroup m_so1 = SceneHelpers.CreateSceneObject(1, UUID.Zero);
+ m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10);
+ m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20);
}
[Test]
@@ -86,7 +90,27 @@ namespace OpenSim.Region.Framework.Scenes.Tests
m_so1.ScriptSetPhysicsStatus(false);
- Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
+ Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
+ }
+
+ ///
+ /// Test that linking results in the correct physical status for all linkees.
+ ///
+ [Test]
+ public void TestLinkPhysicsBothPhysical()
+ {
+ TestHelpers.InMethod();
+
+ m_scene.AddSceneObject(m_so1);
+ m_scene.AddSceneObject(m_so2);
+
+ m_so1.ScriptSetPhysicsStatus(true);
+ m_so2.ScriptSetPhysicsStatus(true);
+
+ m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List() { m_so2.LocalId });
+
+ Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
+ Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
}
}
}
\ No newline at end of file
--
cgit v1.1
From 9ac48b2aff2ddd00821b7e6ecd71ce134f7a0f25 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 21 Apr 2012 01:43:09 +0100
Subject: Fix a bug where linking a non-physical prim with a physical prim as
root would make the non-physical prim phantom rather than part of the physics
object.
On region restart, the whole object would become physical as expected.
Observed behaviour from elsewhere is that all prims in a new linkset should take on the status of the root prim.
Add regression test for this behaviour.
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 +++
.../Framework/Scenes/Tests/SceneObjectStatusTests.cs | 19 +++++++++++++++++++
2 files changed, 22 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8e786c1..49a3485 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2010,6 +2010,7 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.CreateSelected = true;
linkPart.LinkNum = linkNum++;
+ linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
SceneObjectPart[] ogParts = objectGroup.Parts;
Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@@ -2220,6 +2221,8 @@ namespace OpenSim.Region.Framework.Scenes
oldRot = part.RotationOffset;
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
part.RotationOffset = newRot;
+
+ part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
}
///
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 6270ac1..91f4a34 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -112,5 +112,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
}
+
+ ///
+ /// Test that linking results in the correct physical status for all linkees.
+ ///
+ [Test]
+ public void TestLinkPhysicsRootPhysicalOnly()
+ {
+ TestHelpers.InMethod();
+
+ m_scene.AddSceneObject(m_so1);
+ m_scene.AddSceneObject(m_so2);
+
+ m_so1.ScriptSetPhysicsStatus(true);
+
+ m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List() { m_so2.LocalId });
+
+ Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
+ Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From d5c724e5b8cc15ce278b80070238e72a2e4ea0e8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 21 Apr 2012 01:51:57 +0100
Subject: Add regression test for prim status when root prim in a new linkset
is non-physical
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
.../Framework/Scenes/Tests/SceneObjectStatusTests.cs | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index d2cd37d..1592131 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1708,7 +1708,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (ParentGroup.Scene == null)
return;
-
+
if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
return;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 91f4a34..8cdd645 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -131,5 +131,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
}
+
+ ///
+ /// Test that linking results in the correct physical status for all linkees.
+ ///
+ [Test]
+ public void TestLinkPhysicsChildPhysicalOnly()
+ {
+ TestHelpers.InMethod();
+
+ m_scene.AddSceneObject(m_so1);
+ m_scene.AddSceneObject(m_so2);
+
+ m_so2.ScriptSetPhysicsStatus(true);
+
+ m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List() { m_so2.LocalId });
+
+ Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
+ Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From 77a7de87e1c89385bc906d1b409ec1c94c41b9e6 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 21 Apr 2012 02:45:16 +0100
Subject: Add test for setting physics in a linkset
---
.../Scenes/Tests/SceneObjectStatusTests.cs | 30 ++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 8cdd645..882031c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
}
[Test]
- public void TestSetPhantom()
+ public void TestSetPhantomSinglePrim()
{
TestHelpers.InMethod();
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
}
[Test]
- public void TestSetPhysics()
+ public void TestSetPhysicsSinglePrim()
{
TestHelpers.InMethod();
@@ -92,6 +92,32 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
}
+
+ [Test]
+ public void TestSetPhysicsLinkset()
+ {
+ TestHelpers.InMethod();
+
+ m_scene.AddSceneObject(m_so1);
+ m_scene.AddSceneObject(m_so2);
+
+ m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List() { m_so2.LocalId });
+
+ m_so1.ScriptSetPhysicsStatus(true);
+
+ Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
+ Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
+
+ m_so1.ScriptSetPhysicsStatus(false);
+
+ Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
+ Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
+
+ m_so1.ScriptSetPhysicsStatus(true);
+
+ Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
+ Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
+ }
///
/// Test that linking results in the correct physical status for all linkees.
--
cgit v1.1