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.
0.7.3-extended
Justin Clark-Casey (justincc) 2012-04-21 01:43:09 +01:00
parent c7ddc7a633
commit 74a5226af5
2 changed files with 22 additions and 0 deletions

View File

@ -2021,6 +2021,7 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.CreateSelected = true; linkPart.CreateSelected = true;
linkPart.LinkNum = linkNum++; linkPart.LinkNum = linkNum++;
linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
SceneObjectPart[] ogParts = objectGroup.Parts; SceneObjectPart[] ogParts = objectGroup.Parts;
Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@ -2231,6 +2232,8 @@ namespace OpenSim.Region.Framework.Scenes
oldRot = part.RotationOffset; oldRot = part.RotationOffset;
Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot; Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
part.RotationOffset = newRot; part.RotationOffset = newRot;
part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
} }
/// <summary> /// <summary>

View File

@ -113,5 +113,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None));
Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None)); Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.None));
} }
/// <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));
}
} }
} }