aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs20
2 files changed, 26 insertions, 3 deletions
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
1706 /// <param name="isNew"></param> 1706 /// <param name="isNew"></param>
1707 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) 1707 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
1708 { 1708 {
1709 if (ParentGroup.Scene == null)
1710 return;
1711
1709 if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) 1712 if (!ParentGroup.Scene.PhysicalPrims && UsePhysics)
1710 return; 1713 return;
1711 1714
@@ -4161,7 +4164,7 @@ namespace OpenSim.Region.Framework.Scenes
4161 // For now, we use the NINJA naming scheme for identifying joints. 4164 // For now, we use the NINJA naming scheme for identifying joints.
4162 // In the future, we can support other joint specification schemes such as a 4165 // In the future, we can support other joint specification schemes such as a
4163 // custom checkbox in the viewer GUI. 4166 // custom checkbox in the viewer GUI.
4164 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4167 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4165 { 4168 {
4166 string hingeString = "hingejoint"; 4169 string hingeString = "hingejoint";
4167 return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString); 4170 return (Name.Length >= hingeString.Length && Name.Substring(0, hingeString.Length) == hingeString);
@@ -4177,7 +4180,7 @@ namespace OpenSim.Region.Framework.Scenes
4177 // For now, we use the NINJA naming scheme for identifying joints. 4180 // For now, we use the NINJA naming scheme for identifying joints.
4178 // In the future, we can support other joint specification schemes such as a 4181 // In the future, we can support other joint specification schemes such as a
4179 // custom checkbox in the viewer GUI. 4182 // custom checkbox in the viewer GUI.
4180 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4183 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4181 { 4184 {
4182 string ballString = "balljoint"; 4185 string ballString = "balljoint";
4183 return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString); 4186 return (Name.Length >= ballString.Length && Name.Substring(0, ballString.Length) == ballString);
@@ -4193,7 +4196,7 @@ namespace OpenSim.Region.Framework.Scenes
4193 // For now, we use the NINJA naming scheme for identifying joints. 4196 // For now, we use the NINJA naming scheme for identifying joints.
4194 // In the future, we can support other joint specification schemes such as a 4197 // In the future, we can support other joint specification schemes such as a
4195 // custom checkbox in the viewer GUI. 4198 // custom checkbox in the viewer GUI.
4196 if (ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints) 4199 if (ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene.SupportsNINJAJoints)
4197 { 4200 {
4198 return IsHingeJoint() || IsBallJoint(); 4201 return IsHingeJoint() || IsBallJoint();
4199 } 4202 }
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
62 62
63 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 63 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
64 } 64 }
65
66 [Test]
67 public void TestSetPhysics()
68 {
69 TestHelpers.InMethod();
70
71// Scene scene = SceneSetupHelpers.SetupScene();
72 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, UUID.Zero);
73 SceneObjectPart rootPart = so.RootPart;
74 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
75
76 so.ScriptSetPhysicsStatus(true);
77
78// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
79 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
80
81 so.ScriptSetPhysicsStatus(false);
82
83 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
84 }
65 } 85 }
66} \ No newline at end of file 86} \ No newline at end of file