Merge branch 'master' of /home/opensim/var/repo/opensim

integration
BlueWall 2012-04-20 21:32:26 -04:00
commit 9b1741da0d
4 changed files with 103 additions and 9 deletions

View File

@ -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);
}
/// <summary>

View File

@ -1706,6 +1706,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="isNew"></param>
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();
}

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using NUnit.Framework;
using OpenMetaverse;
@ -43,24 +44,111 @@ namespace OpenSim.Region.Framework.Scenes.Tests
[TestFixture]
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();
m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10);
m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20);
}
[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));
}
[Test]
public void TestSetPhysics()
{
TestHelpers.InMethod();
SceneObjectPart rootPart = m_so1.RootPart;
Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
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));
}
/// <summary>
/// Test that linking results in the correct physical status for all linkees.
/// </summary>
[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<uint>() { m_so2.LocalId });
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
}
/// <summary>
/// Test that linking results in the correct physical status for all linkees.
/// </summary>
[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<uint>() { m_so2.LocalId });
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
}
/// <summary>
/// Test that linking results in the correct physical status for all linkees.
/// </summary>
[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<uint>() { m_so2.LocalId });
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
}
}
}