From: Christopher Yeoh <yeohc@au1.ibm.com>

The attached patch fixes the bug where when linking in a new set of
prims to an already linked set of objects the prims were placed at the
end of the list rather than just after the root prim. ie.  link prim
order result was different on OpenSim compared to an LL server. This
causes a few issues with respect to compatibility of scripts,
especially when using llCreateLink.
0.6.0-stable
Dr Scofield 2008-10-28 11:26:23 +00:00
parent 8ea4553d39
commit 1a06045c98
2 changed files with 37 additions and 25 deletions

View File

@ -1373,7 +1373,8 @@ namespace OpenSim.Region.Environment.Scenes
List<SceneObjectGroup> children = new List<SceneObjectGroup>();
if (parenPrim != null)
{
for (int i = 0; i < childPrims.Count; i++)
// We do this in reverse to get the link order of the prims correct
for (int i = childPrims.Count - 1; i >= 0; i--)
{
foreach (EntityBase ent in EntityList)
{

View File

@ -1830,29 +1830,42 @@ namespace OpenSim.Region.Environment.Scenes
lock (m_parts)
{
m_parts.Add(linkPart.UUID, linkPart);
}
linkPart.LinkNum = m_parts.Count;
// Insert in terms of link numbers, the new links
// before the current ones (with the exception of
// the root prim. Shuffle the old ones up
foreach (KeyValuePair<UUID, SceneObjectPart> kvp in m_parts)
{
if (kvp.Value.LinkNum != 1) {
// Don't update root prim link number
kvp.Value.LinkNum += objectGroup.PrimCount;
}
}
linkPart.SetParent(this);
linkPart.AddFlag(PrimFlags.CreateSelected);
//if (linkPart.PhysActor != null)
//{
// m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
linkPart.LinkNum = 2;
//linkPart.PhysActor = null;
//}
linkPart.SetParent(this);
linkPart.AddFlag(PrimFlags.CreateSelected);
//TODO: rest of parts
foreach (SceneObjectPart part in objectGroup.Children.Values)
{
if (part.UUID != objectGroup.m_rootPart.UUID)
{
LinkNonRootPart(part, oldGroupPosition, oldRootRotation);
}
part.ClearUndoState();
}
//if (linkPart.PhysActor != null)
//{
// m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
//linkPart.PhysActor = null;
//}
//TODO: rest of parts
int linkNum = 3;
foreach (SceneObjectPart part in objectGroup.Children.Values)
{
if (part.UUID != objectGroup.m_rootPart.UUID)
{
LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
}
part.ClearUndoState();
}
}
m_scene.UnlinkSceneObject(objectGroup.UUID, true);
objectGroup.Children.Clear();
@ -1961,17 +1974,15 @@ namespace OpenSim.Region.Environment.Scenes
m_isBackedUp = false;
}
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation)
private void LinkNonRootPart(SceneObjectPart part, Vector3 oldGroupPosition, Quaternion oldGroupRotation, int linkNum)
{
part.SetParent(this);
part.ParentID = m_rootPart.LocalId;
lock (m_parts)
{
m_parts.Add(part.UUID, part);
}
// Caller locks m_parts for us
m_parts.Add(part.UUID, part);
part.LinkNum = m_parts.Count;
part.LinkNum = linkNum;
Vector3 oldPos = part.OffsetPosition;
oldPos *= oldGroupRotation;